Formulate using Lark #37
Replies: 6 comments 9 replies
-
Hello @aryan26roy and @jpivarski. I'm not the author of this package but from my perspective the package has effectively been dead since several years, with no real developments. As the main functionality is meant to be what you list, I would personally go ahead 👍. My 2 cents. |
Beta Was this translation helpful? Give feedback.
-
I'd say go ahead! I do plan to integrate it in the mid future to uproot-browser, and would love to see it get updated first. :) |
Beta Was this translation helpful? Give feedback.
-
The formulate package on PyPI is owned by @chrisburr and the scikit-hep account. One of us will probably need to get access to that to be able to push a new release. I still don't have access to the scikit-hep account since 2-factor authentication was added. (It has been on my to-do list for a while, and Chris and I never managed to have a one-on-one meeting to share the QR code.) |
Beta Was this translation helpful? Give feedback.
-
@jonas-eschle, does zfit depend on the formulate interface? What requirements do you have on it? |
Beta Was this translation helpful? Give feedback.
-
Thanks for bringing this up! I've been digging into formulate a while ago to resurect it, but it needs indeed a major overhaul and incompatible changes that I started, yet I never implemented these as they grew too big (only minor changes). Very welcome from my side to perform these changes, fully agree on the plan and I am also available to help with some stuff (reviews, design, code,...). One of my plans was to use Sympy instead of numexpr, so effectively a ROOT <=> Sympy converter, since Sympy can convert to and from numexpr and more (but Sympy handles a few things, like the equal, a bit different). The advantage would be that simplifications could be easily made (i.e. remove unnecessary braces), other backends can be supported (whatever sympy has) and that a latex representation would be readily available. So anything is fine with me, please go ahead with all the incompatible changes and see as it fits. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, I am happy to announce that the main branch as of today, is a subset (functionality wise) of the master branch built completely from scratch using Lark. The Python API remains the same except for the Expression object and the CLI. Currently there are a bunch of unit tests that aim to pin down the behavior of the new formulate when it comes to parsing numexpr and TTreeFormula. The new formulate additionally adds support for TTreeFormula special functions ( The ones that end in dollar sign in this documentation). A few of the special functions could not implemented because they are not "functions" as we commonly think of them in the context of functional programming (What they do depends on what expression they are embedded within). If there are no objections, we will switch the default branch of this repo to main and release the new formulate as v1.0. Let us know if it's all okay. Signed, |
Beta Was this translation helpful? Give feedback.
-
Hi @chrisburr @eduardo-rodrigues @jonas-eschle and @henryiii ,
Me and @jpivarski are working on a new version of Formulate on the main branch which has the following features:
Our main goal is to be able to easily translate formulas to and from ROOT TTree, Numexpr and Uproot. GIven that the infrastructure for converting to and from Numexpr is not in place yet, if this branch is made the sole branch right now, we would loose that capability temporarily.
The reason for starting this discussion is to ask for any opinions on this and the possibility of making this the sole implementation for this library. Our main concerns are with the interface and how, if at all, making major API changes may have any downstream effects.
Beta Was this translation helpful? Give feedback.
All reactions