Part of the repository modernization effort.
Background
setup.py is the only source of package metadata. The version string 0.32.0 exists in four places:
setup.py:17
docs/conf.py — version = '0.32' and release = '0.32.0'
.cz.yaml:5
flake.nix:68
pyproject.toml holds only a [build-system] table. setup.cfg holds only the flake8 line length.
Warning: commitizen must keep working
.cz.yaml drives the release bump:
---
commitizen:
name: cz_conventional_commits
tag_format: v$version
version: 0.32.0
version_files:
- setup.py
- docs/conf.py
version_files does a literal replace of the version string. If setup.py is deleted, the entry must move to the new version source. Run cz bump --dry-run and confirm the result before you merge.
Note the pre-existing gap: the short version = '0.32' line in docs/conf.py does not match the full 0.32.0 string. commitizen does not bump it today.
Warning: keep README.rst
README.rst is a symlink to docs/intro.rst. docs/intro.rst is a Sphinx source file in reStructuredText.
Do not convert README.rst to Markdown. The conversion breaks the Sphinx build.
A PEP 621 readme = "README.rst" field reads whatever the path resolves to at build time. That is the symlink in a local build. That is the pandoc-built file in the publish workflow. The behavior matches setup.py today. .github/workflows/publish.yml needs no change for this issue.
Proposed pyproject.toml
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "python-binary-memcached"
dynamic = ["version"]
description = "A pure python module to access memcached via its binary protocol with SASL auth support"
readme = "README.rst"
requires-python = ">=3.10"
license = { text = "MIT" }
authors = [
{ name = "Jayson Reis", email = "santosdosreis@gmail.com" },
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"uhashring",
]
[project.urls]
Homepage = "https://github.com/jaysonsantos/python-binary-memcached"
Repository = "https://github.com/jaysonsantos/python-binary-memcached"
Documentation = "https://python-binary-memcached.readthedocs.org"
Changelog = "https://github.com/jaysonsantos/python-binary-memcached/blob/main/CHANGELOG.md"
[tool.setuptools]
packages = ["bmemcached", "bmemcached.client"]
[tool.setuptools.dynamic]
version = { attr = "bmemcached.__version__" }
Warning: where to put __version__
Add __version__ = "0.32.0" as the first line of bmemcached/__init__.py. Put it before the bmemcached.client import.
setuptools reads the attr: target from the module AST. It falls back to a real import when the AST read fails. A plain literal at the top avoids an import of bmemcached.client inside the isolated build environment. That import needs uhashring to be present already.
Acceptance criteria
Files to change
pyproject.toml, bmemcached/__init__.py, setup.py (delete), setup.cfg (delete), .cz.yaml, AGENTS.md, MANIFEST.in (check only).
Order
Do the minimum-version issue first. Do this issue before the ruff issue and the test-dependency issue. All three change pyproject.toml.
If setup.cfg is still needed for flake8, delete it in the ruff issue instead.
Part of the repository modernization effort.
Background
setup.pyis the only source of package metadata. The version string0.32.0exists in four places:setup.py:17docs/conf.py—version = '0.32'andrelease = '0.32.0'.cz.yaml:5flake.nix:68pyproject.tomlholds only a[build-system]table.setup.cfgholds only theflake8line length.Warning: commitizen must keep working
.cz.yamldrives the release bump:version_filesdoes a literal replace of the version string. Ifsetup.pyis deleted, the entry must move to the new version source. Runcz bump --dry-runand confirm the result before you merge.Note the pre-existing gap: the short
version = '0.32'line indocs/conf.pydoes not match the full0.32.0string. commitizen does not bump it today.Warning: keep
README.rstREADME.rstis a symlink todocs/intro.rst.docs/intro.rstis a Sphinx source file in reStructuredText.Do not convert
README.rstto Markdown. The conversion breaks the Sphinx build.A PEP 621
readme = "README.rst"field reads whatever the path resolves to at build time. That is the symlink in a local build. That is the pandoc-built file in the publish workflow. The behavior matchessetup.pytoday..github/workflows/publish.ymlneeds no change for this issue.Proposed
pyproject.tomlWarning: where to put
__version__Add
__version__ = "0.32.0"as the first line ofbmemcached/__init__.py. Put it before thebmemcached.clientimport.setuptools reads the
attr:target from the module AST. It falls back to a real import when the AST read fails. A plain literal at the top avoids an import ofbmemcached.clientinside the isolated build environment. That import needsuhashringto be present already.Acceptance criteria
pyproject.tomlholds the[project]table above.bmemcached/__init__.pydeclares__version__ = "0.32.0"on the first line.setup.pyandsetup.cfgare deleted..cz.yamlversion_fileslistsbmemcached/__init__.pyanddocs/conf.py. It no longer listssetup.py.cz bump --dry-runfinds and replaces the version string.python -m build --sdist --wheel --outdir dist/ .succeeds.twine check dist/*passes.README.rstandCHANGELOG.md. CheckMANIFEST.in.AGENTS.md:10,18points atpyproject.toml. It no longer points atsetup.pyorsetup.cfg.flake.nix:68keeps a manual copy of the version.Files to change
pyproject.toml,bmemcached/__init__.py,setup.py(delete),setup.cfg(delete),.cz.yaml,AGENTS.md,MANIFEST.in(check only).Order
Do the minimum-version issue first. Do this issue before the ruff issue and the test-dependency issue. All three change
pyproject.toml.If
setup.cfgis still needed forflake8, delete it in the ruff issue instead.