Skip to content

Commit

Permalink
ci(DRAFT): migrate hatch scripts to hybrid tasks.py runner
Browse files Browse the repository at this point in the history
Provides 2 interfaces:
- `tasks.py`: to define using decorators
- `tasks.toml`: an example of defining in a similar way to `hatch` scripts

#3577 (comment)
  • Loading branch information
dangotbanned committed Dec 29, 2024
1 parent ddc8358 commit 6ebc0ee
Show file tree
Hide file tree
Showing 5 changed files with 695 additions and 3 deletions.
54 changes: 54 additions & 0 deletions tasks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[tool.altair.tasks]
lint = ["ruff check"]
format = ["ruff format --diff --check"]
ruff-fix = ["ruff check", "ruff format"]
type-check = ["mypy altair tests"]
pytest = [
"pytest -p no:randomly -n logical --doctest-modules tests altair tools",
]
test = ["lint", "format", "type-check", "pytest"]
test-fast = [
"ruff-fix",
"pytest -p no:randomly -n logical --doctest-modules tests altair tools -m \"not slow\"",
]
test-slow = [
"ruff-fix",
"pytest -p no:randomly -n logical --doctest-modules tests altair tools -m \"slow\"",
]
generate-schema-wrapper = [
"mypy tools",
"python tools/generate_schema_wrapper.py",
"test",
]
update-init-file = ["python tools/update_init_file.py", "ruff-fix"]
clean = [
"python -c \"import shutil;shutil.rmtree('doc/_build', ignore_errors=True)\"",
]
clean-generated = [
"python -c \"import shutil;shutil.rmtree('doc/user_guide/generated', ignore_errors=True)\"",
"python -c \"import shutil;shutil.rmtree('doc/gallery', ignore_errors=True)\"",
]
clean-all = [
"clean",
"clean-generated",
"python -c \"import shutil;shutil.rmtree('doc/_images', ignore_errors=True)\"",
]
serve = [
"python -m http.server --bind \"127.0.0.1\" --directory doc/_build/html 8000",
]
publish = ["python tools/sync_website.py --no-commit"]

[tool.altair.tasks.build-html]
commands = [
"python -c \"from pathlib import Path;Path('doc/_images').mkdir(exist_ok=True)\"",
"sphinx-build -b html -d doc/_build/doctrees doc doc/_build/html",
]
extras = ["doc"]

[tool.altair.tasks.clean-build]
commands = ["clean-all", "build-html"]
extras = ["doc"]

[tool.altair.tasks.publish-clean-build]
commands = ["clean-build", "publish"]
extras = ["doc"]
2 changes: 2 additions & 0 deletions tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
generate_schema_wrapper,
markup,
schemapi,
# tasks, (adds everything twice?)
update_init_file,
)

Expand All @@ -11,5 +12,6 @@
"generate_schema_wrapper",
"markup",
"schemapi",
# "tasks",
"update_init_file",
]
Loading

0 comments on commit 6ebc0ee

Please sign in to comment.