Installation
Formulate needs Python 3.10 or newer, and can be installed with pip, with
conda, or from source. It is a pure-Python package with three small
dependencies (lark, hepunits and ordered-set); notably, it does
not require ROOT or NumExpr, since it only reads and writes their syntax.
Using pip
The recommended way to install Formulate is using pip, ideally inside a virtual environment:
pip install formulate
For development or to get the latest unreleased changes, you can install directly from GitHub:
pip install git+https://github.com/scikit-hep/formulate.git
Using conda
Formulate is also available on conda-forge:
conda install -c conda-forge formulate
The -c conda-forge is only needed if you do not already have the
conda-forge channel configured.
From Source
To install Formulate from source:
Clone the repository:
git clone https://github.com/scikit-hep/formulate.git cd formulate
Install in development mode:
pip install -e .
Add the
devextra —pip install -e ".[dev]"— if you intend to run the tests, the linters or the docs build. See Contributing to Formulate for what that gets you.
Verifying Installation
To verify that Formulate is installed correctly, you can run:
import formulate
print(formulate.__version__)
1.0.2.dev39+ga79e24ed2
The command-line interface is installed alongside the library:
formulate --from-root 'TMath::Sqrt(x)' --to-numexpr