Installation
Prerequisites
- Python 3.9 or higher
- Git
- (Optional) uv - A fast Python package installer and resolver
Check your Python version:
Development Installation
Step 1: Clone the Repository
Step 2: Create a Virtual Environment
It's strongly recommended to use a virtual environment for development:
Step 3: Install in Development Mode
Install JAFF in editable mode with all development dependencies:
The -e flag installs the package in "editable" mode, meaning changes you make to the source code are immediately reflected without reinstalling.
Dependencies
Core Dependencies
These are automatically installed with JAFF:
- numpy (≥2.0.0) - Numerical computations
- scipy (≥1.13.0) - Scientific computing
- sympy (≥1.14.0) - Symbolic mathematics
- tqdm (≥4.67.1) - Progress bars
- h5py (≥3.9.0) - HDF5 file support
Development Dependencies
When installing with [dev], the following additional packages are installed:
Testing Tools
- pytest (≥7.0) - Testing framework
- pytest-cov - Code coverage reporting
- ruff - Fast Python linter and formatter
- check-jsonschema - JSON schema validation
Documentation Tools
- mkdocs (≥1.5.3) - Documentation generator
- mkdocs-material (≥9.5.0) - Material theme for MkDocs
- mkdocstrings[python] (≥0.24.0) - API documentation from docstrings
- mkdocstrings-python (≥1.7.0) - Python handler for mkdocstrings
- mkdocs-git-revision-date-localized-plugin (≥1.2.0) - Git revision dates in docs
- mkdocs-git-authors-plugin (≥0.7.0) - Git authors information
- mkdocs-minify-plugin (≥0.7.0) - Minification for HTML/CSS/JS
- pymdown-extensions (≥10.5) - Advanced Markdown extensions
- markdown (≥3.5.0) - Markdown parser
- pillow (≥10.0.0) - Image processing for docs
- cairosvg (≥2.7.0) - SVG processing for docs
Verifying Your Development Setup
After installation, verify everything is working:
# Check JAFF version
python -c "import jaff; print(jaff.__version__)"
# Test the CLI
jaffgen --help
# Run the test suite
pytest
# Check code style
ruff check .
Running Tests
JAFF uses pytest for testing. See the Testing Guide for details.
Run All Tests
Run with Coverage
This generates an HTML coverage report in htmlcov/index.html.
Run Specific Tests
# Run tests in a specific file
pytest tests/test_network.py
# Run tests matching a pattern
pytest -k "test_reaction"
# Run with verbose output
pytest -v
Using uv to Run Tests
# uv can run commands in the virtual environment
uv run pytest
# With coverage
uv run pytest --cov=jaff
Building Documentation
JAFF uses MkDocs with the Material theme for documentation.
Build Documentation Locally
Then open your browser to http://127.0.0.1:8000. The documentation will automatically rebuild when you save changes.
Build Static Documentation
Using uv to Build Documentation
Documentation Commands
# Serve with live reload (auto-updates on changes)
mkdocs serve
# Build static site
mkdocs build
# Deploy to GitHub Pages (maintainers only)
mkdocs gh-deploy
# Validate documentation links
mkdocs build --strict
Code Style and Linting
JAFF uses Ruff for linting and formatting.
Check Code Style
Auto-Fix Issues
# Auto-fix linting issues where possible
ruff check --fix .
# Auto-format code
ruff format .
# Organize imports
ruff check --select I --fix
Using uv
# Check with uv
uv run ruff check .
uv run ruff format --check .
# Fix with uv
uv run ruff check --fix .
uv run ruff format .
# Organize imports with uv
ruff check --select I --fix
Updating Dependencies
Update Development Installation
With uv:
# Pull latest changes
git pull
# Update dependencies (uv automatically resolves to latest compatible versions)
uv pip install -e ".[dev]" --upgrade
Working with uv (Recommended)
uv is a fast Python package installer and resolver written in Rust. It's significantly faster than pip for installing packages.
Install uv
# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or with pip
pip install uv
Common uv Commands
# Create virtual environment
uv venv
# Install package
uv pip install package_name
# Install from requirements
uv pip install -r requirements.txt
# Install in editable mode
uv pip install -e ".[dev]"
# Run command in virtual environment
uv run pytest
uv run mkdocs serve
uv run python script.py
# Compile requirements (for reproducibility)
uv pip compile pyproject.toml -o requirements.txt
IDE Setup
VS Code
Recommended extensions:
- Python
- Pylance
- Ruff
- Even Better TOML
Settings (.vscode/settings.json):
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"editor.formatOnSave": true,
"python.linting.enabled": true,
"ruff.format.args": ["--config", "pyproject.toml"]
}
PyCharm
- Set Python interpreter to your virtual environment
- Enable pytest as the test runner
- Install the Ruff plugin (if available)
Zed
Settings (.zed/settings.json):
{
"languages": {
"Python": {
"language_servers": ["pyright"],
"format_on_save": true
}
},
"python": {
"interpreter": ".venv/bin/python"
},
"formatter": {
"external": {
"command": "ruff",
"arguments": ["format", "--config", "pyproject.toml", "-"]
}
},
"lint": {
"external": {
"command": "ruff",
"arguments": ["check", "--config", "pyproject.toml", "-"]
}
}
}
Contributing
Before submitting a pull request:
- Run tests:
pytest - Lint code:
ruff check . - Format code:
ruff format . - Build docs:
mkdocs build --strict - Update documentation if you've added features
See Contributing Guide for detailed contribution guidelines.