Skip to content

Support for hatchling and pdm (implement hook API) #401

Description

@kiyoon

Nowadays, it is becoming popular to use a modern build system. Versioneer is my favourite of all versioning tools I've used, but unfortunately it is limited to setuptools, which is limiting me to move onto different build systems. I tried versioneer with hatch as follows:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "code"
path = "src/my_project/_version.py"
expression = "get_versions()['version']"

This was very straightforward so far. But the real problem is that versioneer doesn't provide a hook API to use for building sdist etc. and the _version.py needs to be replaced to a file with a constant when building!

This should be very easy to do with hooks:

https://hatch.pypa.io/latest/plugins/build-hook/reference/#hatchling.builders.hooks.plugin.interface.BuildHookInterface--hookspy

I appreciate your work on this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    build toolsSuggestions for extending beyond setuptools

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions