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.
  • Prune MANIFEST.in as a lot of it has no effect

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.38%. Comparing base (e894342) to head (883dbfc).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #798      +/-   ##
==========================================
- Coverage   96.65%   95.38%   -1.27%     
==========================================
  Files          27       27              
  Lines        3554     3858     +304     
==========================================
+ Hits         3435     3680     +245     
- Misses        119      178      +59     

☔ 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 4 times, most recently 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

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.

Um, yes, not it wasn't. I went and destroyed my tox environment and rebuilt it and found a couple of dependencies missing.

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.

Thanks, is the change OK now? I don't see anything new but I might be missing something.

@ThosRTanner ThosRTanner Sep 13, 2026

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.

yes, it's fine now. it (tox) creates a new environment and installs the necessary dependencies in there from docs/requirements.txt

Comment thread Makefile Outdated
Comment thread pyproject.toml Outdated
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.

@StephenSorriaux StephenSorriaux Sep 13, 2026

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.

Yes, typing. It was in options.extras_require in setup.cfg and included all deps linked to typing. My understanding was that an user could pip install kazoo[typing] to install it if they wanted to. Now, it does not seem possible anymore? Is it what we want?

@ThosRTanner ThosRTanner Sep 13, 2026

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, ok. I hadn't realised that.

However, doing what is suggested in the literature doesn't work for python3.8 and mypy fails completely.

I've added a dependency group typing and for python3.9+ (well, the first pip that was released after python3.8 support was dropped) you can use pip install --group typing. Would that be a reasonable approach?

Comment thread pyproject.toml
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?

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.

The same url as the "Documentation" page? Or replace the documentation page?

I've assumed the first but let me know if you want it changed.

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.

Yes, the same.

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.

Done then

Comment thread tox.ini Outdated
@ThosRTanner
ThosRTanner force-pushed the issue/786/rationalise_pins branch 3 times, most recently from 107a9f4 to ce144f3 Compare September 13, 2026 08:21
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 ce144f3 to 883dbfc Compare September 13, 2026 08:39
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