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

ENH: merge tox.ini into pyproject.toml #401

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
".gitpod.*",
".pre-commit-config.yaml",
".prettierignore",
".taplo.toml",
".vscode/*",
"codecov.yml",
"docs/_templates/*",
Expand Down
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ compact_inline_tables = true
indent_string = " "
reorder_arrays = true
reorder_keys = true

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

[rule.formatting]
reorder_arrays = false
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"ms-python.vscode-pylance",
"ms-vscode.live-server",
"ms-vsliveshare.vsliveshare",
"panekj.even-betterer-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"soulcode.vscode-unwanted-extensions",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"yzhang.markdown-all-in-one"
],
"unwantedRecommendations": [
Expand All @@ -30,6 +30,7 @@
"ms-python.flake8",
"ms-python.isort",
"ms-python.pylint",
"tamasfe.even-better-toml",
"travisillig.vscode-json-stable-stringify",
"tyriar.sort-lines"
]
Expand Down
117 changes: 117 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,120 @@ sort_first = [
]
spaces_indent_inline_array = 4
trailing_comma_inline_array = true

[tool.tox]
env_list = [
"doc",
"py",
"sty",
]
requires = ["tox>=4.19"]
skip_install = true
skip_missing_interpreters = true
skipsdist = true

[tool.tox.env.cov]
allowlist_externals = ["pytest"]
commands = [
[
"pytest",
"--cov-fail-under=35",
"--cov-report=html",
"--cov-report=xml",
"--cov=compwa_policy",
"{posargs}",
],
]
description = "Compute test coverage"

[tool.tox.env.doc]
allowlist_externals = ["sphinx-build"]
commands = [
[
"sphinx-build",
"docs/",
"docs/_build/html",
"--builder=html",
"--fail-on-warning",
"--keep-going",
"--show-traceback",
],
]
description = "Build documentation and API through Sphinx"
setenv = [
{"FORCE_COLOR" = "yes"},
]

[tool.tox.env.doclive]
allowlist_externals = ["sphinx-autobuild"]
commands = [
[
"sphinx-autobuild",
"docs/",
"docs/_build/html",
"--open-browser",
"--re-ignore=.*/__pycache__/.*",
"--re-ignore=.*\\.egg-info",
"--re-ignore=docs/_build/.*",
"--re-ignore=docs/api/.*",
"--watch=docs",
"--watch=src",
],
]
description = "Set up a server to directly preview changes to the HTML pages"
setenv = [
{"FORCE_COLOR" = "yes"},
]

[tool.tox.env.linkcheck]
allowlist_externals = [
"sphinx-build",
]
commands = [
[
"sphinx-build",
"docs/",
"docs/_build/linkcheck",
"--builder=linkcheck",
"--show-traceback",
],
]
description = "Check external links in the documentation (requires internet connection)"
setenv = [
{"FORCE_COLOR" = "yes"},
]

[tool.tox.env.pydeps]
allowlist_externals = ["pydeps"]
changedir = "src"
commands = [
[
"pydeps",
"compwa_policy",
"--exclude=*._*",
"--max-bacon=1",
"--noshow",
"-o=module_structure.svg",
],
]
description = "Visualize module dependencies"

[tool.tox.env.sty]
allowlist_externals = [
"pre-commit",
]
commands = [
["pre-commit", "run", "--all-files", "{posargs}"],
]
description = "Perform all linting, formatting, and spelling checks"
setenv = [
{"SKIP" = "pyright"},
]

[tool.tox.env_run_base]
allowlist_externals = ["pytest"]
commands = [
["pytest", "{posargs}"],
]
description = "Run all unit tests"
passenv = ["*"]
2 changes: 1 addition & 1 deletion src/compwa_policy/.template/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
".pre-commit-config.yaml",
".prettierignore",
".readthedocs.yml",
".taplo.toml",
".vscode/*",
".vscode/.gitignore",
"CITATION.cff",
"codecov.yml",
"Dockerfile",
Expand Down
7 changes: 7 additions & 0 deletions src/compwa_policy/.template/.taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ compact_inline_tables = true
indent_string = " "
reorder_arrays = true
reorder_keys = true

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

[rule.formatting]
reorder_arrays = false
9 changes: 7 additions & 2 deletions src/compwa_policy/check_dev_files/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ def _update_precommit_repo(precommit: ModifiablePrecommit) -> None:


def _update_vscode_extensions() -> None:
# cspell:ignore bungcip tamasfe
# cspell:ignore betterer bungcip panekj tamasfe
with Executor() as do:
do(vscode.add_extension_recommendation, "tamasfe.even-better-toml")
do(vscode.add_extension_recommendation, "panekj.even-betterer-toml")
do(
vscode.remove_extension_recommendation,
"tamasfe.even-better-toml",
unwanted=True,
)
do(vscode.remove_extension_recommendation, "bungcip.better-toml", unwanted=True)


Expand Down
Loading