Use hatch-vcs
only for dev version
#876
Replies: 2 comments
-
can you please give a full example? |
Beta Was this translation helpful? Give feedback.
-
sure, here is my legacy code: with open(os.path.join(DIR_NAME, 'VERSION')) as f:
VERSION = f.read().strip()
is_dev_version = VERSION.endswith('D')
if is_dev_version:
install_requires.append("setuptools_scm")
def sat_dev_version():
"""Use mercurial data to compute version"""
def version_scheme(version):
return VERSION.replace('D', '.dev0')
def local_scheme(version):
return "+{rev}.{distance}".format(
rev=version.node[1:],
distance=version.distance)
return {
'version_scheme': version_scheme,
'local_scheme': local_scheme
} (full source at https://repos.goffi.org/libervia-backend/file/d10748475025/setup.py#l81) So I would like to do something similar with Hatch if possible, i.e. if version ends with edit: for the use case, it's really useful to retrieve which exact version a user has installed, notably when dev version is installed e.g. with Arch packages. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Is is possible to use
hatch-vcs
only for dev version? I'm using normal versioning for stable release, but when it's a dev version, I like to add VCS metadata (Mercurial in my case) such as the commit hash.In my legacy
setup.py
I had a code detecting dev version and usingsetuptools-scm
in this case, is there a way to do a similar thing inpyproject.toml
with Hatch?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions