Fix version mismatch in PyPI builds (setuptools_scm fallback to 0.0.dev0)
Hi, thanks for maintaining fleck!
At the moment the PyPI sdists for versions 1.1 and 1.1.2 cannot be installed with pip because the embedded metadata reports 0.0.dev0 instead of the tag version. Pip rejects them with:
Discarding fleck-1.1.2.tar.gz ... has inconsistent version: expected '1.1.2', but metadata has '0.0.dev0'
ERROR: No matching distribution found for fleck
Why this happens
Your pyproject.toml and setup.py both use setuptools_scm for versioning:
setup(use_scm_version={'write_to': os.path.join('fleck', 'version.py'),
'write_to_template': VERSION_TEMPLATE})
and
[tool.setuptools_scm]
write_to = "fleck/version.py"
This works only if the build is run in a git checkout at a version tag. If the build is done from a zip/tarball without .git/, or not on a tag, setuptools_scm falls back to 0.0.dev0. That appears to be what happened for the 1.1 / 1.1.2 releases uploaded to PyPI.
How to fix it
- Make sure you have a tag locally that matches the version, e.g.
git fetch --tags
git checkout v1.1.2
(git describe should then print v1.1.2.)
- Clean and rebuild from that tag:
rm -rf dist build *.egg-info
python -m build
That will create a wheel and sdist whose metadata matches 1.1.2.
- Upload the fixed artifacts to PyPI:
twine upload dist/*
That should resolve the mismatch and allow:
pip install fleck==1.1.2
to succeed.
Optional cleanup
Since you already have pyproject.toml declaring [tool.setuptools_scm], you could simplify by removing the duplicated use_scm_version={...} from setup.py (keeping only the bare setup()). This reduces the chance of the two drifting out of sync.