From a2b8fab7c257a006417e4df7c41e428cc82bfd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20L=C3=A1t?= Date: Thu, 15 Dec 2022 12:38:36 +0100 Subject: [PATCH] Release 3.6.0 (#22) --- CHANGELOG.md | 18 +++++--- poetry.lock | 57 +++++++++++-------------- pyproject.toml | 7 ++- src/delfino_core/commands/lint.py | 3 +- src/delfino_core/commands/test.py | 9 +--- src/delfino_core/commands/verify_all.py | 5 +-- src/delfino_core/utils.py | 9 ++-- 7 files changed, 50 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d7dd0..db27af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,16 +12,21 @@ Types of changes are: ## [Unreleased] -## [3.5.0] - 2022-12-14 +## [3.6.0] - 2022-12-14 ### Features -- Commands using `utils.execute_commands_group` can be decorated with `decorators.pass_args`. Unlike regular passed arguments, this is expected to be a mapping from command name to passed arguments, allowing passing these arguments only to specific commands in the group. Example: +- Commands executed via `utils.execute_commands_group` will receive passed arguments as `passed_args` from config, if they use the `delfino.decorators.pass_args` decorator. Example: ```toml - [tool.delfino.plugins.delfino-core.verify-all.pass_args] - test-all = "-m 'not slow'" + [tool.delfino.plugins.delfino-core.lint-pylint] + pass_args = "--fail-under 0.9" ``` - will pass `-m 'not slow'` to `pytest` executed by `test-all`, which is in `verify-all` group. + will pass `--fail-under 0.9` to `pylint` executed by `lint-pylint`, which is in `lint` group, which itself is in `verify-all` group. + +## [3.5.0] - 2022-12-14 + +### Features + - `utils.execute_commands_group` logs a debug message when a command is not executed because it is disabled. ## [3.4.1] - 2022-12-13 @@ -156,7 +161,8 @@ Types of changes are: - Initial source code -[Unreleased]: https://github.com/radeklat/delfino-core/compare/3.5.0...HEAD +[Unreleased]: https://github.com/radeklat/delfino-core/compare/3.6.0...HEAD +[3.6.0]: https://github.com/radeklat/delfino-core/compare/3.5.0...3.6.0 [3.5.0]: https://github.com/radeklat/delfino-core/compare/3.4.1...3.5.0 [3.4.1]: https://github.com/radeklat/delfino-core/compare/3.4.0...3.4.1 [3.4.0]: https://github.com/radeklat/delfino-core/compare/3.3.0...3.4.0 diff --git a/poetry.lock b/poetry.lock index 2c0adce..6d6e873 100644 --- a/poetry.lock +++ b/poetry.lock @@ -31,7 +31,7 @@ tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy [[package]] name = "black" -version = "22.10.0" +version = "22.12.0" description = "The uncompromising code formatter." category = "main" optional = false @@ -172,7 +172,7 @@ test = ["hypothesis (>=1.11.4,!=3.79.2)", "iso8601", "pretend", "pytest (>=6.2.0 [[package]] name = "delfino" -version = "0.26.0" +version = "0.27.0" description = "A collection of command line helper scripts wrapping tools used during Python development." category = "main" optional = false @@ -315,11 +315,11 @@ python-versions = "*" [[package]] name = "isort" -version = "5.10.1" +version = "5.11.2" description = "A Python utility / library to sort Python imports." category = "main" optional = false -python-versions = ">=3.6.1,<4.0" +python-versions = ">=3.7.0" [package.extras] colors = ["colorama (>=0.4.3,<0.5.0)"] @@ -446,7 +446,7 @@ python-versions = ">=3.7" [[package]] name = "pathspec" -version = "0.10.2" +version = "0.10.3" description = "Utility library for gitignore style pattern matching of file paths." category = "main" optional = false @@ -948,7 +948,7 @@ verify-all = ["black", "isort", "pre-commit", "pytest", "coverage", "pytest-cov" [metadata] lock-version = "1.1" python-versions = "^3.7.2" -content-hash = "51734a62f024f84355647d0b62379a34bcd67b7f9176d6f24c30a3e79ea2fe92" +content-hash = "d193112a3f17b04c4835b43718af18ad57a5395b59af5059e0745100e6b75d30" [metadata.files] astroid = [ @@ -960,27 +960,18 @@ attrs = [ {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] black = [ - {file = "black-22.10.0-1fixedarch-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:5cc42ca67989e9c3cf859e84c2bf014f6633db63d1cbdf8fdb666dcd9e77e3fa"}, - {file = "black-22.10.0-1fixedarch-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:5d8f74030e67087b219b032aa33a919fae8806d49c867846bfacde57f43972ef"}, - {file = "black-22.10.0-1fixedarch-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:197df8509263b0b8614e1df1756b1dd41be6738eed2ba9e9769f3880c2b9d7b6"}, - {file = "black-22.10.0-1fixedarch-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:2644b5d63633702bc2c5f3754b1b475378fbbfb481f62319388235d0cd104c2d"}, - {file = "black-22.10.0-1fixedarch-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:e41a86c6c650bcecc6633ee3180d80a025db041a8e2398dcc059b3afa8382cd4"}, - {file = "black-22.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2039230db3c6c639bd84efe3292ec7b06e9214a2992cd9beb293d639c6402edb"}, - {file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"}, - {file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"}, - {file = "black-22.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b9b29da4f564ba8787c119f37d174f2b69cdfdf9015b7d8c5c16121ddc054ae"}, - {file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"}, - {file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"}, - {file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"}, - {file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"}, - {file = "black-22.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fba8a281e570adafb79f7755ac8721b6cf1bbf691186a287e990c7929c7692ff"}, - {file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"}, - {file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"}, - {file = "black-22.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:974308c58d057a651d182208a484ce80a26dac0caef2895836a92dd6ebd725e0"}, - {file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"}, - {file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"}, - {file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"}, - {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, + {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, + {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, + {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, + {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, + {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, + {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, + {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, + {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, + {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, + {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, + {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, + {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, ] bleach = [ {file = "bleach-5.0.1-py3-none-any.whl", hash = "sha256:085f7f33c15bd408dd9b17a4ad77c577db66d76203e5984b1bd59baeee948b2a"}, @@ -1157,8 +1148,8 @@ cryptography = [ {file = "cryptography-38.0.4.tar.gz", hash = "sha256:175c1a818b87c9ac80bb7377f5520b7f31b3ef2a0004e2420319beadedb67290"}, ] delfino = [ - {file = "delfino-0.26.0-py3-none-any.whl", hash = "sha256:d5f749e31f79d997bd6850efee8dac3aa70789dd72b5e7e7ca5ce454e4412d8a"}, - {file = "delfino-0.26.0.tar.gz", hash = "sha256:948f7f723b6f7ddc60255b2f3c4aaeef454237ad56271e02da5c0d48f5860ce7"}, + {file = "delfino-0.27.0-py3-none-any.whl", hash = "sha256:0d90379964f8096ea9fc321295c6a7985a7b23f4a91f8b3a2ef5caa0f3e7d396"}, + {file = "delfino-0.27.0.tar.gz", hash = "sha256:64be52f7d1ef0dc7a86c7d888d896f70bee9752707da11f174186e64e5ded372"}, ] deprecation = [ {file = "deprecation-2.1.0-py2.py3-none-any.whl", hash = "sha256:a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a"}, @@ -1209,8 +1200,8 @@ iniconfig = [ {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] isort = [ - {file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"}, - {file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"}, + {file = "isort-5.11.2-py3-none-any.whl", hash = "sha256:e486966fba83f25b8045f8dd7455b0a0d1e4de481e1d7ce4669902d9fb85e622"}, + {file = "isort-5.11.2.tar.gz", hash = "sha256:dd8bbc5c0990f2a095d754e50360915f73b4c26fc82733eb5bfc6b48396af4d2"}, ] jaraco-classes = [ {file = "jaraco.classes-3.2.3-py3-none-any.whl", hash = "sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158"}, @@ -1298,8 +1289,8 @@ packaging = [ {file = "packaging-22.0.tar.gz", hash = "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"}, ] pathspec = [ - {file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"}, - {file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"}, + {file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"}, + {file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"}, ] pkginfo = [ {file = "pkginfo-1.9.2-py3-none-any.whl", hash = "sha256:d580059503f2f4549ad6e4c106d7437356dbd430e2c7df99ee1efe03d75f691e"}, diff --git a/pyproject.toml b/pyproject.toml index 671e375..24b7de2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name="delfino-core" -version="3.5.0" +version="3.6.0" authors = ["Radek Lát "] description="Delfino core plugin" license = "MIT License" @@ -25,7 +25,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.7.2" -delfino = ">=0.24.0" +delfino = ">=0.27.0" black = {version = "*", optional = true} isort = {version = "*", optional = true} @@ -148,3 +148,6 @@ add-ignore = [ "D401", # "First line should be in imperative mood" "D413", # "Missing blank line after last section" ] + +[tool.delfino.plugins.local_commands_directory.test-all] +pass_args = "--dfhfadshf" \ No newline at end of file diff --git a/src/delfino_core/commands/lint.py b/src/delfino_core/commands/lint.py index 223cd0d..4d5717d 100644 --- a/src/delfino_core/commands/lint.py +++ b/src/delfino_core/commands/lint.py @@ -184,12 +184,11 @@ def get_pylintrc_folder(path: Path) -> Path: @click.command(help="Runs all linting commands. Configured by the ``lint_commands`` setting.") @files_folders_option @pass_plugin_app_context -@pass_args @click.pass_context def lint( click_context: click.Context, app_context: AppContext[CorePluginConfig], **kwargs, ): - del kwargs # handled by execute_commands_group or passed to downstream commands + del kwargs # passed to downstream commands execute_commands_group("lint", click_context, app_context.plugin_config) diff --git a/src/delfino_core/commands/test.py b/src/delfino_core/commands/test.py index 8588604..9b50250 100644 --- a/src/delfino_core/commands/test.py +++ b/src/delfino_core/commands/test.py @@ -194,13 +194,8 @@ def test(app_context: AppContext[CorePluginConfig], passed_args: Tuple[str, ...] @pass_plugin_app_context @pass_args @click.pass_context -def test_all( - click_context: click.Context, - app_context: AppContext[CorePluginConfig], - passed_args: Tuple[str, ...], - files_folders: Tuple[str, ...], -): - del app_context, passed_args, files_folders # passed to `test` +def test_all(click_context: click.Context, **kwargs): + del kwargs # passed to `test` click_context.forward(test) click_context.forward(coverage_report) diff --git a/src/delfino_core/commands/verify_all.py b/src/delfino_core/commands/verify_all.py index d6c978e..40d89bd 100644 --- a/src/delfino_core/commands/verify_all.py +++ b/src/delfino_core/commands/verify_all.py @@ -1,5 +1,4 @@ import click -from delfino.decorators import pass_args from delfino.models import AppContext from delfino_core.commands.format import run_format @@ -14,8 +13,6 @@ @click.command(help="Runs all verification commands. Configured by the ``verify_commands`` setting.") @pass_plugin_app_context -@pass_args @click.pass_context -def verify_all(click_context: click.Context, app_context: AppContext[CorePluginConfig], **kwargs): - del kwargs # handled by execute_commands_group +def verify_all(click_context: click.Context, app_context: AppContext[CorePluginConfig]): execute_commands_group("verify", click_context, app_context.plugin_config) diff --git a/src/delfino_core/utils.py b/src/delfino_core/utils.py index 39c3cfa..b726162 100644 --- a/src/delfino_core/utils.py +++ b/src/delfino_core/utils.py @@ -3,6 +3,7 @@ import click from delfino.click_utils.command import get_root_command +from delfino.decorators.pass_args import set_passed_args_from_config_in_group from delfino_core.config import CorePluginConfig @@ -17,7 +18,6 @@ def ensure_reports_dir(config: CorePluginConfig) -> None: def execute_commands_group(name: str, click_context: click.Context, plugin_config: CorePluginConfig, **kwargs): root = get_root_command(click_context) option_name = f"{name}_commands" - passed_args = click_context.params.pop("passed_args", {}) commands: Dict[str, click.Command] = { command: cast(click.Command, root.get_command(click_context, command)) @@ -35,7 +35,8 @@ def execute_commands_group(name: str, click_context: click.Context, plugin_confi _LOG.debug(f"Skipping disabled command '{target_name}'.") continue - if target_name in passed_args: - click_context.params["passed_args"] = passed_args[target_name] + command = commands[target_name] - click_context.forward(commands[target_name], **kwargs) + set_passed_args_from_config_in_group(click_context, command) + + click_context.forward(command, **kwargs)