From 3c41402530819d74485e1b3b9e23df0f9e479a8b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:13:29 +0000 Subject: [PATCH 1/6] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/asottile/reorder_python_imports → https://github.com/asottile/reorder-python-imports - [github.com/asottile/reorder-python-imports: v3.9.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.9.0...v3.12.0) - [github.com/asottile/setup-cfg-fmt: v2.2.0 → v2.5.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.2.0...v2.5.0) - [github.com/PyCQA/docformatter: v1.6.0.rc1 → v1.7.5](https://github.com/PyCQA/docformatter/compare/v1.6.0.rc1...v1.7.5) - [github.com/psf/black: 22.12.0 → 23.9.1](https://github.com/psf/black/compare/22.12.0...23.9.1) - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.228 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.228...v0.0.292) - [github.com/dosisod/refurb: v1.10.0 → v1.21.0](https://github.com/dosisod/refurb/compare/v1.10.0...v1.21.0) - [github.com/executablebooks/mdformat: 0.7.16 → 0.7.17](https://github.com/executablebooks/mdformat/compare/0.7.16...0.7.17) - [github.com/codespell-project/codespell: v2.2.2 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.2...v2.2.6) - [github.com/pre-commit/mirrors-mypy: v0.991 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.5.1) --- .pre-commit-config.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fe7cd5..668d9df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,8 +27,8 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/reorder_python_imports - rev: v3.9.0 +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.12.0 hooks: - id: reorder-python-imports args: @@ -36,11 +36,11 @@ repos: - --add-import - from __future__ import annotations - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.2.0 + rev: v2.5.0 hooks: - id: setup-cfg-fmt - repo: https://github.com/PyCQA/docformatter - rev: v1.6.0.rc1 + rev: v1.7.5 hooks: - id: docformatter args: @@ -51,15 +51,15 @@ repos: - '88' - --blank - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.9.1 hooks: - id: black -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.228 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.292 hooks: - id: ruff - repo: https://github.com/dosisod/refurb - rev: v1.10.0 + rev: v1.21.0 hooks: - id: refurb args: @@ -75,7 +75,7 @@ repos: - src - tests - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: @@ -85,11 +85,11 @@ repos: - --wrap - '88' - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.5.1 hooks: - id: mypy args: From 6eec381aed322253514cd418621d99af79132b03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:15:23 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.cfg | 4 ++-- src/pytask_stata/collect.py | 6 ++++-- src/pytask_stata/plugin.py | 5 ++++- src/pytask_stata/shared.py | 6 ++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/setup.cfg b/setup.cfg index d955ee9..74d0861 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ url = https://github.com/pytask-dev/pytask-stata author = Tobias Raabe author_email = raabe@posteo.de license = MIT -license_file = LICENSE +license_files = LICENSE platforms = any classifiers = Development Status :: 4 - Beta @@ -26,7 +26,7 @@ packages = find: install_requires = click pytask>=0.3 -python_requires = >=3.7 +python_requires = >=3.8 include_package_data = True package_dir = =src zip_safe = False diff --git a/src/pytask_stata/collect.py b/src/pytask_stata/collect.py index 4c2ae24..5aa8733 100644 --- a/src/pytask_stata/collect.py +++ b/src/pytask_stata/collect.py @@ -3,9 +3,8 @@ import functools import subprocess -from pathlib import Path from types import FunctionType -from typing import Any +from typing import Any, TYPE_CHECKING from pytask import depends_on from pytask import has_mark @@ -19,6 +18,9 @@ from pytask_stata.shared import convert_task_id_to_name_of_log_file from pytask_stata.shared import stata +if TYPE_CHECKING: + from pathlib import Path + def run_stata_script( executable: str, script: Path, options: list[str], log_name: list[str], cwd: Path diff --git a/src/pytask_stata/plugin.py b/src/pytask_stata/plugin.py index 7efaaf1..c8a8b93 100644 --- a/src/pytask_stata/plugin.py +++ b/src/pytask_stata/plugin.py @@ -2,12 +2,15 @@ from __future__ import annotations from _pytask.config import hookimpl -from pluggy import PluginManager from pytask_stata import cli from pytask_stata import collect from pytask_stata import config from pytask_stata import execute from pytask_stata import parametrize +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from pluggy import PluginManager @hookimpl diff --git a/src/pytask_stata/shared.py b/src/pytask_stata/shared.py index c63d829..7c81b62 100644 --- a/src/pytask_stata/shared.py +++ b/src/pytask_stata/shared.py @@ -2,10 +2,12 @@ from __future__ import annotations import sys -from pathlib import Path from typing import Any from typing import Iterable -from typing import Sequence +from typing import Sequence, TYPE_CHECKING + +if TYPE_CHECKING: + from pathlib import Path if sys.platform == "darwin": From 19f1a42ec96752564a144f3feb3244148860616b Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 8 Oct 2023 01:24:01 +0200 Subject: [PATCH 3/6] Fix. --- .github/workflows/main.yml | 2 +- tox.ini | 22 ++-------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc92c91..73055b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 diff --git a/tox.ini b/tox.ini index 341a53c..3d3e1b5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,39 +1,21 @@ [tox] envlist = pytest -skipsdist = True -skip_missing_interpreters = True -passenv = PY_IGNORE_IMPORTMISMATCH -whitelist_externals = python [testenv] -basepython = python +usedevelop = true [testenv:pytest] conda_channels = conda-forge nodefaults conda_deps = - pytask >=0.3 + pytask <0.4 pytest pytest-cov pytest-xdist commands = - pip install --no-deps -e . pytest {posargs} -[flake8] -docstring-convention = numpy -ignore = - D - E203 ; ignores whitespace around : which is enforced by Black. - W503 ; ignores linebreak before binary operator which is enforced by Black. - PT006 ; ignores that parametrizing tests with tuple argument names is preferred. - PT023 ; ignores parentheses at the end of markers. -max-line-length = 88 -warn-symbols = - pytest.mark.wip = Remove 'wip' flag for tests. - pytest.mark.skip = Remove 'skip' flag for tests. - [pytest] addopts = --doctest-modules filterwarnings = From e03123a15b72156755e35d461cbd4aa94ac711c4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:24:21 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytask_stata/collect.py | 3 ++- src/pytask_stata/plugin.py | 3 ++- src/pytask_stata/shared.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pytask_stata/collect.py b/src/pytask_stata/collect.py index 5aa8733..3fc2c40 100644 --- a/src/pytask_stata/collect.py +++ b/src/pytask_stata/collect.py @@ -4,7 +4,8 @@ import functools import subprocess from types import FunctionType -from typing import Any, TYPE_CHECKING +from typing import Any +from typing import TYPE_CHECKING from pytask import depends_on from pytask import has_mark diff --git a/src/pytask_stata/plugin.py b/src/pytask_stata/plugin.py index c8a8b93..a8f4e46 100644 --- a/src/pytask_stata/plugin.py +++ b/src/pytask_stata/plugin.py @@ -1,13 +1,14 @@ """Register hook specifications and implementations.""" from __future__ import annotations +from typing import TYPE_CHECKING + from _pytask.config import hookimpl from pytask_stata import cli from pytask_stata import collect from pytask_stata import config from pytask_stata import execute from pytask_stata import parametrize -from typing import TYPE_CHECKING if TYPE_CHECKING: from pluggy import PluginManager diff --git a/src/pytask_stata/shared.py b/src/pytask_stata/shared.py index 7c81b62..f36c104 100644 --- a/src/pytask_stata/shared.py +++ b/src/pytask_stata/shared.py @@ -4,7 +4,8 @@ import sys from typing import Any from typing import Iterable -from typing import Sequence, TYPE_CHECKING +from typing import Sequence +from typing import TYPE_CHECKING if TYPE_CHECKING: from pathlib import Path From b6404e7b757dd14cbbf0beaf93cfcab501ef3b42 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 8 Oct 2023 01:29:11 +0200 Subject: [PATCH 5/6] Fix. --- .pre-commit-config.yaml | 2 +- environment.yml | 6 +++--- pyproject.toml | 5 +++-- src/pytask_stata/collect.py | 5 +++-- src/pytask_stata/plugin.py | 3 ++- src/pytask_stata/shared.py | 3 ++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 668d9df..16f4341 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: reorder-python-imports args: - - --py37-plus + - --py38-plus - --add-import - from __future__ import annotations - repo: https://github.com/asottile/setup-cfg-fmt diff --git a/environment.yml b/environment.yml index 2296d45..0c59547 100644 --- a/environment.yml +++ b/environment.yml @@ -5,14 +5,14 @@ channels: - nodefaults dependencies: - - python >=3.7 + - python >=3.8 - pip - setuptools_scm - toml # Package dependencies - - pytask >=0.3 - - pytask-parallel >=0.3 + - pytask <0.4 + - pytask-parallel <0.4 # Misc - black diff --git a/pyproject.toml b/pyproject.toml index f040661..713d5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,10 +25,12 @@ ignore_errors = true [tool.ruff] -target-version = "py37" +target-version = "py38" select = ["ALL"] fix = true extend-ignore = [ + "I", # ignore isort + "TRY", # Numpy docstyle "D107", "D203", @@ -44,7 +46,6 @@ extend-ignore = [ "RET504", # unnecessary variable assignment before return. "S101", # raise errors for asserts. "B905", # strict parameter for zip that was implemented in py310. - "I", # ignore isort "ANN101", # type annotating self "ANN102", # type annotating cls "FBT", # flake8-boolean-trap diff --git a/src/pytask_stata/collect.py b/src/pytask_stata/collect.py index 5aa8733..d65ee12 100644 --- a/src/pytask_stata/collect.py +++ b/src/pytask_stata/collect.py @@ -4,7 +4,8 @@ import functools import subprocess from types import FunctionType -from typing import Any, TYPE_CHECKING +from typing import Any +from typing import TYPE_CHECKING from pytask import depends_on from pytask import has_mark @@ -28,7 +29,7 @@ def run_stata_script( """Run an R script.""" cmd = [executable, "-e", "do", script.as_posix(), *options, *log_name] print("Executing " + " ".join(cmd) + ".") # noqa: T201 - subprocess.run(cmd, cwd=cwd, check=True) + subprocess.run(cmd, cwd=cwd, check=True) # noqa: S603 @hookimpl diff --git a/src/pytask_stata/plugin.py b/src/pytask_stata/plugin.py index c8a8b93..a8f4e46 100644 --- a/src/pytask_stata/plugin.py +++ b/src/pytask_stata/plugin.py @@ -1,13 +1,14 @@ """Register hook specifications and implementations.""" from __future__ import annotations +from typing import TYPE_CHECKING + from _pytask.config import hookimpl from pytask_stata import cli from pytask_stata import collect from pytask_stata import config from pytask_stata import execute from pytask_stata import parametrize -from typing import TYPE_CHECKING if TYPE_CHECKING: from pluggy import PluginManager diff --git a/src/pytask_stata/shared.py b/src/pytask_stata/shared.py index 7c81b62..f36c104 100644 --- a/src/pytask_stata/shared.py +++ b/src/pytask_stata/shared.py @@ -4,7 +4,8 @@ import sys from typing import Any from typing import Iterable -from typing import Sequence, TYPE_CHECKING +from typing import Sequence +from typing import TYPE_CHECKING if TYPE_CHECKING: from pathlib import Path From d9f2d20b2e69eeebe1320102b408bbf881100f6a Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 8 Oct 2023 01:35:29 +0200 Subject: [PATCH 6/6] Fix. --- pyproject.toml | 12 ++++++++++++ tox.ini | 18 +----------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 713d5b2..4cceea3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,3 +63,15 @@ extend-ignore = [ [tool.ruff.pydocstyle] convention = "numpy" + + +[tool.pytest.ini_options] +# Do not add src since it messes with the loading of pytask-parallel as a plugin. +testpaths = ["tests"] +markers = [ + "wip: Tests that are work-in-progress.", + "unit: Flag for unit tests which target mainly a single function.", + "integration: Flag for integration tests which may comprise of multiple unit tests.", + "end_to_end: Flag for tests that cover the whole program.", +] +norecursedirs = [".idea", ".tox"] diff --git a/tox.ini b/tox.ini index 3d3e1b5..0486889 100644 --- a/tox.ini +++ b/tox.ini @@ -9,25 +9,9 @@ conda_channels = conda-forge nodefaults conda_deps = - pytask <0.4 + pytask =0.3 pytest pytest-cov pytest-xdist commands = pytest {posargs} - -[pytest] -addopts = --doctest-modules -filterwarnings = - ignore: the imp module is deprecated in favour of importlib - ignore: Using or importing the ABCs from 'collections' instead of - ignore: The (parser|symbol) module is deprecated and will be removed in future -junit_family = xunit2 -markers = - wip: Tests that are work-in-progress. - unit: Flag for unit tests which target mainly a single function. - integration: Flag for integration tests which may comprise of multiple unit tests. - end_to_end: Flag for tests that cover the whole program. -norecursedirs = - .idea - .tox