Development
This page covers working on H9A's source code.
Clone the repository
git clone https://github.com/rkriad585/h9a.git
cd h9a
Set up a virtual environment (recommended)
python -m venv .venv
Activate it:
- Windows (PowerShell):
.venv\Scripts\Activate.ps1 - Windows (cmd):
.venv\Scripts\activate.bat - macOS / Linux:
source .venv/bin/activate
Install the package in editable mode
python -m pip install -e .[screenshot]
The screenshot extra adds Pillow, which is needed for --screenshot and generate_screenshot().
Run the application
h9a
or, without installing the console script:
python -m h9a
Use the library directly
from h9a import count_digit, render_text
result = count_digit(digit=9, start=1, end=100)
print(render_text(result))
See api.md.
Generate screenshots
h9a --screenshot
Regenerates Screenshots/home.png. See screenshots.md.
Tests and linting
The project uses pytest for tests, ruff for linting and formatting, and mypy for type checking. Install the development tools:
python -m pip install -e ".[dev]"
Run the test suite:
pytest
Lint and format check:
ruff check .
ruff format --check .
Type check:
mypy h9a
Optional: install the git hooks so these checks run automatically on every commit:
python -m pip install pre-commit
pre-commit install
Continuous integration
GitHub Actions workflows run automatically when code is pushed to main:
.github/workflows/docs.yml— builds the documentation site (strict mode) and deploys it to GitHub Pages..github/workflows/publish-container.yml— builds the Docker image and publishes it to GitHub Container Registry (ghcr.io/rkriad585/h9a). Releases are tagged fromv*git tags.
Releases are published to PyPI (h9a) from this repository.
Making a change
- Edit the relevant module in
h9a/. - Run
h9a(orpython -m h9a) to confirm the output is still correct. - Follow the contributing guidelines to submit your change.