Skip to content

Move to hatchling for building the package & use hatch for envs, scripts, matrix tests. #328

Open
@BSchilperoort

Description

@BSchilperoort

Currently, the template is set up to build the package with setuptools. However, the current advise on packaging.python.org is to use hatchling. (related to #318) Edit: The default option is hatch. No specific option is recommended.

This would also be an opportunity to use hatch as project manager. Hatch uses hatchling to build the package in a separate virtual environment, has environment management with scripts, and allows much easier publishing to pypi.
Additionally, hatch is maintained by the Python Packaging Authority.

Hatch would allow us to:

  • Make a more clean repository, with fewer configuration files in the main directory (hatch is configured in pyproject.toml)

  • Define environments, such as a specific environment for building documentation, with the documentation dependencies contained only in there.

  • Define script belonging to a certain environment, for example hatch run docs:build to build the documentation.

  • Define scripts for linting, to replace prospector. With a single command hatch run lint, you can (for example) run black, isort, flake8, mypy, pydoctest, etc.

  • Use matrix tests for different python versions. This could replace tox.

Together with @Peter9192 I have updated era5cli to use hatch, if you want to see a specific use case. The CI is set up to use the same hatch commands that developers do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    templateRelated to the template itself, as opposed to the generated code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions