File tree Expand file tree Collapse file tree 10 files changed +64
-33
lines changed Expand file tree Collapse file tree 10 files changed +64
-33
lines changed Original file line number Diff line number Diff line change @@ -39,27 +39,15 @@ repos:
39
39
rev : 22.12.0
40
40
hooks :
41
41
- id : black
42
- - repo : https://github.com/PyCQA/flake8
43
- rev : 6 .0.0
42
+ - repo : https://github.com/charliermarsh/ruff-pre-commit
43
+ rev : v0 .0.205
44
44
hooks :
45
- - id : flake8
46
- types : [python]
47
- additional_dependencies : [
48
- flake8-alfred,
49
- flake8-bugbear,
50
- flake8-builtins,
51
- flake8-comprehensions,
52
- flake8-docstrings,
53
- flake8-eradicate,
54
- flake8-print,
55
- flake8-pytest-style,
56
- flake8-todo,
57
- flake8-typing-imports,
58
- flake8-unused-arguments,
59
- pep8-naming,
60
- pydocstyle,
61
- Pygments,
62
- ]
45
+ - id : ruff
46
+ - repo : https://github.com/dosisod/refurb
47
+ rev : v1.9.1
48
+ hooks :
49
+ - id : refurb
50
+ args : [--ignore, FURB126]
63
51
- repo : https://github.com/asottile/setup-cfg-fmt
64
52
rev : v2.2.0
65
53
hooks :
88
76
hooks :
89
77
- id : codespell
90
78
args : [-L als, -L unparseable]
79
+ additional_dependencies : ["tomli"]
91
80
- repo : https://github.com/mgedmin/check-manifest
92
81
rev : " 0.49"
93
82
hooks :
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ reverse chronological order. Releases follow [semantic versioning](https://semve
5
5
and all releases are available on
6
6
[ Anaconda.org] ( https://anaconda.org/conda-forge/pytask-environment ) .
7
7
8
+ ## 0.2.x - 2023-xx-xx
9
+
10
+ - {pull}` 17 ` adds ruff and refurb to pre-commits and fixes the banner.
11
+
8
12
## 0.2.0 - 2022-16-04
9
13
10
14
- {pull}` 15 ` aligns pytask-environment with pytask v0.2.0.
Original file line number Diff line number Diff line change 5
5
[ ![ image] ( https://img.shields.io/conda/vn/conda-forge/pytask-environment.svg )] ( https://anaconda.org/conda-forge/pytask-environment )
6
6
[ ![ image] ( https://img.shields.io/conda/pn/conda-forge/pytask-environment.svg )] ( https://anaconda.org/conda-forge/pytask-environment )
7
7
[ ![ PyPI - License] ( https://img.shields.io/pypi/l/pytask-environment )] ( https://pypi.org/project/pytask-environment )
8
- [ ![ image] ( https://img.shields.io/github/workflow/status/pytask-dev/pytask-environment/Continuous%20Integration%20Workflow/ main )] ( https://github.com/pytask-dev/pytask-environment/actions?query=branch%3Amain )
8
+ [ ![ image] ( https://img.shields.io/github/actions/ workflow/status/pytask-dev/pytask-environment/main.yml?branch= main )] ( https://github.com/pytask-dev/pytask-environment/actions?query=branch%3Amain )
9
9
[ ![ image] ( https://codecov.io/gh/pytask-dev/pytask-environment/branch/main/graph/badge.svg )] ( https://codecov.io/gh/pytask-dev/pytask-environment )
10
10
[ ![ pre-commit.ci status] ( https://results.pre-commit.ci/badge/github/pytask-dev/pytask-environment/main.svg )] ( https://results.pre-commit.ci/latest/github/pytask-dev/pytask-environment/main )
11
11
[ ![ image] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/psf/black )
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ channels:
5
5
- nodefaults
6
6
7
7
dependencies :
8
- - python >=3.6
8
+ - python >=3.7
9
9
- pip
10
10
- setuptools_scm
11
11
- toml
Original file line number Diff line number Diff line change @@ -5,3 +5,41 @@ build-backend = "setuptools.build_meta"
5
5
6
6
[tool .setuptools_scm ]
7
7
write_to = " src/pytask_environment/_version.py"
8
+
9
+
10
+ [tool .codespell ]
11
+ ignore-words-list = " falsy"
12
+
13
+
14
+ [tool .ruff ]
15
+ select = [" ALL" ]
16
+ fix = true
17
+ extend-ignore = [
18
+ # Numpy docstyle
19
+ " D107" ,
20
+ " D203" ,
21
+ " D212" ,
22
+ " D213" ,
23
+ " D402" ,
24
+ " D404" ,
25
+ " D413" ,
26
+ " D415" ,
27
+ " D416" ,
28
+ " D417" ,
29
+ # Others.
30
+ " RET504" , # unnecessary variable assignment before return.
31
+ " S101" , # raise errors for asserts.
32
+ " B905" , # strict parameter for zip that was implemented in py310.
33
+ " I" , # ignore isort
34
+ " ANN101" , # type annotating self
35
+ " ANN102" , # type annotating cls
36
+ " FBT" , # flake8-boolean-trap
37
+ " EM" , # flake8-errmsg
38
+ " ANN401" , # flake8-annotate typing.Any
39
+ " PD" , # pandas-vet
40
+ " UP" , # pyupgrade is too aggressive for py<3.10
41
+ ]
42
+
43
+
44
+ [tool .ruff .per-file-ignores ]
45
+ "tests/*" = [" D" , " ANN" ]
Original file line number Diff line number Diff line change @@ -15,10 +15,6 @@ classifiers =
15
15
Operating System :: OS Independent
16
16
Programming Language :: Python :: 3
17
17
Programming Language :: Python :: 3 :: Only
18
- Programming Language :: Python :: 3.7
19
- Programming Language :: Python :: 3.8
20
- Programming Language :: Python :: 3.9
21
- Programming Language :: Python :: 3.10
22
18
project_urls =
23
19
Changelog = https://github.com/pytask-dev/pytask-environment/blob/main/CHANGES.md
24
20
Documentation = https://github.com/pytask-dev/pytask-environment
Original file line number Diff line number Diff line change
1
+ """This module contains everything related to the configuration."""
1
2
from __future__ import annotations
2
3
3
4
from typing import Any
@@ -61,18 +62,18 @@ def _get_first_non_none_value(
61
62
the order of the inputs while also providing a default.
62
63
63
64
"""
64
- callback = (lambda x : x ) if callback is None else callback # noqa: E731
65
+ callback = (lambda x : x ) if callback is None else callback
65
66
processed_values = (callback (config .get (key )) for config in configs )
66
67
return next ((value for value in processed_values if value is not None ), default )
67
68
68
69
69
70
def _convert_truthy_or_falsy_to_bool (x : bool | str | None ) -> bool :
70
71
"""Convert truthy or falsy value in .ini to Python boolean."""
71
- if x in [ True , "True" , "true" , "1" ] :
72
+ if x in ( True , "True" , "true" , "1" ) :
72
73
out = True
73
- elif x in [ False , "False" , "false" , "0" ] :
74
+ elif x in ( False , "False" , "false" , "0" ) :
74
75
out = False
75
- elif x in [ None , "None" , "none" ] :
76
+ elif x in ( None , "None" , "none" ) :
76
77
out = None
77
78
else :
78
79
raise ValueError (
Original file line number Diff line number Diff line change
1
+ """This module contains everything related to the database."""
1
2
from __future__ import annotations
2
3
3
4
from pony import orm
Original file line number Diff line number Diff line change
1
+ """This module contains everything related to logging."""
1
2
from __future__ import annotations
2
3
3
4
import sys
@@ -34,7 +35,7 @@ def pytask_log_session_header(session: Session) -> None:
34
35
not session .config ["check_python_version" ]
35
36
and not session .config ["check_environment" ]
36
37
):
37
- return None
38
+ return
38
39
39
40
package = retrieve_package ("python" )
40
41
@@ -43,7 +44,7 @@ def pytask_log_session_header(session: Session) -> None:
43
44
44
45
# Bail out if everything is fine.
45
46
if same_version and same_path :
46
- return None
47
+ return
47
48
48
49
msg = ""
49
50
if not same_version and session .config ["check_python_version" ]:
Original file line number Diff line number Diff line change 1
1
"""Entry-point for the plugin."""
2
2
from __future__ import annotations
3
3
4
+ from pluggy import PluginManager
4
5
from pytask import hookimpl
5
6
from pytask_environment import config
6
7
from pytask_environment import database
7
8
from pytask_environment import logging
8
9
9
10
10
11
@hookimpl
11
- def pytask_add_hooks (pm ) :
12
+ def pytask_add_hooks (pm : PluginManager ) -> None :
12
13
"""Register some plugins."""
13
14
pm .register (logging )
14
15
pm .register (config )
You can’t perform that action at this time.
0 commit comments