Development commands

Following are some useful local commands for testing and trying out the package’s features. The package follows the Hubverse Python package standard, and in particular uses uv for managing Python versions, virtual environments, and dependencies.

Note: All shell examples assume you’re using Bash, and that you first cd into this repo’s root directory (e.g., cd /<path_to_repos>/hub-data/).

Note: The Python-based directions below use uv for managing Python versions, virtual environments, and dependencies, but if you already have a preferred Python toolset, that should work too.

Don’t forget to:

  • set __version__ in src/hubdata/init.py

  • add a corresponding CHANGELOG.md entry

Run unit tests (pytest)

Use this command to run tests via pytest:

uv run pytest

Run a linter (ruff)

Run this command to invoke the ruff code formatter.

uv run ruff check

Run a static type checker (mypy)

Use this command to do some optional static type checking using mypy:

uv tool run mypy . --ignore-missing-imports --disable-error-code=attr-defined

Measure code coverage (coverage)

Run this command to generate a text coverage report:

uv run --frozen coverage run -m pytest
uv run --frozen coverage report
rm .coverage

This command generates an html report:

uv run --frozen coverage html
rm -rf htmlcov/index.html

Build documentation

Run the following command to build documentation:

uv run --group docs sphinx-build docs/source docs/_build/html --fresh-env --fail-on-warning

To do the same and then serve documentation locally for debugging:

uv run --group docs sphinx-autobuild docs/source docs/_build/html

Build the package and publish to test.pypi.org

First set and export the UV_PUBLISH_TOKEN environment variable to a token obtained via your test.pypi.org account and then run:

uv build
uv publish --index testpypi