Skip to content

Install

Requirements

  • Python 3.9+
  • A C++17 compiler (Clang, GCC, or MSVC)
  • CMake 3.20+
  • Ninja (recommended)
  • uv (recommended) or pip

Install from PyPI with uv (recommended)

uv add autoneuronet

Or with pip

pip install autoneuronet

Optional extras

# uv
uv add "autoneuronet[demo]"
uv add "autoneuronet[dev]"

# pip
python -m pip install "autoneuronet[demo]"
python -m pip install "autoneuronet[dev]"

Build locally

First, clone the repo from Github:

git clone https://github.com/RishabSA/AutoNeuroNet.git
cd AutoNeuroNet

To build the C++ library directly (useful for running the C++ demos):

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build

To build and install the Python package locally with uv:

# Creates .venv, builds the C++ extension via scikit-build-core + pybind11,
# installs everything from uv.lock.
uv sync --extra demo

# Run code inside the managed environment
uv run python -c "import autoneuronet as ann; print(ann.Var(2.0))"

Or with pip + build:

python -m pip uninstall -y autoneuronet # (if a preexisting package already exists)

python -m pip install -U pip build twine
python -m build
python -m pip install dist/*.whl

To build with twine to upload to PyPi, run the following commands:

python -m twine check dist/*

Upload to TestPyPi or PyPi:

python -m twine upload -r testpypi dist/* # Upload to TestPyPi
python -m twine upload dist/* # Upload to PyPi

Build wheels for macOS, Windows, and Linux via Github Actions

  1. Commit all changes, but don't push yet
  2. Push a tag for the version: v0.1.N (Note: If you push without setting a tag, the wheels workflow will not run, and the package will not be pushed to PyPi)
git tag -a v0.1.N -m "v0.1.N"
git push origin main v0.1.N

The workflow in .github/workflows/wheels.yml builds wheels for Linux, macOS, and Windows. Wheels are then published to PyPI via an API token.

Verify the install

python - <<'PY'
import autoneuronet as ann
x = ann.Var(2.0)
y = x * x
print(y)
PY