A sample Python package for learning PyPI deployment and testing for FARMS.
pip install farms-foofrom farms_foo import hello
print(hello("world")) # "Hello, world!"# Create a virtual environment and install dev dependencies
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest
## Building
### Local build
```bash
python -m buildThis compiles Cython extensions and produces a wheel for your current platform + Python version, along with a source distribution.
# Build both (default)
python -m build
# Only sdist
python -m build --sdist
# Only wheel
python -m build --wheel
# Skip the isolated build environment (use your current venv)
python -m build --no-isolationcibuildwheel runs in GitHub Actions to build wheels across Linux, macOS, and Windows for multiple Python versions. It requires each Python version to be installed, so it's designed for CI — not local use.
To test it locally, you can limit it to your installed Python:
pip install cibuildwheel
CIBW_BUILD="cp312-*" cibuildwheel --output-dir wheelhouseReplace cp312 with whichever Python version you have installed.
twine check dist/*twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ farms-footwine upload dist/*The GitHub Actions workflow handles this automatically:
- On push/PR to main — builds wheels on Ubuntu, macOS, and Windows across Python 3.9, 3.11, 3.12
- On GitHub Release — publishes all wheels + sdist to PyPI via trusted publishing
To trigger a release:
git tag v0.1.0
git push origin v0.1.0Then create a Release on GitHub from that tag.