Installation¶
Cython compilation
Compiling the Cython extension gives a 10-50x speedup. Without it, pysrf falls back to a pure Python implementation. Make sure you have a C compiler installed before proceeding.
Automated setup (recommended)¶
Clone the repository and run the setup script:
The script performs the following steps:
- Installs
pyenvif it is not already present. - Installs
poetryif it is not already present. - Installs Python 3.12.4 through
pyenv. - Sets the local Python version.
- Installs all dependencies through
poetry. - Compiles the Cython extension.
- Runs the test suite.
After the script finishes, activate the environment:
Manual installation¶
Install prerequisites¶
Install pyenv and poetry if you do not have them:
Set up python¶
Install Python 3.12.4 (or any version >=3.10) and pin it for this project:
Install dependencies¶
Compile the Cython extension¶
Use the Makefile target or run the build command directly:
The Makefile provides additional targets:
make dev: install dev dependencies and compile Cython.make test: run the test suite.make format: format code with ruff.make clean: remove build artifacts.make docs: build documentation.
Alternative methods¶
From PyPI (planned)¶
As a git subtree¶
Add pysrf as a subtree inside another project:
Update the subtree:
Then install and compile: