Skip to content

Commit

Permalink
MAINT: update lock files (#149)
Browse files Browse the repository at this point in the history
* DX: convert Tox config to native TOML
* DX: increase minimal test coverage to 58%
* FIX: correctly set `EXECUTE_NB`
* FIX: downgrade `pygments` and `sphinx-codeautolink`
* FIX: set `sphinx.configuration`
* MAINT: clean up Codecov configuration

Co-authored-by: GitHub <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and web-flow authored Jan 13, 2025
1 parent 182d69b commit 7c2db34
Show file tree
Hide file tree
Showing 8 changed files with 838 additions and 717 deletions.
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
".pre-commit-config.yaml",
".prettierignore",
".readthedocs.yml",
".taplo.toml",
".vscode/*",
".vscode/.gitignore",
"codecov.yml",
"docs/conf.py",
"pyproject.toml"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
coverage-target: ampform_dpd
macos-python-version: "3.9"
specific-pip-packages: ${{ inputs.specific-pip-packages }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
style:
if: inputs.specific-pip-packages == ''
secrets:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.5.8
rev: 0.5.15
hooks:
- id: check-dev-files
args:
Expand Down Expand Up @@ -53,7 +53,7 @@ repos:
metadata.vscode
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.9.1
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -125,6 +125,6 @@ repos:
- id: pyright

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.11
rev: 0.5.18
hooks:
- id: uv-lock
4 changes: 3 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ build:
export UV_LINK_MODE=copy
uv run \
--group doc \
--locked \
--no-dev \
--with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
sphinx:
configuration: docs/conf.py
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,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
16 changes: 3 additions & 13 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,22 @@ coverage:
status:
project:
default:
# basic
target: 50% # can't go below this percentage
threshold: 1% # allow drops by this percentage
target: 58%
threshold: 1%
base: auto
# advanced
branches: []
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false
flags: []
paths: []
patch:
default:
# basic
target: 0
threshold: 5%
threshold: 0%
base: auto
# advanced
branches: null
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false
flags: null
paths: null
changes: false

parsers:
Expand Down
236 changes: 123 additions & 113 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -351,123 +351,133 @@ sort_first = [
"project",
"tool.setuptools",
"tool.setuptools_scm",
"tool.tox.env_run_base",
]
spaces_indent_inline_array = 4
trailing_comma_inline_array = true

[tool.tox]
legacy_tox_ini = """
[tox]
envlist =
cov,
docnb-force,
linkcheck,
sty,
skip_install = True
skip_missing_interpreters = True
skipsdist = True
[testenv]
allowlist_externals =
pytest
commands =
pytest {posargs}
description = Run all unit tests
passenv = *
[testenv:cov]
allowlist_externals =
pytest
commands =
pytest {posargs:src tests} \
--cov-fail-under=50 \
--cov-report=html \
--cov-report=xml \
--cov=ampform_dpd
description = Compute test coverage
[testenv:doc]
allowlist_externals =
sphinx-build
commands =
sphinx-build \
--builder=html \
--fail-on-warning \
--keep-going \
docs/ docs/_build/html
description = Build documentation with Sphinx
[testenv:docnb]
base = doc
description = {[testenv:doc]description} with cached notebook execution
setenv =
{[testenv:doc]setenv}
EXECUTE_NB = yes
[testenv:docnb-force]
base = doc
description = {[testenv:doc]description} with notebook execution (no cache)
setenv =
{[testenv:doc]setenv}
FORCE_EXECUTE_NB = yes
[testenv:doclive]
allowlist_externals =
sphinx-autobuild
commands =
sphinx-autobuild \
--ignore=docs/_build/ \
--ignore=docs/_images/ \
--ignore=docs/api/ \
--ignore=docs/export/ \
--open-browser \
--port=0 \
--re-ignore='.*/__pycache__/.*' \
--re-ignore='.*/.ipynb_checkpoints/.*' \
--re-ignore='.*/.virtual_documents/.*' \
--re-ignore='.*\\.pdf' \
--re-ignore='.*\\.pkl' \
--re-ignore='.*\\.png' \
--re-ignore='.*\\.svg' \
--re-ignore='.*\\.tmp' \
--watch=docs \
--watch=src \
docs/ docs/_build/html
description = Set up a server to directly preview changes to the HTML pages
[testenv:docnblive]
base = doclive
description = {[testenv:doclive]description} with cached notebook execution
setenv =
{[testenv:doclive]setenv}
EXECUTE_NB = yes
[testenv:linkcheck]
allowlist_externals =
sphinx-build
commands =
sphinx-build \
--builder=linkcheck \
--show-traceback \
docs/ docs/_build/linkcheck
description = Check external links in the documentation (requires internet connection)
setenv =
PYTHONWARNINGS =
[testenv:nb]
allowlist_externals =
pytest
commands =
pytest --nbmake --nbmake-timeout=3600 {posargs:docs}
description = Run all notebooks with pytest
[testenv:sty]
allowlist_externals =
pre-commit
commands =
pre-commit run --all-files {posargs}
description = Perform all linting, formatting, and spelling checks
"""
env_list = [
"cov",
"docnb-force",
"linkcheck",
"sty",
]
no_package = true
requires = ["tox>=4.21.0"]
skip_install = true
skip_missing_interpreters = true

[tool.tox.env_run_base]
allowlist_externals = ["pytest"]
commands = [["pytest", {replace = "posargs", extend = true}]]
description = "Run all unit tests"
pass_env = ["*"]

[tool.tox.env.cov]
allowlist_externals = ["pytest"]
commands = [
[
"pytest",
{replace = "posargs", extend = true},
"--cov-fail-under=58",
"--cov-report=html",
"--cov-report=xml",
"--cov=ampform_dpd",
],
]
description = "Compute test coverage"

[tool.tox.env.doc]
allowlist_externals = ["sphinx-build"]
commands = [
[
"sphinx-build",
"--builder=html",
"--fail-on-warning",
"--keep-going",
"docs/",
"docs/_build/html",
],
]
description = "Build documentation with Sphinx"

[tool.tox.env.doclive]
allowlist_externals = ["sphinx-autobuild"]
commands = [
[
"sphinx-autobuild",
"--ignore=docs/_build/",
"--ignore=docs/_images/",
"--ignore=docs/api/",
"--ignore=docs/export/",
"--open-browser",
"--port=0",
"--re-ignore='.*/__pycache__/.*'",
"--re-ignore='.*/.ipynb_checkpoints/.*'",
"--re-ignore='.*/.virtual_documents/.*'",
"--re-ignore='.*\\.pdf'",
"--re-ignore='.*\\.pkl'",
"--re-ignore='.*\\.png'",
"--re-ignore='.*\\.svg'",
"--re-ignore='.*\\.tmp'",
"--watch=docs",
"--watch=src",
"docs/",
"docs/_build/html",
],
]
description = "Set up a server to directly preview changes to the HTML pages"

[tool.tox.env.docnb]
base = ["tool.tox.env.doc", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doc]description} with cached notebook execution"
set_env.EXECUTE_NB = "yes"

[tool.tox.env.docnb-force]
base = ["tool.tox.env.doc", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doc]description} with notebook execution (no cache)"
set_env.FORCE_EXECUTE_NB = "yes"

[tool.tox.env.docnblive]
base = ["tool.tox.env.doclive", "tool.tox.env_run_base"]
description = "{[tool.tox.env.doclive]description} with cached notebook execution"
set_env.EXECUTE_NB = "yes"

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

[tool.tox.env.nb]
allowlist_externals = ["pytest"]
commands = [
[
"pytest",
"--nbmake",
"--nbmake-timeout=0",
"{posargs:docs}",
],
]
description = "Run all notebooks with pytest"

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

[tool.uv]
constraint-dependencies = ["numpy~=1.0"]
constraint-dependencies = [
"numpy~=1.0",
"pygments!=2.19.*", # https://github.com/felix-hilden/sphinx-codeautolink/issues/152
"sphinx-codeautolink!=0.16.0",
]
Loading

0 comments on commit 7c2db34

Please sign in to comment.