Skip to content

Commit

Permalink
Add help messages to pyproject.toml scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Oct 8, 2023
1 parent b3e40f4 commit 0d7c984
Show file tree
Hide file tree
Showing 17 changed files with 309 additions and 82 deletions.
71 changes: 53 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,65 @@ dev = [
_black = "black src tests scripts"
_ruff = "ruff check --fix src tests scripts"
_mypy = "mypy src tests scripts"
all = { composite = ["fmt", "lint", "test"] }
fmt = { composite = ["_black"] }
lint = { composite = ["_ruff", "_mypy"] }
test = "pytest --cov-report=term-missing --cov=dipdup --cov-report=xml -n auto -s -v tests"
update = { shell = """
pdm update
pdm export --without-hashes -f requirements --prod -o requirements.txt
pdm export --without-hashes -f requirements --dev -o requirements.dev.txt
""" }
image = "docker buildx build . --load --progress plain -t dipdup:latest"
clean = "git clean -xdf --exclude=.venv"
demos = { shell = """

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint", "test"]

[tool.pdm.scripts.demos]
help = "Recreate demo projects from templates"
shell = """
python scripts/update_demos.py
python scripts/init_demos.py
pdm run fmt
# FIXME: Run isort once to fix import sorting (bug in ruff)
isort . --force-single-line -l 120
pdm run lint
""" }
docs_build = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs"
docs_serve = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs --watch --serve"
docs_watch = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs --watch"
docs_references = "python scripts/dump_references.py"
fixme = "grep -r -e 'FIXME: ' -e 'TODO: ' -e 'type: ignore' -n src/dipdup --color"
"""

[tool.pdm.scripts.docs_build]
help = "Build docs"
cmd = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs"

[tool.pdm.scripts.docs_serve]
help = "Build and serve docs"
cmd = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs --serve"

[tool.pdm.scripts.docs_watch]
help = "Watch docs"
cmd = "python scripts/docs.py --source docs --destination {args:../interface}/content/docs --watch"

[tool.pdm.scripts.docs_references]
help = "Dump references"
cmd = "python scripts/dump_references.py"

[tool.pdm.scripts.fixme]
help = "Find FIXME and TODO comments"
cmd = "grep -r -e 'FIXME: ' -e 'TODO: ' -e 'type: ignore' -n src/dipdup --color"

[tool.pdm.scripts.fmt]
help = "Format code with black"
composite = ["_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -t dipdup:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.pdm.scripts.test]
help = "Run tests"
cmd = "pytest --cov-report=term-missing --cov=dipdup --cov-report=xml -n auto -s -v tests"

[tool.pdm.scripts.update]
help = "Update dependencies and dump requirements.txt"
shell = """
pdm update
pdm export --without-hashes -f requirements --prod -o requirements.txt
pdm export --without-hashes -f requirements --dev -o requirements.dev.txt
"""

[tool.pdm.build.targets.wheel]
packages = ["src/dipdup"]
Expand Down
20 changes: 16 additions & 4 deletions src/demo_auction/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_auction ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_auction:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_auction:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_big_maps/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_big_maps ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_big_maps:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_big_maps:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_blank/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_blank ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_blank:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_blank:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_dao/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_dao ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_dao:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_dao:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_dex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_dex ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_dex:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_dex:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_domains/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_domains ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_domains:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_domains:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_events/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_events ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_events:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_events:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_evm_events/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_evm_events ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_evm_events:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_evm_events:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_factories/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_factories ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_factories:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_factories:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_head/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_head ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_head:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_head:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
20 changes: 16 additions & 4 deletions src/demo_nft_marketplace/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ _isort = "isort ."
_black = "black ."
_ruff = "ruff check --fix ."
_mypy = "mypy --no-incremental --exclude demo_nft_marketplace ."
all = { composite = ["fmt", "lint"] }
fmt = { composite = ["_isort", "_black"] }
lint = { composite = ["_ruff", "_mypy"] }
image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_nft_marketplace:latest"

[tool.pdm.scripts.all]
help = "Run all checks"
composite = ["fmt", "lint"]

[tool.pdm.scripts.fmt]
help = "Format code with isort and black"
composite = ["_isort", "_black"]

[tool.pdm.scripts.image]
help = "Build Docker image"
cmd = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_nft_marketplace:latest"

[tool.pdm.scripts.lint]
help = "Check code with ruff and mypy"
composite = ["_ruff", "_mypy"]

[tool.isort]
line_length = 120
Expand Down
Loading

0 comments on commit 0d7c984

Please sign in to comment.