From cbaf7d30021ce322cd199e91d227fc250fc48a29 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:08:45 +0000 Subject: [PATCH 1/4] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PYCQA/docformatter: v1.5.1 → v1.6.0](https://github.com/PYCQA/docformatter/compare/v1.5.1...v1.6.0) - [github.com/psf/black: 22.12.0 → 23.3.0](https://github.com/psf/black/compare/22.12.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.223 → v0.0.261](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.223...v0.0.261) - [github.com/dosisod/refurb: v1.10.0 → v1.15.0](https://github.com/dosisod/refurb/compare/v1.10.0...v1.15.0) - [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](https://github.com/codespell-project/codespell/compare/v2.2.2...v2.2.4) - [github.com/pre-commit/mirrors-mypy: v0.991 → v1.2.0](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.2.0) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27786df..59b1300 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,20 +27,20 @@ repos: hooks: - id: setup-cfg-fmt - repo: https://github.com/PYCQA/docformatter - rev: v1.5.1 + rev: v1.6.0 hooks: - id: docformatter args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.223 + rev: v0.0.261 hooks: - id: ruff - repo: https://github.com/dosisod/refurb - rev: v1.10.0 + rev: v1.15.0 hooks: - id: refurb args: [--ignore, FURB126] @@ -59,11 +59,11 @@ repos: ] args: [--wrap, "88"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.4 hooks: - id: codespell - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.991' + rev: 'v1.2.0' hooks: - id: mypy args: [ From 59cca6d6fca62df182cde922b472aa327de9e577 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:09:29 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytask_parallel/config.py | 2 +- src/pytask_parallel/execute.py | 2 -- tests/test_execute.py | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pytask_parallel/config.py b/src/pytask_parallel/config.py index 632026d..6c4af23 100644 --- a/src/pytask_parallel/config.py +++ b/src/pytask_parallel/config.py @@ -12,7 +12,7 @@ @hookimpl def pytask_parse_config(config: dict[str, Any]) -> None: """Parse the configuration.""" - if config["n_workers"] == "auto": # noqa: PLR2004 + if config["n_workers"] == "auto": config["n_workers"] = max(os.cpu_count() - 1, 1) if ( diff --git a/src/pytask_parallel/execute.py b/src/pytask_parallel/execute.py index c780833..d61b51b 100644 --- a/src/pytask_parallel/execute.py +++ b/src/pytask_parallel/execute.py @@ -59,12 +59,10 @@ def pytask_execute_build(session: Session) -> bool | None: parallel_backend = PARALLEL_BACKENDS[session.config["parallel_backend"]] with parallel_backend(max_workers=session.config["n_workers"]) as executor: - session.config["_parallel_executor"] = executor sleeper = _Sleeper() while session.scheduler.is_active(): - try: newly_collected_reports = [] n_new_tasks = session.config["n_workers"] - len(running_tasks) diff --git a/tests/test_execute.py b/tests/test_execute.py index fbad52a..96641b4 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -209,9 +209,9 @@ def task_5(): assert session.exit_code == ExitCode.OK first_task_name = session.execution_reports[0].task.name - assert first_task_name.endswith("task_0") or first_task_name.endswith("task_3") + assert first_task_name.endswith(("task_0", "task_3")) last_task_name = session.execution_reports[-1].task.name - assert last_task_name.endswith("task_2") or last_task_name.endswith("task_5") + assert last_task_name.endswith(("task_2", "task_5")) @pytest.mark.end_to_end() From d3ff02de67836200532cdd399ad31751e54426bd Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 19 Apr 2023 23:40:07 +0200 Subject: [PATCH 3/4] Fix. --- .pre-commit-config.yaml | 13 +++++++------ pyproject.toml | 4 ++++ src/pytask_parallel/execute.py | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59b1300..bed1851 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,11 +3,17 @@ repos: rev: v4.4.0 hooks: - id: check-added-large-files - args: ['--maxkb=100'] + args: ['--maxkb=25'] + - id: check-case-conflict - id: check-merge-conflict + - id: check-vcs-permalinks - id: check-yaml - id: debug-statements - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: no-commit-to-branch + args: [--branch, main] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 # Use the ref you want to point at hooks: @@ -26,11 +32,6 @@ repos: rev: v2.2.0 hooks: - id: setup-cfg-fmt -- repo: https://github.com/PYCQA/docformatter - rev: v1.6.0 - hooks: - - id: docformatter - args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/psf/black rev: 23.3.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 6f3d7ec..0819456 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,8 @@ target-version = "py37" select = ["ALL"] fix = true extend-ignore = [ + "TRY", # ignore tryceratops. + "TCH", # ignore non-guarded type imports. # Numpy docstyle "D107", "D203", @@ -52,6 +54,8 @@ extend-ignore = [ "ANN401", # flake8-annotate typing.Any "PD", # pandas-vet "COM812", # trailing comma missing, but black takes care of that + "D401", # imperative mood for first line. too many false-positives. + "SLF001", # access private members. ] diff --git a/src/pytask_parallel/execute.py b/src/pytask_parallel/execute.py index d61b51b..72e7e0f 100644 --- a/src/pytask_parallel/execute.py +++ b/src/pytask_parallel/execute.py @@ -41,7 +41,7 @@ def pytask_post_parse(config: dict[str, Any]) -> None: @hookimpl(tryfirst=True) -def pytask_execute_build(session: Session) -> bool | None: +def pytask_execute_build(session: Session) -> bool | None: # noqa: C901, PLR0915 """Execute tasks with a parallel backend. There are three phases while the scheduler has tasks which need to be executed. @@ -195,7 +195,7 @@ def pytask_execute_task(session: Session, task: Task) -> Future[Any] | None: return None -def _unserialize_and_execute_task( +def _unserialize_and_execute_task( # noqa: PLR0913 bytes_function: bytes, bytes_kwargs: bytes, show_locals: bool, From ba4edeab598712c92bd88e72c11be27397a33433 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Wed, 19 Apr 2023 23:43:31 +0200 Subject: [PATCH 4/4] to changes. --- CHANGES.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index fcf8963..86fd0bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,9 @@ chronological order. Releases follow [semantic versioning](https://semver.org/) releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and [Anaconda.org](https://anaconda.org/conda-forge/pytask-parallel). -## 0.3.0 - 2023-xx-xx +## 0.3.1 - 2023-xx-xx + +## 0.3.0 - 2023-01-23 - {pull}`50` deprecates INI configurations and aligns the package with pytask v0.3. - {pull}`51` adds ruff and refurb.