Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

True TOML config support #3353

Merged
merged 3 commits into from
Oct 1, 2024
Merged

True TOML config support #3353

merged 3 commits into from
Oct 1, 2024

Conversation

gaborbernat
Copy link
Member

@gaborbernat gaborbernat commented Sep 27, 2024

Done:

  • pyproject.toml source
  • tox.toml source
  • toml loader with type validations
  • variable substitution that makes sense for TOML files
  • reference mechanism that makes sense for TOML files
  • documentation.

https://tox--3353.org.readthedocs.build/en/3353/config.html#tox-toml

Resolves #999.

Signed-off-by: Bernát Gábor <[email protected]>
@gaborbernat gaborbernat force-pushed the toml branch 6 times, most recently from 9b75bf8 to e3bf846 Compare September 30, 2024 23:14
@gaborbernat gaborbernat force-pushed the toml branch 3 times, most recently from 57c4e5c to 43d8113 Compare October 1, 2024 01:59
@gaborbernat gaborbernat marked this pull request as ready for review October 1, 2024 01:59
@gaborbernat
Copy link
Member Author

@ssbarnea @ziima this is now ready for first release, give it a go if you can.

Signed-off-by: Bernát Gábor <[email protected]>
@gaborbernat gaborbernat merged commit cea105b into tox-dev:main Oct 1, 2024
28 checks passed
@gaborbernat gaborbernat deleted the toml branch October 1, 2024 03:38
paddyroddy added a commit to paddyroddy/python-template that referenced this pull request Oct 1, 2024
Following tox-dev/tox#3353 there is now full
native TOML support for `tox`
paddyroddy added a commit to astro-informatics/sleplet that referenced this pull request Oct 1, 2024
install tox into an isolated environment. This has the added benefit that later you'll be able to upgrade tox without
affecting other parts of the system.
:pypi:`tox` is a CLI tool that needs a Python interpreter (version 3.7 or higher) to run. We recommend either
:pypi:`pipx` or :pypi:`ruff` to install tox into an isolated environment. This has the added benefit that later you'll
Copy link

Choose a reason for hiding this comment

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

is this a typo? should it be uv and not ruff?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes!


.. code-block:: bash

tox --override env_run_base.deps+=pytest-xdist
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it odd that overrides depend on the config file format. I'd expect the options to behave the same way regardless of the config file format.

At least it should be noted that default of base option is format-dependent above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Achieving this goal would require that the syntax for the new file format to be very ugly. testenv:whatever Is very much something we inherited in the INI world. Furthermore, this is already the case when using setup.CFG over tox.ini.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you read the configuration file format introduction section, it clearly calls out the differences.

Historically, the INI format was created first, and TOML was added in 2024. The TOML format generally is more robust,
however is less powerful and more verbose. You should use TOML unless you need some of the more advanced features
that TOML does not support (such as conditional factors, generative environments to name a few -- however, PRs to
add support for these in TOML is welcome).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd mark TOML config as experimental until all these are supported. Supporting those may affect the TOML file structure.

Copy link
Member Author

Choose a reason for hiding this comment

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

I disagree. Some of these features I explicitly do not want to support in the new format (such as conditional factors). The TOML file Format is just not a good match for it.

``tox.toml``
~~~~~~~~~~~~

This configuration file is equivalent to :ref:`pyproject.toml - native <pyproject-toml-native>` with the difference
Copy link
Contributor

Choose a reason for hiding this comment

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

I very appreciate the option to have a separate TOML file 👍

docs/user_guide.rst Show resolved Hide resolved
docs/user_guide.rst Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

native pyproject.toml config
3 participants