Installation#

Requirements#

cultivars supports CPython 3.12, 3.13 and 3.14 on Linux, macOS and Windows. It is distributed as three packages that install together:

Distribution

Requires

Holds

cultivars

the two below, and ns-sdn

Every public model, test, filter and result.

cultivars-engine

numpy, scipy

The private numerical layers. Each cultivars release pins one engine release exactly.

cultivars-data

fedfred, edgar-sec, toros

The data layer: provider clients re-exported under one import, from cultivars_data import economic.

The models themselves run on numpy and scipy alone. pandas arrives with the data layer, and polars comes in through an extra:

Extra

Installs

Switches on

(none)

the three distributions above

Every model, test, filter and result. Inputs are array-likes; outputs are numpy.ndarray and plain records.

pandas

pandas

to_pandas() on results and summary tables. pandas is already present through cultivars-data; the extra is kept so that existing install commands keep working.

polars

polars

to_polars() on results and summary tables.

Note

The examples download FRED data through cultivars_data.economic and draw figures with matplotlib. From 1.0.0a7 cultivars no longer installs matplotlib, so install it yourself to run the examples. Nothing in the library itself imports the data layer or matplotlib.

Install a pre-release#

The default install resolves to 0.0.5, a stable-channel republish of 1.0.0a8 with identical code. To get later pre-releases as they ship, installers must be asked for them explicitly.

pip install cultivars
pip install "cultivars[pandas]"
uv add cultivars
uv add "cultivars[pandas]"
pip install "cultivars==0.0.5"

An exact pin needs no --pre flag.

Pin the exact version in anything that must reproduce: a paper’s replication package, a CI job, a lockfile. Between pre-releases, argument names, result fields and summary wording can still change. Every such change is listed in the release notes. The public API freezes at 1.0.0b1. A conda-forge package follows the first stable release.

Check the installation#

python -c "from importlib.metadata import version; print(version('cultivars'))"

The same string is available inside Python as cultivars.__about__.__version__.

Data for the examples#

The examples download their data from FRED through cultivars_data.economic, which is the fedfred client and needs a free API key from the St. Louis Fed. Set it once in your shell:

export FRED_API_KEY=your_key

The quickstart and every docstring example run on simulated data and need no key.

Development install#

A development checkout uses uv and the dev dependency group, which brings in the test, lint, type-checking and documentation tools:

git clone https://github.com/nikhilxsunder/cultivars.git
cd cultivars
git switch dev
uv sync --group dev
uv run pre-commit install

Then:

uv run ruff check src/cultivars          # lint
uv run mypy                              # type-check
uv run make -C docs html                 # docs, running the examples
DOCS_PLOT_GALLERY=0 uv run make -C docs html   # docs, skipping the examples

Keep the checkout outside folders a sync service mirrors, such as iCloud Drive’s Desktop & Documents or Dropbox. Those services create numbered copies (file 2.py) of files that tools rewrite quickly, and Python and Sphinx pick the copies up as real files.

Troubleshooting#

No matching distribution found for cultivars

The installer is skipping pre-releases. Add --pre (pip), --prerelease allow (uv), or pin the exact version.

Requires-Python >=3.12

cultivars uses syntax from Python 3.12. Create an environment with a supported interpreter, for example uv venv --python 3.13.

ImportError: pandas is required for this conversion

A to_pandas() call needs the pandas extra, and to_polars() the polars extra. Install the one the message names, or read the result’s array attributes directly.