A small collection of dependency-free math helper functions for Python, managed with uv.
pip install mathkit-helpersfrom mathkit_helpers import add, is_prime, mean
add(2, 3) # 5
is_prime(17) # True
mean([1, 2, 3, 4]) # 2.5Available functions: add, subtract, multiply, divide, factorial, is_prime, gcd, lcm, mean, median.
This project uses uv for dependency management and packaging.
# Install dependencies (including dev dependencies)
uv sync
# Run tests
uv run pytestuv buildThis produces a wheel and sdist in dist/.
# Test PyPI first (recommended)
uv publish --index testpypi --token <your-testpypi-token>
# Real PyPI
uv publish --token <your-pypi-token>You can also configure credentials via the UV_PUBLISH_TOKEN environment variable instead of passing --token.
This repo includes .github/workflows/publish.yml, which builds and publishes to PyPI automatically whenever a GitHub Release is published, using PyPI Trusted Publishing (no API tokens stored in the repo).
To set it up:
- On PyPI, go to your project's Settings → Publishing and add a new trusted publisher:
- Owner: your GitHub username/org
- Repository name: this repo's name
- Workflow name:
publish.yml - Environment name:
pypi
- In your GitHub repo, go to Settings → Environments and create an environment named
pypi(optionally with required reviewers for extra safety). - Bump the
versionin pyproject.toml and push. - Create a GitHub Release (tag e.g.
v0.1.0) — the workflow will build and publish automatically.
MIT — see LICENSE.