Skip to content

chore: merge constraints.txt and setup.cfg into pyproject.toml to simplify setup - #798

Open
ThosRTanner wants to merge 1 commit into
python-zk:masterfrom
ThosRTanner:issue/786/rationalise_pins
Open

chore: merge constraints.txt and setup.cfg into pyproject.toml to simplify setup#798
ThosRTanner wants to merge 1 commit into
python-zk:masterfrom
ThosRTanner:issue/786/rationalise_pins

Conversation

@ThosRTanner

@ThosRTanner ThosRTanner commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #786

Why is this needed?

Currently constraints are specified in 3 places which makes it hard to track what you need to change. I'm not an out and out lover of pyproject.toml but having all module setup in one place makes it easier to control package version dependencies.

All that is left in setup.cfg is the tag_build = dev to tag dev builds as such, as I've been unable to find an obvious equivalent in pyproject.toml

Proposed Changes

  • Move constraints.txt and setup.cfg info into pyproject.toml. This also requires us to:
    • Update setuptools to a version that supports dependency groups
    • Update the pytest version for python3.8 to the latest version that still supports python3.8
    • Update the required version of tox
  • Differentiate between the project's optional dependencies and the internal tooling dependencies
  • Update tox.ini to use new dependency groups
  • Remove the top level Makefile which has not been maintained and refers to non existent requirements file
  • Move control of sphinx dependencies into docs/requirements.txt
    • also make tox -e docs actually generate the docs.

Does this PR introduce any breaking change?

The internal dependencies are no longer leaked from setup.cfg, and the top level Makefile has been removed. This shouldn't affect anyone, but one never knows...

Codecov report

This appears to be because it's two commits out of date. This change hasn't affected what code is covered during tests

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.41%. Comparing base (e894342) to head (c24cafe).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #798      +/-   ##
==========================================
- Coverage   96.65%   95.41%   -1.24%     
==========================================
  Files          27       27              
  Lines        3554     3858     +304     
==========================================
+ Hits         3435     3681     +246     
- Misses        119      177      +58     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ThosRTanner
ThosRTanner force-pushed the issue/786/rationalise_pins branch 2 times, most recently from 3a4595f to d542b29 Compare September 4, 2026 19:41
@ThosRTanner
ThosRTanner marked this pull request as ready for review September 4, 2026 19:57
@ThosRTanner
ThosRTanner force-pushed the issue/786/rationalise_pins branch 3 times, most recently from 15c17d4 to 21f0b93 Compare September 5, 2026 17:25
Consolidates setup.cfg and constraints.txt into pyproject.toml, and
additionally cleans up the list so that only the optional eventlet,
gevent and sasl dependencies are visible, the various dev ones are not.

Updated pytest to the latest supporting 3.8 or it can't cope with
the .toml file...

Removed Makefile which isn't used anywhere and references a bunch of
requirements*.txt files which don't exist.
@ThosRTanner
ThosRTanner force-pushed the issue/786/rationalise_pins branch from 21f0b93 to c24cafe Compare September 5, 2026 17:27
Comment thread .readthedocs.yaml
path: .
extra_requirements:
- docs
- requirements: docs/requirements.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be enough? Before it seems to do pip install . [docs], so kazoo + docs subgroup, now it seems to only install the docs libs, without kazoo? I think it might be missing the typing-extensions

Comment thread Makefile

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference should be removed from MANIFEST.in too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Done.

Comment thread pyproject.toml
"Topic :: System :: Distributed Computing",
"Topic :: System :: Networking",
]
dependencies = ["typing-extensions"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentionned it here #797 (comment), I think it needs to be pinned, probably >=4.5 because of deprecated but not 100% sure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like I have 4.13.2. I'll pin it to at least that.

Comment thread pyproject.toml
"pytest-timeout==2.4.0; python_version > '3.8'",
{include-group = "test-extras"},
]
mypy = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why it was not added as a project.optional-dependencies too ([typing])?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typing? or typing-extensions. You need typing-extensions because the some of the types defined in there are used in places where the interpreter can't skip over it, sadly. The whole of mypy is a dependency group so it's only installed if you're explicitly installing it - which is what tox does.

Comment thread pyproject.toml
zip-safe = false
include-package-data = true
packages = {find = {}}
license-files = ["LICENSE"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to put it in the [project] section instead? https://packaging.python.org/en/latest/specifications/pyproject-toml/#license-files

Comment thread pyproject.toml
]
dependencies = ["typing-extensions"]

[project.urls]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask for Homepage = "https://kazoo.readthedocs.io" to be added?

Comment thread tox.ini
black
dependency_groups = black
usedevelop = True
commands = black --check {posargs: {toxinidir}/kazoo {toxinidir}/kazoo}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we had 2 times the same arg here? weird

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that is definitely weird.

I removed the 2nd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move to using pyproject.toml and requirements.txt rather than setup.cfg+pyproject.toml+constraints.txt

2 participants