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

Use TOML syntax for tox configuration #180

Open
8 of 23 tasks
Tracked by #157 ...
redeboer opened this issue Sep 28, 2023 · 3 comments · Fixed by #475 or ComPWA/strong2020-salamanca#45 · May be fixed by ComPWA/ampform#447, ComPWA/ampform-dpd#149 or ComPWA/benchmarks#27
Open
8 of 23 tasks
Tracked by #157 ...

Use TOML syntax for tox configuration #180

redeboer opened this issue Sep 28, 2023 · 3 comments · Fixed by #475 or ComPWA/strong2020-salamanca#45 · May be fixed by ComPWA/ampform#447, ComPWA/ampform-dpd#149 or ComPWA/benchmarks#27
Assignees
Labels
🖱️ DX Improvements to the Developer Experience ✨ Feature New feature added to the package
Milestone

Comments

@redeboer
Copy link
Member

redeboer commented Sep 28, 2023

Possible since Tox v4.21.0, see https://tox.wiki/en/4.21.0/config.html#pyproject-toml-native. Example:

[tool.tox]
requires = ["tox>=4.19"]
env_list = ["3.13", "3.12", "type"]

[tool.tox.env_run_base]
description = "Run test under {base_python}"
commands = [["pytest"]]

[tool.tox.env.type]
description = "run type check on code base"
deps = ["mypy==1.11.2", "types-cachetools>=5.5.0.20240820", "types-chardet>=5.0.4.6"]
commands = [["mypy", "src{/}tox"], ["mypy", "tests"]]

Tasks

Preview Give feedback
  1. 5 of 18
    🔨 Maintenance 🖱️ DX
    redeboer

Related PRs

Preview Give feedback
  1. 🔨 Maintenance
    redeboer
  2. 🔨 Maintenance
    redeboer
  3. 🔨 Maintenance
    redeboer
  4. 🔨 Maintenance
    redeboer
  5. 🔨 Maintenance
    redeboer
  6. 🔨 Maintenance
    redeboer
  7. 🔨 Maintenance
    redeboer
  8. 🔨 Maintenance
    redeboer
  9. 🔨 Maintenance
    redeboer
  10. 🔨 Maintenance
    redeboer
  11. 🔨 Maintenance
    redeboer
  12. 🔨 Maintenance 🖱️ DX
    redeboer
  13. 🔨 Maintenance
    redeboer
  14. 🔨 Maintenance
    redeboer
@redeboer redeboer added 🖱️ DX Improvements to the Developer Experience ✨ Feature New feature added to the package labels Sep 28, 2023
@redeboer redeboer self-assigned this Sep 28, 2023
@redeboer
Copy link
Member Author

redeboer commented Oct 5, 2023

Closing this for now until tox configs supports native TOML syntax.

@redeboer
Copy link
Member Author

redeboer commented Oct 2, 2024

Since tox v4.21.0, it should be possible to merge the job definitions under tox.ini into pyproject.toml 🎉

@redeboer
Copy link
Member Author

redeboer commented Oct 4, 2024

The commands key in the native pyproject.toml configuration uses nested arrays. Since we set Taplo to sort arrays, we would have to use Rules to prevent the commands key from being sorted. In .taplo.toml:

[[rule]]
include = ["**/pyproject.toml"]
keys = ["tool.tox"]

[rule.formatting]
reorder_arrays = false

Rules are a new feature in Taplo v0.9 though, which is not yet available in VS Code, see tamasfe/taplo#624. So long as that is not the case, we get situations where a configuration like

[tool.tox.env.example]
commands = [
    ["pytest", "--no-header"],
]

is autoformatted as

[tool.tox.env.example]
commands = [
    ["--no-header", "pytest"],
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment