Skip to content

[pre-commit.ci] pre-commit autoupdate #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@v4
Expand Down
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ 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:
- --py37-plus
- --py38-plus
- --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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -62,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"]
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ url = https://github.com/pytask-dev/pytask-stata
author = Tobias Raabe
author_email = [email protected]
license = MIT
license_file = LICENSE
license_files = LICENSE
platforms = any
classifiers =
Development Status :: 4 - Beta
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/pytask_stata/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import functools
import subprocess
from pathlib import Path
from types import FunctionType
from typing import Any
from typing import TYPE_CHECKING

from pytask import depends_on
from pytask import has_mark
Expand All @@ -19,14 +19,17 @@
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
) -> None:
"""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
Expand Down
6 changes: 5 additions & 1 deletion src/pytask_stata/plugin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""Register hook specifications and implementations."""
from __future__ import annotations

from typing import TYPE_CHECKING

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

if TYPE_CHECKING:
from pluggy import PluginManager


@hookimpl
def pytask_add_hooks(pm: PluginManager) -> None:
Expand Down
5 changes: 4 additions & 1 deletion src/pytask_stata/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
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 TYPE_CHECKING

if TYPE_CHECKING:
from pathlib import Path


if sys.platform == "darwin":
Expand Down
38 changes: 2 additions & 36 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
[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.3
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 =
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