Skip to content

Commit 4ac4eb3

Browse files
committed
DEV: add default environments for tasks
closes gh-698
1 parent c8bf3cd commit 4ac4eb3

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

pixi.toml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@ zizmor = ">=1.24.1,<1.25"
7676
# as they slow down mypy and are not portable across target OSs
7777

7878
[feature.lint.tasks]
79-
lefthook = { cmd = "lefthook", description = "Run lefthook" }
80-
hooks = { cmd = "lefthook install", description = "Install pre-commit hooks" }
81-
pre-commit = { cmd = "lefthook run pre-commit", description = "Run pre-commit checks" }
82-
pylint = { cmd = "pylint array_api_extra", cwd = "src", description = "Lint with pylint" }
83-
mypy = { cmd = "mypy", description = "Type check with mypy" }
84-
pyrefly = { cmd = "pyrefly check", description = "Type check with pyrefly" }
85-
pyright = { cmd = "basedpyright", description = "Type check with basedpyright" }
86-
ruff-check = { cmd = "ruff check --fix", description = "Lint with ruff" }
87-
ruff-format = { cmd = "ruff format", description = "Format with ruff" }
88-
dprint = { cmd = "dprint fmt", description = "Format with dprint" }
89-
typos = { cmd = "typos --write-changes --force-exclude", description = "Fix typos" }
90-
actionlint = { cmd = "actionlint", description = "Lint actions with actionlint" }
91-
zizmor = { cmd = "zizmor .github -p", description = "GHA static analysis with zizmor" }
92-
blacken-docs = { cmd = "blacken-docs", description = "Format Python markdown blocks with Black" }
93-
validate-pyproject = { cmd = "validate-pyproject pyproject.toml", description = "Validate pyproject.toml" }
94-
numpydoc = { cmd = "numpydoc lint", description = "Validate docstrings with numpydoc" }
95-
lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run all linters" }
79+
lefthook = { cmd = "lefthook", description = "Run lefthook", default-environment = "lint" }
80+
hooks = { cmd = "lefthook install", description = "Install pre-commit hooks", default-environment = "lint" }
81+
pre-commit = { cmd = "lefthook run pre-commit", description = "Run pre-commit checks", default-environment = "lint" }
82+
pylint = { cmd = "pylint array_api_extra", cwd = "src", description = "Lint with pylint", default-environment = "lint" }
83+
mypy = { cmd = "mypy", description = "Type check with mypy", default-environment = "lint" }
84+
pyrefly = { cmd = "pyrefly check", description = "Type check with pyrefly", default-environment = "lint" }
85+
pyright = { cmd = "basedpyright", description = "Type check with basedpyright", default-environment = "lint" }
86+
ruff-check = { cmd = "ruff check --fix", description = "Lint with ruff", default-environment = "lint" }
87+
ruff-format = { cmd = "ruff format", description = "Format with ruff", default-environment = "lint" }
88+
dprint = { cmd = "dprint fmt", description = "Format with dprint", default-environment = "lint" }
89+
typos = { cmd = "typos --write-changes --force-exclude", description = "Fix typos", default-environment = "lint" }
90+
actionlint = { cmd = "actionlint", description = "Lint actions with actionlint", default-environment = "lint" }
91+
zizmor = { cmd = "zizmor .github -p", description = "GHA static analysis with zizmor", default-environment = "lint" }
92+
blacken-docs = { cmd = "blacken-docs", description = "Format Python markdown blocks with Black", default-environment = "lint" }
93+
validate-pyproject = { cmd = "validate-pyproject pyproject.toml", description = "Validate pyproject.toml", default-environment = "lint" }
94+
numpydoc = { cmd = "numpydoc lint", description = "Validate docstrings with numpydoc", default-environment = "lint" }
95+
lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run all linters", default-environment = "lint" }
9696

9797
[feature.tests.dependencies]
9898
pytest = ">=9.0.3"
@@ -103,18 +103,18 @@ numpy = ">=1.22.0"
103103
scipy = ">=1.15.2,<2"
104104

