Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for full hatchling versioning. #1026

Open
jeeftor opened this issue Apr 18, 2024 · 5 comments
Open

Support for full hatchling versioning. #1026

jeeftor opened this issue Apr 18, 2024 · 5 comments

Comments

@jeeftor
Copy link

jeeftor commented Apr 18, 2024

It looks like hatchling is being used under the hood. In my use case I'd like to utilize test.pypi and when I was using poetry I could do .dev versions.

The first one here was uploaded with rye but I found I couldn't easily support .dev versions

image

However to the best of my knowledge you are using hatchling under the hood.

I did the following:

Modified my pyproject:

image

Then I ran

image

So it looks like it wouldn't be to hard to implement a -dev version flag somehow.

@jeeftor
Copy link
Author

jeeftor commented Apr 18, 2024

image

Also here it looks like Rye can build fine with the modified version string in the pyproject.toml

@jeeftor
Copy link
Author

jeeftor commented Apr 18, 2024

I see I can call this directly as well:

image

So I guess I'm adding for an additional option to add a -dev version in

@jeeftor
Copy link
Author

jeeftor commented Apr 18, 2024

In any case this is my work around in GitHub action:

image

@geodab
Copy link

geodab commented Apr 18, 2024

If you tag your releases then an alternative workaround to consider might be to switch the backend from hatchling to setuptools and then use the standard configuration of setuptools_scm to dynamically generate the version based on the latest tagged version and commit state. Between tagged releases the default versioning scheme for that setup will automatically include a devN component based on the commit distance from the latest version tag, and you can run rye version to see the dynamically computed version. Here's the relevant snippets of configuration required in the pyproject.toml to enable that:

[project]
#version = "dynamic"
dynamic = ["version"]

[build-system]
requires = ["setuptools>=69", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# can be empty if no extra settings are needed, presence enables setuptools_scm

@ofek
Copy link

ofek commented Apr 21, 2024

Hatchling supports that directly and the maintainer uses this as well https://github.com/ofek/hatch-vcs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants