Skip to content

chore: tox toml#1033

Merged
gaborbernat merged 13 commits into
pypa:mainfrom
henryiii:henryiii/chore/toxtoml
Apr 27, 2026
Merged

chore: tox toml#1033
gaborbernat merged 13 commits into
pypa:mainfrom
henryiii:henryiii/chore/toxtoml

Conversation

@henryiii

@henryiii henryiii commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Description

This is an attempt to convert the tox.ini to tox.toml. I started
by pointing copilot at the tox documentation for configuration.
I then asked it to use a generative list, telling it it was okay to reverse
the order ...-min to min-....

Still need to:

  • Check the minimum tox version this requires (update: used last tox-uv that supported 3.9)
  • Consider putting it in pyproject.toml

🤖 I'm manually using Linux's Assisted-by trailer for comments. Used Copilot:claude-sonnet-4.6

Changelog

  • Added changelog fragment: docs/changelog/<pr_number>.<type>.rst
    • Types: feature, bugfix, doc, removal, misc
    • Example: 123.feature.rst containing Add custom backend support - by :user:`yourname`

Checklist

  • Tests pass locally (tox)
  • Code follows project style (tox -e fix)
  • Type checks pass (tox -e type)
  • Documentation builds (tox -e docs)

Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
@henryiii henryiii force-pushed the henryiii/chore/toxtoml branch from 22e0f50 to 81528c9 Compare April 13, 2026 17:45
flags: tests
env_vars: PYTHON
name: ${{ matrix.py }} - ${{ matrix.os }}
name: ${{ matrix.py }} - ${{ matrix.os }} - ${{ matrix.tox-target }}

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.

Unrelated change, but seems like this is needed, otherwise two jobs have the same name.

Comment thread tox.toml Outdated
TEST_STATUS_DIR = "{envtmpdir}"

[env_base.min]
factors = [["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.9", "pypy3.10", "pypy3.11"]]

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.

I don't think I can use range here.

Also, I don't like that we have to make this list so many times, it would be nice if I could reuse it somehow. But maybe it's easy enough to update with AI. ¯\_(ツ)_/¯

@abitrolly

Copy link
Copy Markdown
Contributor

@henryiii did tox get a decent CLI UX with the new config format recently? Like show the commands I can run without learning about tox.ini and stuff?

@gaborbernat

Copy link
Copy Markdown
Collaborator

tox l always did that 🤔

@henryiii

Copy link
Copy Markdown
Contributor Author

Yes, tox list (or I guess tox l, that's a bit closer in typing to nox -l, I guess!) is great.

@abitrolly

Copy link
Copy Markdown
Contributor

It takes sooo long. I couldn't wait.

# time tox l
ROOT: will run in automatically provisioned tox, host /usr/local/bin/python3.14 is missing [requires (has)]: tox-uv
ROOT: install_deps> python -I -m pip install tox tox-uv 'tox>=4.22' 'virtualenv>=20.0.34'
^C
real	0m8.066s
user	0m1.767s
sys	0m0.184s

It appears it can not just run itself to show help and needs to create virtualenv. Or no, the rabbit hole. I am not going to get down there. :D

subcommands:
  tox command to execute (by default legacy)

  {run,r,run-parallel,p,depends,de,man,list,l,devenv,d,schema,config,c,quickstart,q,exec,e,legacy,le}
    run (r)                   run environments
    run-parallel (p)          run environments in parallel

I made a fix to remove that argparse "feature" 10 years ago, but didn't post it anywhere.

@gaborbernat

Copy link
Copy Markdown
Collaborator

It appears it can not just run itself to show help and needs to create virtualenv.

Mean, you have an old outdated version of the tool that doesn't support the new features; so needs to install a newer version of itself following https://tox.wiki/en/4.53.0/explanation.html#auto-provisioning, the speed here will depend a lot on your network.

@abitrolly

Copy link
Copy Markdown
Contributor

@gaborbernat it was pip install tox in a clear Python container.

Downloading tox-4.53.0-py3-none-any.whl (212 kB)

But I can't repeat that anymore. I guess it was its local state in mounted dir that had to be updated.

Convert the INI-format tox configuration to the recommended TOML
format (tox.toml). The environment list and all behaviours are
preserved; tox list output is identical before and after.

Key translation notes:
- [tox] top-level keys → bare top-level keys
- [testenv] → [env_run_base]
- [testenv:name] → [env.name]
- set_env → TOML subtable / inline table; empty INI value → `{}`
- commands → list of lists; `{posargs:-n auto}` → replace/default inline table
- basepython → base_python, changedir → change_dir
- Generative section `[testenv:{py314,...}-min]` (INI-only feature) expanded
  into nine explicit `[env.XXX-min]` sections

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Replace nine identical `[env.XXX-min]` sections with a single
`[env_base.min]` template. The env_base factors mechanism generates
min-py314, min-py313, ... (prefix ordering is required by TOML's
env_base, which always prepends the template name).

env_list uses a product dict to keep the min variants concise.
coverage.depends is updated to the new names.

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/chore/toxtoml branch from 2dae265 to c161522 Compare April 24, 2026 19:55
pip 23.2 fails on Python 3.15 with:
  TypeError: Can't instantiate abstract class WheelDistribution
  without an implementation for abstract method 'locate_file'

WheelDistribution.locate_file() was added in pip 25.0 (January 2025).

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
pip 25.0/25.1 fail on Python 3.15 with:
  AttributeError: module 'typing' has no attribute 'no_type_check_decorator'

typing.no_type_check_decorator was removed in Python 3.15. pip's vendored
typing_extensions still referenced it until pip 25.3.

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the project’s tox configuration from tox.ini to tox.toml, updating CI, packaging, and docs to reference the new config file.

Changes:

  • Replace tox.ini with a new tox.toml tox configuration (including generated env lists and tox-uv integration).
  • Update CI workflows and release/docs references to use the new tox env naming and config file.
  • Adjust packaging/test fixtures to include tox.toml in sdists and update constraints for newer Python/pip.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tox.toml New tox TOML configuration replacing the removed tox.ini.
tox.ini Removed legacy tox INI configuration.
tests/test_self_packaging.py Updates sdist expectations to include tox.toml instead of tox.ini.
tests/constraints.txt Updates pip constraints for newer Python versions.
pyproject.toml Updates flit sdist include list to ship tox.toml.
docs/development/release.rst Updates documentation reference from tox.ini to tox.toml.
docs/development/contributing.rst Updates contributor docs with new tox invocation examples.
.pre-commit-config.yaml Removes tox-ini-fmt hook since tox.ini is removed.
.github/workflows/reusable-pytest.yml Adjusts tox env selection logic to match the new env naming scheme.
.github/workflows/reusable-change-detection.yml Updates change-detection filters to track tox.toml instead of tox.ini.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tox.toml
Comment thread docs/development/release.rst Outdated
Comment thread docs/development/contributing.rst
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii marked this pull request as ready for review April 25, 2026 03:19
@henryiii henryiii requested review from FFY00 and layday as code owners April 25, 2026 03:19
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/chore/toxtoml branch from c80d4a6 to a2fa274 Compare April 25, 2026 03:25
Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
Comment thread tox.toml Outdated
henryiii and others added 2 commits April 25, 2026 10:38
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii requested a review from gaborbernat April 27, 2026 13:35
@gaborbernat gaborbernat merged commit b445cd2 into pypa:main Apr 27, 2026
59 checks passed
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.

5 participants