|
| 1 | +# Copyright 2019 Felix Soubelet <[email protected]> |
| 2 | +# MIT License |
| 3 | + |
| 4 | +# ----- Dev Targets ----- # |
| 5 | + |
| 6 | +# build the package sdist and wheel |
| 7 | +build: |
| 8 | + rm -rf dist |
| 9 | + uv build |
| 10 | + |
| 11 | +# clean up build artifacts, documentation pages and other temporary files |
| 12 | +clean: |
| 13 | + rm -rf doc_build |
| 14 | + rm -rf plot_directive |
| 15 | + rm -rf docs/gallery |
| 16 | + rm -rf docs/gen_modules |
| 17 | + rm -rf build |
| 18 | + rm -rf dist |
| 19 | + rm -rf pyhdtoolkit.egg-info |
| 20 | + rm -rf .eggs |
| 21 | + find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete |
| 22 | + find . -type d -name "*.ipynb_checkpoints" -exec rm -rf {} + |
| 23 | + find . -type d -name '*.pytest_cache' -exec rm -rf {} + -o -type f -name '*.pytest_cache' -exec rm -rf {} + |
| 24 | + find . -type f -name 'fc.*' -delete -o -type f -name 'fort.*' -delete |
| 25 | + find . -type f -name 'checkpoint_restart.*' -delete -o -type f -name 'internal_mag_pot.*' -delete |
| 26 | + find . -type d -name "*.mypy_cache" -exec rm -rf {} + |
| 27 | + find . -type f -name '.coverage*' -exec rm -rf {} + -o -type f -name 'coverage.xml' -delete |
| 28 | + |
| 29 | +# build a docker image with a working pyhdtoolkit environment |
| 30 | +docker: |
| 31 | + docker build -f ./docker/Dockerfile -t simenv . |
| 32 | + docker tag simenv simenv:latest |
| 33 | + |
| 34 | +# build the documentation pages |
| 35 | +docs: |
| 36 | + uv run python -m sphinx -v -b html docs doc_build -d doc_build |
| 37 | + |
| 38 | +# run the isort and black tools on the codebase |
| 39 | +format: |
| 40 | + uvx isort docs && uvx black docs |
| 41 | + uvx isort tests && uvx black tests |
| 42 | + uvx isort pyhdtoolkit && uvx black pyhdtoolkit |
| 43 | + uvx isort examples && uvx black -l 95 examples/*.py |
| 44 | + |
| 45 | +# install (editable) the package in the current environment |
| 46 | +install: |
| 47 | + uv pip install --editable . |
| 48 | + |
| 49 | +# count the lines of code with tokei |
| 50 | +lines: |
| 51 | + tokei . |
| 52 | + |
| 53 | +# run the Ruff linter on the codebase |
| 54 | +lint: |
| 55 | + uvx ruff check pyhdtoolkit |
| 56 | + |
| 57 | +# run the test suite (parallelized) with pytest |
| 58 | +tests: |
| 59 | + uv run python -m pytest -n auto -v |
0 commit comments