Development

Tools

Setup development

  1. Install uv - https://docs.astral.sh/uv/getting-started/installation/

  2. Run uv sync --group test to install the default development environment plus test tools

Run unit tests using uv

$ uv run pytest tests

Run benchmarks using uv

$ uv run pytest tests/benchmarks --benchmark-enable

Run integration tests (with real postgres) using uv. Postgres in this case accessed via localhost.

$ docker compose up -d postgres
$ uv run pytest tests_pg --pg-host=localhost
$ docker compose down

Run tests with memray

$ uv run pytest tests --memray

Or you can use lets task runner to run unit + integration tests (all-on-one) in docker

$ lets test

Run linters, formatters and other checks

$ uv run flake8
$ uv run black hiku examples
$ uv run mypy

Build docs Docs will be available at docs/build

$ uv run sphinx-build -b html docs docs/build

Run examples

$ uv run --group examples python examples/graphql_aiohttp.py

Setup uv with IDE

uv creates a project-local virtual environment in .venv.

Run uv sync. It will create the .venv directory with the virtual environment.

Point your IDE to this virtual environment and you are good to go.

In PyCharm you can also mark some directories as excluded to speed up indexing and autocompletion, and to make search ignore venv.

  1. Open PyCharm Settings -> Project Structure

  2. Mark .venv as Excluded

  3. Mark .venv/lib/<python_version>/site-packages both as Excluded (to exclude files from search) and Sources (to enable autocompletion)

Integrate with pyright

Pyright is a static type checker for Python and is used many in VSCode and `` integrate it with your IDE. Changelog ~~~~~~~~~

When developing, add notes to 0.x.xrcX section.

For example if we current version is 0.7.1 and we are woring on 0.7.2 we should create section 0.7.2rcX.

After we decided to release new version, we must rename 0.7.2rcX to 0.7.2.

Release process

Hiku supports semver versioning.

  1. Update the changelog in the docs/changelog/changes_0X.rst file.

  2. Merge changes into master.

  3. Run lets release <version> -m ‘your release message’. This updates version in pyproject.toml, creates and pushes an annotated tag. When the new tag is pushed, the release action on GitHub publishes the package to pypi.

Note

lets release command will bump version automatically if you pass rc as a version. For example lets release rc -m 'your release message' will bump version to 0.x.xrcX.

Documentation release

Documentation released on new commits in master.