Skip to content

Move project configuration to pyproject.toml - #157

Open
TOMASEZARATE wants to merge 1 commit into
pytest-dev:mainfrom
TOMASEZARATE:pyproject-config
Open

TOMASEZARATE wants to merge 1 commit into
pytest-dev:mainfrom
TOMASEZARATE:pyproject-config

Conversation

@TOMASEZARATE

@TOMASEZARATE TOMASEZARATE commented Nov 17, 2026 •

Copy link
Copy Markdown

Closes #126

The package metadata now lives in the [project] table in pyproject.toml, so setup.py and setup.cfg are removed. Supported Python versions are unchanged (requires-python is >=3.7).

The license uses the table form (license = {text = "MIT"}) and the build requirements stay compatible with Python 3.7, so the setuptools-scm config still uses write_to.

Two real metadata differences from setup.py:

  • readme = "README.rst" now emits Description-Content-Type: text/x-rst (setup.py set none)
  • tests_require is dropped (it had no effect)

Written with some help from AI. The commit has an Assisted-by trailer.

@diazona

diazona commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Hi Tomas, thanks for your contribution! I'm actually not sure if we can accept a PR made with AI assistance, though. Let me see if there are any relevant policies yo consider.

@TOMASEZARATE

Copy link
Copy Markdown
Author

Thanks for taking a look, and no problem, I'll wait to hear what you decide about the AI policy.

About the failing jobs, there are two separate things:

  • Python 3.9 fails before any tests run, because setup-python can't find 3.9 for ubuntu-26.04 ("The version '3.9' with architecture 'x64' was not found"). That isn't related to this PR; the latest run on main fails the same way.
  • Python 3.7/3.8 and PyPy 3.7/3.8 are on me. setuptools 77 needs Python >=3.9, so those environments end up with an older setuptools that doesn't accept the PEP 639 string form of project.license and the sdist build fails. I can switch the license back to a form older setuptools understands and drop the >=77 requirement, so the build works on every supported version. I'll push that if you'd like to move forward with the PR.

@RonnyPfannschmidt RonnyPfannschmidt left a comment

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.

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest-localserver maintainers; I prompted it, it did the work, I read it.

Thanks for picking up #126 and for disclosing the AI use. The mapping from setup.py into [project] is correct, and your read of the CI failures is right. Rather than falling back to the old license form, let's go forward: drop the old Pythons and modernise the setuptools-scm config in this PR.

1. Drop Python 3.7, 3.8 and 3.9 (requires-python = ">=3.10").
All three are EOL, setup-python no longer ships 3.9 for ubuntu-26.04 (that's the unrelated 3.9 failure, main fails the same way), current setuptools needs 3.10, and setuptools-scm 10.0.x needs 3.10. That means touching:

  • pyproject.toml: requires-python, remove the 3.7/3.8/3.9 classifiers, [tool.black] target-version = ['py310']
  • tox.ini: envlist py{310,311,312,313,314,315,py3}{,-smtp},lint, and drop the now-dead pytest >=4.6, <10; python_version <'3.10' line
  • .github/workflows/tests.yml: remove the 3.7/3.8/3.9 and pypy-3.7/3.8/3.9 matrix entries (that also removes the last ubuntu-22.04 pins and the pytest==4.6 min-deps runs)
  • .pre-commit-config.yaml: pyupgrade --py37-plus → --py310-plus

2. Keep the PEP 639 license as you have it. setuptools>=77 and license = "MIT" are right once 3.7–3.9 are gone. Please don't switch to license = {text = "MIT"}: it drops License-Expression from the published wheel and setuptools (84.2.1) deprecates the table form, with removal due 2027-02-18.

3. Update the setuptools-scm config.

  • setuptools_scm[toml] >=3.4.1 → setuptools-scm>=10. The toml extra is empty in current releases, and 10 is what the config below needs.
  • write_to → version_file. The current docs only document version_file; write_to is the legacy spelling.
  • Set write_to_source = true explicitly. Without it, setuptools-scm 10 emits a DeprecationWarning on every build, and its default flips in the next major to not writing into the source tree. pytest_localserver/__init__.py imports pytest_localserver._version, so editable installs and source checkouts would lose that file.
[build-system]
requires = ["setuptools>=77", "setuptools-scm>=10"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file = "pytest_localserver/_version.py"
write_to_source = true

4. Description and CHANGES.

  • The description says the metadata matches apart from formatting, but there are two real differences: readme = "README.rst" now emits Description-Content-Type: text/x-rst (setup.py set none), and tests_require is dropped (it had no effect). Please list both.
  • Please add a CHANGES entry, e.g. "Drop Python 3.7, 3.8 and 3.9 support" and "Move project metadata from setup.py to pyproject.toml".

Generated by Claude Code

@TOMASEZARATE

Copy link
Copy Markdown
Author

Thanks, I pushed the requested changes

@RonnyPfannschmidt RonnyPfannschmidt left a comment

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.

looks good to me, thanks
@diazona please take a look if you see anything amiss

Comment thread pyproject.toml Outdated
[tool.setuptools_scm]
write_to = "pytest_localserver/_version.py"
version_file = "pytest_localserver/_version.py"
write_to_source = true

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.

optional nitpick - we may not need write_to_source

Comment thread tox.ini Outdated
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39,310,311,312,313,314,315,py3}{,-smtp},lint
envlist = py{310,311,312,313,314,315,py3}{,-smtp},lint

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.

followup note - i am under the impression no need to do the smpt thing for all python versions, maybe this can be reduced

@diazona

diazona commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

I'll take a look at the PR as soon as I have a chance, but it might not be until tomorrow or Saturday since I'm having a particularly busy week at work. So if you don't hear from me before then, don't worry, I haven't forgotten.

@diazona

diazona commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Hey Tomas, thanks for your patience. I've been extremely busy the past couple weeks so I'm only getting around to this now.

First things first, I've proposed an LLM policy in #161 which would require an Assisted-by trailer in each commit that was generated with LLM assistance. Does that sound okay to you? (It'll require rewriting the commit messages and force-pushing the branch, but that's fine.)

The other thing is that our policy is to keep listing old Python versions as supported until we have a strong reason to get rid of them. I don't think using a modern way of expressing the license expression in pyproject.toml counts as a strong reason at this point. Could you please remove the bump of the setuptools version and the changes that drop support for Python 3.7-3.9? If you run into serious problems building the package on old Python versions or something like that, then we can reevaluate, but it still builds fine on the main branch so I think we should be able to make it work. (BTW I did merge a fix for the failures on Python 3.7-3.9 to main, so that's another reason for you to rebase, to pull in that fix.)

Closes pytest-dev#126

Assisted-by: Cursor Agent with Grok 4.7
@cursor
cursor Bot force-pushed the pyproject-config branch from 6ea1eb3 to d868cc6 Compare November 23, 2026 10:53
@TOMASEZARATE

Copy link
Copy Markdown
Author

Thanks @diazona, the policy in #161 sounds good to me. I added an Assisted-by trailer to the commit and force-pushed.

I also rebased onto main and reverted the changes that dropped Python 3.7-3.9: requires-python is back to >=3.7, the license uses the table form, and the setuptools-scm config stays with write_to, since version_file and write_to_source need setuptools-scm versions that don't run on 3.7. The build and tests pass on 3.8 and 3.12.

@RonnyPfannschmidt this undoes part of what you asked for in your review, so I wanted to let you know. Happy to adjust if you two settle on something different.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

My opinion is secondary in this repo

This branch has not been deployed

No deployments
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.

Consolidate project configuration in pyproject.toml

3 participants