105105
[feature.tests.tasks]
106-
tests = { cmd = "pytest -v", description = "Run tests" }
107-
tests-cov = { cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20", description = "Run tests with coverage" }
106+
tests = { cmd = "pytest -v", description = "Run tests", default-environment = "tests" }
107+
tests-cov = { cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20", description = "Run tests with coverage", default-environment = "tests" }
108108

109-
clean-vendor-compat = { cmd = "rm -rf vendor_tests/array_api_compat", description = "Delete the existing vendored version of array-api-compat" }
110-
clean-vendor-extra = { cmd = "rm -rf vendor_tests/array_api_extra", description = "Delete the existing vendored version of array-api-extra" }
111-
copy-vendor-compat = { cmd = "cp -r $(python -c 'import site; print(site.getsitepackages()[0])')/array_api_compat vendor_tests/", depends-on = ["clean-vendor-compat"], description = "Vendor a clean copy of array-api-compat" }
112-
copy-vendor-extra = { cmd = "cp -r src/array_api_extra vendor_tests/", depends-on = ["clean-vendor-extra"], description = "Vendor a clean copy of array-api-extra" }
113-
tests-vendor = { cmd = "pytest -v vendor_tests", depends-on = ["copy-vendor-compat", "copy-vendor-extra"], description = "Check that array-api-extra and array-api-compat can be vendored together" }
109+
clean-vendor-compat = { cmd = "rm -rf vendor_tests/array_api_compat", description = "Delete the existing vendored version of array-api-compat", default-environment = "tests" }
110+
clean-vendor-extra = { cmd = "rm -rf vendor_tests/array_api_extra", description = "Delete the existing vendored version of array-api-extra", default-environment = "tests" }
111+
copy-vendor-compat = { cmd = "cp -r $(python -c 'import site; print(site.getsitepackages()[0])')/array_api_compat vendor_tests/", depends-on = ["clean-vendor-compat"], description = "Vendor a clean copy of array-api-compat", default-environment = "tests" }
112+
copy-vendor-extra = { cmd = "cp -r src/array_api_extra vendor_tests/", depends-on = ["clean-vendor-extra"], description = "Vendor a clean copy of array-api-extra", default-environment = "tests" }
113+
tests-vendor = { cmd = "pytest -v vendor_tests", depends-on = ["copy-vendor-compat", "copy-vendor-extra"], description = "Check that array-api-extra and array-api-compat can be vendored together", default-environment = "tests" }
114114

115115
tests-ci = { depends-on = ["tests-cov", "tests-vendor"], description = "Run tests with coverage and vendor tests" }
116-
coverage = { cmd = "coverage html", depends-on = ["tests-cov"], description = "Generate test coverage html report" }
117-
open-coverage = { cmd = "open htmlcov/index.html", depends-on = ["coverage"], description = "Open test coverage report" }
116+
coverage = { cmd = "coverage html", depends-on = ["tests-cov"], description = "Generate test coverage html report", default-environment = "tests" }
117+
open-coverage = { cmd = "open htmlcov/index.html", depends-on = ["coverage"], description = "Open test coverage report", default-environment = "tests" }
118118

119119
[feature.docs.dependencies]
120120
sphinx = ">=7.4.7"
@@ -129,14 +129,14 @@ typing-extensions = ">=4.15.0"
129129
numpy = ">=2.1.3"
130130

131131
[feature.docs.tasks]
132-
docs = { cmd = "sphinx-build -E -W . build/", cwd = "docs", description = "Build docs" }
133-
open-docs = { cmd = "open build/index.html", cwd = "docs", depends-on = ["docs"], description = "Open the generated docs" }
132+
docs = { cmd = "sphinx-build -E -W . build/", cwd = "docs", description = "Build docs", default-environment = "docs" }
133+
open-docs = { cmd = "open build/index.html", cwd = "docs", depends-on = ["docs"], description = "Open the generated docs", default-environment = "docs" }
134134

135135
[feature.dev.dependencies]
136136
ipython = ">=7.33.0"
137137

138138
[feature.dev.tasks]
139-
ipython = { cmd = "ipython", description = "Launch ipython" }
139+
ipython = { cmd = "ipython", description = "Launch ipython", default-environment = "dev" }
140140

141141
[feature.py311.dependencies]
142142
python = "~=3.11.0"

0 commit comments

Comments
 (0)