Closed cmalinmayor closed 4 months ago
if you're using setuptools, then use setuptools_scm
(which is what hatch-vcs uses under the hood anyway): https://github.com/pypa/setuptools_scm
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
[project]
dynamic = ["version"]
[tool.setuptools_scm]
Then don't forget to add it somewhere in your package, for example in __init__.py
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version("motile-toolbox")
except PackageNotFoundError:
# package is not installed
__version__ = 'uninstalled'
I wouldn't mind automating the versioning there as well 😆
yeah we left that manually done there to minimize the amount of tooling that I was piling onto Jan at the moment :joy: can add
Worked perfectly :) thank you!!
@tlambert03 I think I got the "dynamic" version tag in my
pyproject.toml
from your cookiecutter repo, but I see now that your cookie cutter uses hatch to provide the version from "vcs". Is there an equivalent for setuptools to provide the version from github? Should I just switch to hatch? I'll look into it myself as well, but I figured you might have an immediate idea 🙂 P.S. I did mess up the motile (main repo, not toolbox) releases a bit by not following the (very clear) instructions in the README about updating the__init__.py
and making an annotated tag... so I wouldn't mind automating the versioning there as well 😆