Created
July 6, 2024 20:20
-
-
Save adamghill/6739f4cd7a1f3701021e41e155c0c6cf to your computer and use it in GitHub Desktop.
Example justfile for Python projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://just.systems | |
set quiet | |
set dotenv-load | |
set export | |
# List commands | |
_default: | |
just --list --unsorted --justfile {{justfile()}} --list-heading $'Available commands:\n' | |
# Install dependencies | |
bootstrap: | |
poetry install | |
# Set up the project | |
setup: | |
brew install pipx | |
pipx ensurepath | |
pipx install poetry | |
pipx install ruff | |
# Lock the dependencies | |
lock: | |
poetry lock | |
# Update the project | |
update: | |
just lock | |
poetry install | |
# Lint the project | |
lint *ARGS='.': | |
-ruff check {{ ARGS }} | |
# Check the types in the project | |
type *ARGS='': | |
-poetry run mypy {{ ARGS }} # need to run through poetry to see installed dependencies | |
# Benchmark the project | |
benchmark: | |
-poetry run pytest tests/benchmarks/ --benchmark-only --benchmark-compare | |
# Run the tests | |
test *ARGS='': | |
-poetry run pytest {{ ARGS }} | |
alias t := test | |
# Run coverage on the code | |
coverage: | |
-poetry run pytest --cov=refreshcss | |
# Run all the dev things | |
dev: | |
just lint | |
just type | |
just coverage | |
# Build the package | |
build: | |
poetry build | |
# Build and publish the package to test PyPI and prod PyPI | |
publish: | |
poetry publish --build -r test | |
poetry publish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment