Add base_python_file config option#3899
Merged
gaborbernat merged 12 commits intotox-dev:mainfrom Mar 27, 2026
Merged
Conversation
gaborbernat
requested changes
Mar 25, 2026
dc1c3a5 to
e987d7a
Compare
d77feae to
3193585
Compare
gaborbernat
reviewed
Mar 26, 2026
docs/reference/config.rst
Outdated
| .. conf:: | ||
| :keys: base_python_file | ||
| :default: <empty string> | ||
| :version_added: 4.x |
gaborbernat
requested changes
Mar 26, 2026
docs/reference/config.rst
Outdated
| .. code-block:: toml | ||
|
|
||
| [env.mypy] | ||
| base_python_file = ".python-version" |
Member
There was a problem hiding this comment.
base_python_file should be a list of file and pick first available, essentialy mirroring base_python
src/tox/session/cmd/schema.py
Outdated
| our.add_argument("--strict", action="store_true", help="Disallow extra properties in configuration") | ||
|
|
||
|
|
||
| def _ensure_package_conf(env: ToxEnv) -> None: |
Member
There was a problem hiding this comment.
methods shoulkd be defiend afgter they are used not before
src/tox/session/cmd/schema.py
Outdated
| The schema must include *all* possible configuration keys regardless of the current project settings. | ||
|
|
||
| """ | ||
| from tox.tox_env.python.runner import PythonRun # noqa: PLC0415 |
Member
There was a problem hiding this comment.
We should avoid local imports
Member
There was a problem hiding this comment.
I meant why do we need to do a local import and a patching private fields.
Collaborator
Author
There was a problem hiding this comment.
I see, I removed the method in the new iteration. lmk.
gaborbernat
reviewed
Mar 26, 2026
gaborbernat
approved these changes
Mar 27, 2026
gaborbernat
pushed a commit
to gaborbernat/tox
that referenced
this pull request
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
base_python_fileconfiguration option that reads the base Python version from a file (e.g..python-version), similar to GitHub Actions'python-version-file.Fixes #3894
tox -e fix)docs/changelogfolder