Metadata-Version: 2.4
Name: mathkit-helpers
Version: 0.1.0
Summary: A small collection of dependency-free math helper functions.
Author: Danang Nur
Author-email: Danang Nur <danang.arbansa@gmail.com>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Project-URL: Homepage, https://github.com/danangan/mathkit-helpers
Project-URL: Issues, https://github.com/danangan/mathkit-helpers/issues
Description-Content-Type: text/markdown

# mathkit-helpers

A small collection of dependency-free math helper functions for Python, managed with [uv](https://docs.astral.sh/uv/).

## Installation

```bash
pip install mathkit-helpers
```

## Usage

```python
from mathkit_helpers import add, is_prime, mean

add(2, 3)          # 5
is_prime(17)        # True
mean([1, 2, 3, 4])  # 2.5
```

Available functions: `add`, `subtract`, `multiply`, `divide`, `factorial`, `is_prime`, `gcd`, `lcm`, `mean`, `median`.

## Development

This project uses [uv](https://docs.astral.sh/uv/) for dependency management and packaging.

```bash
# Install dependencies (including dev dependencies)
uv sync

# Run tests
uv run pytest
```

## Building and publishing to PyPI

### Build

```bash
uv build
```

This produces a wheel and sdist in `dist/`.

### Publish manually

```bash
# 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`.

### Publish via GitHub Actions (recommended)

This repo includes [.github/workflows/publish.yml](.github/workflows/publish.yml), which builds and publishes to PyPI automatically whenever a GitHub Release is published, using [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (no API tokens stored in the repo).

To set it up:

1. 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`
2. In your GitHub repo, go to **Settings → Environments** and create an environment named `pypi` (optionally with required reviewers for extra safety).
3. Bump the `version` in [pyproject.toml](pyproject.toml) and push.
4. Create a GitHub Release (tag e.g. `v0.1.0`) — the workflow will build and publish automatically.

## License

MIT — see [LICENSE](LICENSE).
