Repository navigation
✨ feat(config): add --format json/toml and -o to config command - #3857
Merged
Merged
Conversation
gaborbernat
force-pushed
the
3854
branch
4 times, most recently
from
March 5, 2026 18:58
eb33dbb to
6416af6
Compare
There was no reliable programmatic way to retrieve tox environment configuration. The existing `tox config` output is colored INI text that's difficult for tools, scripts, and CI pipelines to consume. The config command now accepts --format (ini/json/toml) and -o/--output-file flags. JSON and TOML output preserves native types and uses the same key structure as tox.toml (env.<name> for environments, tox for core settings). Both structured formats get syntax highlighting on stdout; file output via -o is always clean. Splits show_config into a package with per-format modules. Adds tomli-w as a dependency for TOML serialization. Also adds uv_seed to env_run_base in tox.toml to fix provision test failures, and normalizes version-specific pragma comments to covdefaults format (>=3.11 cover / <3.11 cover). Closes tox-dev#3854
rares985
added a commit
to rares985/tox
that referenced
this pull request
Mar 6, 2026
…fig (tox-dev#3866) The refactoring in tox-dev#3857 added config_format and output_file options to the config command, but the legacy --showconfig flag handler didn't initialize these new attributes before calling show_config(), causing an AttributeError. This fix initializes both attributes with their default values (ini format and no output file) when using the legacy --showconfig or --help-ini flags, maintaining backward compatibility. Fixes tox-dev#3866
rares985
added a commit
to rares985/tox
that referenced
this pull request
Mar 6, 2026
…fig (tox-dev#3866) The refactoring in tox-dev#3857 added config_format and output_file options to the config command, but the legacy --showconfig flag handler didn't initialize these new attributes before calling show_config(), causing an AttributeError. This fix initializes both attributes with their default values (ini format and no output file) when using the legacy --showconfig or --help-ini flags, maintaining backward compatibility. Fixes tox-dev#3866
rares985
added a commit
to rares985/tox
that referenced
this pull request
Mar 6, 2026
The refactoring in tox-dev#3857 added config_format and output_file options to the config command, but the legacy --showconfig flag handler didn't initialize these new attributes before calling show_config(), causing an AttributeError. This fix initializes both attributes with their default values (ini format and no output file) when using the legacy --showconfig or --help-ini flags, maintaining backward compatibility.
This was referenced Aug 13, 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.
There is currently no reliable programmatic way to retrieve tox environment configuration. The
tox configcommand outputs colored INI-style text that's difficult for tools, scripts, and CI pipelines to consume. This forces users to resort to fragile regex parsing or screen-scraping to extract configuration values. Closes #3854The
configcommand now accepts--format(ini,json,toml) and-o/--output-fileflags. ✨ JSON and TOML output preserves native types (booleans, integers, floats, arrays, dicts) and uses the same key structure astox.toml—env.<name>for environments,toxfor core settings — so the output schema feels familiar to anyone already writing tox configuration in TOML. Both structured formats get syntax highlighting on stdout matching the existing INI color behavior, while file output via-ois always clean for machine consumption. A newjsonify()function insrc/tox/config/loader/jsonify.pyhandles the type conversion, parallel to the existingstringify().📝 Documentation across all three Diataxis dimensions (tutorial, how-to, explanation) has been updated with tabbed examples showing INI, JSON, and TOML output side by side. The
tomli-wpackage is added as a dependency for TOML serialization. All existing-k,--core, and-eflags compose naturally with the new format options.