Skip to content

Dynamic versioning with pyproject.toml #3630

Closed Answered by abravalheri
rndubs asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rndubs, I cannot reproduce this error with the following experiment (in an isolated docker container):

> docker run --rm -it python:3.7.2 /bin/bash
python -m pip install -U pip 'setuptools==65.4.1' build
mkdir -p /tmp/myproj/mymodule
cd /tmp/myproj
echo -e '__version__ = f"{1}.{2}.{3}"' > mymodule/__init__.py
cat <<EOS > pyproject.toml
[project]
name = "mymodule"
dynamic = ["version"]

[build-system]
requires = ["setuptools>=61.0.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["."]
include = ["mymodule*"]

[tool.setuptools.dynamic]
version = {attr = "mymodule.__version__"}
EOS
python -m build

This successfully creates the mymodul…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rndubs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants