From 0d7c984fd98d0cde8bdd48affa536ef3b49b7ef6 Mon Sep 17 00:00:00 2001 From: Lev Gorodetskiy Date: Sun, 8 Oct 2023 12:29:47 -0300 Subject: [PATCH] Add help messages to pyproject.toml scripts --- pyproject.toml | 71 ++++++++++++++++------ src/demo_auction/pyproject.toml | 20 ++++-- src/demo_big_maps/pyproject.toml | 20 ++++-- src/demo_blank/pyproject.toml | 20 ++++-- src/demo_dao/pyproject.toml | 20 ++++-- src/demo_dex/pyproject.toml | 20 ++++-- src/demo_domains/pyproject.toml | 20 ++++-- src/demo_events/pyproject.toml | 20 ++++-- src/demo_evm_events/pyproject.toml | 20 ++++-- src/demo_factories/pyproject.toml | 20 ++++-- src/demo_head/pyproject.toml | 20 ++++-- src/demo_nft_marketplace/pyproject.toml | 20 ++++-- src/demo_raw/pyproject.toml | 20 ++++-- src/demo_token/pyproject.toml | 20 ++++-- src/demo_token_transfers/pyproject.toml | 20 ++++-- src/demo_uniswap/pyproject.toml | 20 ++++-- src/dipdup/projects/base/pyproject.toml.j2 | 20 ++++-- 17 files changed, 309 insertions(+), 82 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e1282a174..0029cf2c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/src/demo_auction/pyproject.toml b/src/demo_auction/pyproject.toml index 87a4c6ba1..f59b5b6d2 100644 --- a/src/demo_auction/pyproject.toml +++ b/src/demo_auction/pyproject.toml @@ -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 diff --git a/src/demo_big_maps/pyproject.toml b/src/demo_big_maps/pyproject.toml index 0753b612d..c5c99d826 100644 --- a/src/demo_big_maps/pyproject.toml +++ b/src/demo_big_maps/pyproject.toml @@ -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 diff --git a/src/demo_blank/pyproject.toml b/src/demo_blank/pyproject.toml index b2691dfc8..12e52d026 100644 --- a/src/demo_blank/pyproject.toml +++ b/src/demo_blank/pyproject.toml @@ -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 diff --git a/src/demo_dao/pyproject.toml b/src/demo_dao/pyproject.toml index 314dcfdda..89b654f02 100644 --- a/src/demo_dao/pyproject.toml +++ b/src/demo_dao/pyproject.toml @@ -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 diff --git a/src/demo_dex/pyproject.toml b/src/demo_dex/pyproject.toml index 3086a4c0a..163d4f962 100644 --- a/src/demo_dex/pyproject.toml +++ b/src/demo_dex/pyproject.toml @@ -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 diff --git a/src/demo_domains/pyproject.toml b/src/demo_domains/pyproject.toml index ca4300aa0..d9d24ed7d 100644 --- a/src/demo_domains/pyproject.toml +++ b/src/demo_domains/pyproject.toml @@ -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 diff --git a/src/demo_events/pyproject.toml b/src/demo_events/pyproject.toml index 3adf9be74..c0f30b169 100644 --- a/src/demo_events/pyproject.toml +++ b/src/demo_events/pyproject.toml @@ -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 diff --git a/src/demo_evm_events/pyproject.toml b/src/demo_evm_events/pyproject.toml index c597edef7..bdf083b2c 100644 --- a/src/demo_evm_events/pyproject.toml +++ b/src/demo_evm_events/pyproject.toml @@ -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 diff --git a/src/demo_factories/pyproject.toml b/src/demo_factories/pyproject.toml index cf8d5f71b..1c834f521 100644 --- a/src/demo_factories/pyproject.toml +++ b/src/demo_factories/pyproject.toml @@ -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 diff --git a/src/demo_head/pyproject.toml b/src/demo_head/pyproject.toml index ce9961ad5..f8ddf9316 100644 --- a/src/demo_head/pyproject.toml +++ b/src/demo_head/pyproject.toml @@ -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 diff --git a/src/demo_nft_marketplace/pyproject.toml b/src/demo_nft_marketplace/pyproject.toml index ec5917fdc..9b0bc4061 100644 --- a/src/demo_nft_marketplace/pyproject.toml +++ b/src/demo_nft_marketplace/pyproject.toml @@ -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 diff --git a/src/demo_raw/pyproject.toml b/src/demo_raw/pyproject.toml index 1ad94b476..555fa53bc 100644 --- a/src/demo_raw/pyproject.toml +++ b/src/demo_raw/pyproject.toml @@ -25,10 +25,22 @@ _isort = "isort ." _black = "black ." _ruff = "ruff check --fix ." _mypy = "mypy --no-incremental --exclude demo_raw ." -all = { composite = ["fmt", "lint"] } -fmt = { composite = ["_isort", "_black"] } -lint = { composite = ["_ruff", "_mypy"] } -image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_raw: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_raw:latest" + +[tool.pdm.scripts.lint] +help = "Check code with ruff and mypy" +composite = ["_ruff", "_mypy"] [tool.isort] line_length = 120 diff --git a/src/demo_token/pyproject.toml b/src/demo_token/pyproject.toml index 17f3695cc..7d2d95d54 100644 --- a/src/demo_token/pyproject.toml +++ b/src/demo_token/pyproject.toml @@ -25,10 +25,22 @@ _isort = "isort ." _black = "black ." _ruff = "ruff check --fix ." _mypy = "mypy --no-incremental --exclude demo_token ." -all = { composite = ["fmt", "lint"] } -fmt = { composite = ["_isort", "_black"] } -lint = { composite = ["_ruff", "_mypy"] } -image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_token: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_token:latest" + +[tool.pdm.scripts.lint] +help = "Check code with ruff and mypy" +composite = ["_ruff", "_mypy"] [tool.isort] line_length = 120 diff --git a/src/demo_token_transfers/pyproject.toml b/src/demo_token_transfers/pyproject.toml index 8eed8325b..2d3f55eed 100644 --- a/src/demo_token_transfers/pyproject.toml +++ b/src/demo_token_transfers/pyproject.toml @@ -25,10 +25,22 @@ _isort = "isort ." _black = "black ." _ruff = "ruff check --fix ." _mypy = "mypy --no-incremental --exclude demo_token_transfers ." -all = { composite = ["fmt", "lint"] } -fmt = { composite = ["_isort", "_black"] } -lint = { composite = ["_ruff", "_mypy"] } -image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_token_transfers: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_token_transfers:latest" + +[tool.pdm.scripts.lint] +help = "Check code with ruff and mypy" +composite = ["_ruff", "_mypy"] [tool.isort] line_length = 120 diff --git a/src/demo_uniswap/pyproject.toml b/src/demo_uniswap/pyproject.toml index 842c82de7..6e506c3e9 100644 --- a/src/demo_uniswap/pyproject.toml +++ b/src/demo_uniswap/pyproject.toml @@ -25,10 +25,22 @@ _isort = "isort ." _black = "black ." _ruff = "ruff check --fix ." _mypy = "mypy --no-incremental --exclude demo_uniswap ." -all = { composite = ["fmt", "lint"] } -fmt = { composite = ["_isort", "_black"] } -lint = { composite = ["_ruff", "_mypy"] } -image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t demo_uniswap: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_uniswap:latest" + +[tool.pdm.scripts.lint] +help = "Check code with ruff and mypy" +composite = ["_ruff", "_mypy"] [tool.isort] line_length = 120 diff --git a/src/dipdup/projects/base/pyproject.toml.j2 b/src/dipdup/projects/base/pyproject.toml.j2 index 01a852880..18ca5ef01 100644 --- a/src/dipdup/projects/base/pyproject.toml.j2 +++ b/src/dipdup/projects/base/pyproject.toml.j2 @@ -25,10 +25,22 @@ _isort = "isort ." _black = "black ." _ruff = "ruff check --fix ." _mypy = "mypy --no-incremental --exclude {{ project.package }} ." -all = { composite = ["fmt", "lint"] } -fmt = { composite = ["_isort", "_black"] } -lint = { composite = ["_ruff", "_mypy"] } -image = "docker buildx build . --load --progress plain -f deploy/Dockerfile -t {{ project.package }}: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 {{ project.package }}:latest" + +[tool.pdm.scripts.lint] +help = "Check code with ruff and mypy" +composite = ["_ruff", "_mypy"] [tool.isort] line_length = {{ project.line_length }}