cz-path 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cz_path-0.0.1/LICENSE.txt +18 -0
- cz_path-0.0.1/PKG-INFO +102 -0
- cz_path-0.0.1/README.md +75 -0
- cz_path-0.0.1/cz_path/__init__.py +4 -0
- cz_path-0.0.1/cz_path/plugin.py +113 -0
- cz_path-0.0.1/cz_path/py.typed +0 -0
- cz_path-0.0.1/pyproject.toml +330 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 cz-path authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
7
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
8
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or
|
|
12
|
+
substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
15
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
17
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
|
18
|
+
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
cz_path-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: cz-path
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: commitizen,commit messages,git,version control
|
|
7
|
+
Author: Andrew Udvare
|
|
8
|
+
Author-email: audvare@gmail.com
|
|
9
|
+
Requires-Python: >=3.10,<3.14
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: commitizen (>=4.8.3,<5.0.0)
|
|
19
|
+
Requires-Dist: gitpython (>=3.1.44,<4.0.0)
|
|
20
|
+
Requires-Dist: typing-extensions (>=4.14.0,<5.0.0)
|
|
21
|
+
Project-URL: Documentation, https://cz-path.readthedocs.org
|
|
22
|
+
Project-URL: Homepage, https://tatsh.github.io/cz-path/
|
|
23
|
+
Project-URL: Issues, https://github.com/Tatsh/cz-path/issues
|
|
24
|
+
Project-URL: Repository, https://github.com/Tatsh/cz-path
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# cz-path
|
|
28
|
+
|
|
29
|
+
[](https://www.python.org/)
|
|
30
|
+
[](https://pypi.org/project/cz-path/)
|
|
31
|
+
[](https://github.com/Tatsh/cz-path/tags)
|
|
32
|
+
[](https://github.com/Tatsh/cz-path/blob/master/LICENSE.txt)
|
|
33
|
+
[](https://github.com/Tatsh/cz-path/compare/v0.0.1...master)
|
|
34
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/codeql.yml)
|
|
35
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/qa.yml)
|
|
36
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/tests.yml)
|
|
37
|
+
[](https://coveralls.io/github/Tatsh/cz-path?branch=master)
|
|
38
|
+
[](https://cz-path.readthedocs.org/?badge=latest)
|
|
39
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
40
|
+
[](http://mypy-lang.org/)
|
|
41
|
+
[](https://github.com/astral-sh/ruff)
|
|
42
|
+
[](https://pepy.tech/project/cz-path)
|
|
43
|
+
[](https://github.com/Tatsh/cz-path/stargazers)
|
|
44
|
+
|
|
45
|
+
[](https://bsky.app/profile/Tatsh.bsky.social)
|
|
46
|
+
[](https://hostux.social/@Tatsh)
|
|
47
|
+
|
|
48
|
+
Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
### Poetry
|
|
53
|
+
|
|
54
|
+
Example with `dev` group:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
poetry add -G dev cz-path
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Pip
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
pip install cz-path
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
Pass `-n cz_path` to `cz` or add it to your configuration file.
|
|
69
|
+
|
|
70
|
+
By default, `src/` will be removed from any determined prefix. This can be customised by setting
|
|
71
|
+
`remove_path_prefixes` to `[]`. You also may want to add other locations such as a module name.
|
|
72
|
+
Adding `/` is not required.
|
|
73
|
+
|
|
74
|
+
### `pyproject.toml`
|
|
75
|
+
|
|
76
|
+
```toml
|
|
77
|
+
[tool.commitizen]
|
|
78
|
+
name = "cz_path"
|
|
79
|
+
remove_path_prefixes = ["src", "module_name"]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `.cz.json`
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"commitizen": {
|
|
87
|
+
"name": "cz_path",
|
|
88
|
+
"remove_path_prefixes": ["src", "module_name"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Scenarios
|
|
94
|
+
|
|
95
|
+
| Staged files | Path prefix | String prefix |
|
|
96
|
+
| ---------------------- | ----------- | ------------- |
|
|
97
|
+
| `src/a.c`, `src/b.c` | `src` | `src/` |
|
|
98
|
+
| `src/a1.c`, `src/a2.c` | `src` | `src/a` |
|
|
99
|
+
| `a.c`, `b.c` | (no option) | (no option) |
|
|
100
|
+
|
|
101
|
+
If no prefix is found amongst the staged files, only the choices `project` and empty will be given.
|
|
102
|
+
|
cz_path-0.0.1/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# cz-path
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/)
|
|
4
|
+
[](https://pypi.org/project/cz-path/)
|
|
5
|
+
[](https://github.com/Tatsh/cz-path/tags)
|
|
6
|
+
[](https://github.com/Tatsh/cz-path/blob/master/LICENSE.txt)
|
|
7
|
+
[](https://github.com/Tatsh/cz-path/compare/v0.0.1...master)
|
|
8
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/codeql.yml)
|
|
9
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/qa.yml)
|
|
10
|
+
[](https://github.com/Tatsh/cz-path/actions/workflows/tests.yml)
|
|
11
|
+
[](https://coveralls.io/github/Tatsh/cz-path?branch=master)
|
|
12
|
+
[](https://cz-path.readthedocs.org/?badge=latest)
|
|
13
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
14
|
+
[](http://mypy-lang.org/)
|
|
15
|
+
[](https://github.com/astral-sh/ruff)
|
|
16
|
+
[](https://pepy.tech/project/cz-path)
|
|
17
|
+
[](https://github.com/Tatsh/cz-path/stargazers)
|
|
18
|
+
|
|
19
|
+
[](https://bsky.app/profile/Tatsh.bsky.social)
|
|
20
|
+
[](https://hostux.social/@Tatsh)
|
|
21
|
+
|
|
22
|
+
Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Poetry
|
|
27
|
+
|
|
28
|
+
Example with `dev` group:
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
poetry add -G dev cz-path
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Pip
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
pip install cz-path
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
Pass `-n cz_path` to `cz` or add it to your configuration file.
|
|
43
|
+
|
|
44
|
+
By default, `src/` will be removed from any determined prefix. This can be customised by setting
|
|
45
|
+
`remove_path_prefixes` to `[]`. You also may want to add other locations such as a module name.
|
|
46
|
+
Adding `/` is not required.
|
|
47
|
+
|
|
48
|
+
### `pyproject.toml`
|
|
49
|
+
|
|
50
|
+
```toml
|
|
51
|
+
[tool.commitizen]
|
|
52
|
+
name = "cz_path"
|
|
53
|
+
remove_path_prefixes = ["src", "module_name"]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### `.cz.json`
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"commitizen": {
|
|
61
|
+
"name": "cz_path",
|
|
62
|
+
"remove_path_prefixes": ["src", "module_name"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Scenarios
|
|
68
|
+
|
|
69
|
+
| Staged files | Path prefix | String prefix |
|
|
70
|
+
| ---------------------- | ----------- | ------------- |
|
|
71
|
+
| `src/a.c`, `src/b.c` | `src` | `src/` |
|
|
72
|
+
| `src/a1.c`, `src/a2.c` | `src` | `src/a` |
|
|
73
|
+
| `a.c`, `b.c` | (no option) | (no option) |
|
|
74
|
+
|
|
75
|
+
If no prefix is found amongst the staged files, only the choices `project` and empty will be given.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Main module for the plugin."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
6
|
+
import os.path
|
|
7
|
+
|
|
8
|
+
from commitizen.cz.base import BaseCommitizen
|
|
9
|
+
from commitizen.cz.exceptions import CzException
|
|
10
|
+
from git import Diff, Repo
|
|
11
|
+
from typing_extensions import override
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from collections.abc import Iterable, Mapping
|
|
15
|
+
|
|
16
|
+
from commitizen.question import Choice, ConfirmQuestion, InputQuestion, ListQuestion
|
|
17
|
+
|
|
18
|
+
__all__ = ('PathCommitizen',)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _parse_diffs(diffs: Iterable[Diff]) -> Iterable[str]:
|
|
22
|
+
for diff in diffs:
|
|
23
|
+
assert diff.a_path is not None
|
|
24
|
+
which = Path(diff.a_path)
|
|
25
|
+
if diff.renamed_file:
|
|
26
|
+
assert diff.b_path is not None
|
|
27
|
+
which = Path(diff.b_path)
|
|
28
|
+
base, _, rest = which.name.partition('.')
|
|
29
|
+
if not base and rest:
|
|
30
|
+
# `.cz.json` -> `cz`
|
|
31
|
+
# `.gitignore` -> `gitignore`
|
|
32
|
+
base = rest if '.' not in rest else '.'.join(rest.split('.')[:-1])
|
|
33
|
+
yield str(which.with_name(base))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _get_staged_files() -> Iterable[str]:
|
|
37
|
+
staged_files = Repo('.').index.diff('HEAD')
|
|
38
|
+
if not staged_files:
|
|
39
|
+
raise NoStagedFilesError
|
|
40
|
+
return _parse_diffs(staged_files)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _get_common_path() -> str:
|
|
44
|
+
return os.path.commonpath(_get_staged_files())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _get_common_prefix() -> str:
|
|
48
|
+
return os.path.commonprefix(list(_get_staged_files()))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class NoStagedFilesError(CzException):
|
|
52
|
+
"""Exception raised when there are no staged files for commit."""
|
|
53
|
+
def __init__(self) -> None:
|
|
54
|
+
super().__init__('No staged files found. Please stage files before committing.')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class PathCommitizen(BaseCommitizen):
|
|
58
|
+
"""cz-path commitizen class."""
|
|
59
|
+
@override
|
|
60
|
+
def questions(self) -> Iterable[ListQuestion | InputQuestion | ConfirmQuestion]:
|
|
61
|
+
post_remove_path_prefixes = [
|
|
62
|
+
x.rstrip('/')
|
|
63
|
+
for x in cast('Iterable[str]', self.config.settings.get('remove_path_prefixes', (
|
|
64
|
+
'src',)))
|
|
65
|
+
]
|
|
66
|
+
common_path = _get_common_path()
|
|
67
|
+
common_prefix = _get_common_prefix()
|
|
68
|
+
choices: list[Choice] = []
|
|
69
|
+
if common_path:
|
|
70
|
+
for prefix in post_remove_path_prefixes:
|
|
71
|
+
common_path = common_path.removeprefix(f'{prefix}/')
|
|
72
|
+
common_path = common_path.lower()
|
|
73
|
+
choices.append({'value': common_path, 'name': common_path, 'key': 'p'})
|
|
74
|
+
if common_prefix:
|
|
75
|
+
for prefix in post_remove_path_prefixes:
|
|
76
|
+
common_prefix = common_prefix.removeprefix(f'{prefix}/')
|
|
77
|
+
common_prefix = common_prefix.lower()
|
|
78
|
+
choices.append({'value': common_prefix, 'name': common_prefix, 'key': 'r'})
|
|
79
|
+
return ({
|
|
80
|
+
'type':
|
|
81
|
+
'list',
|
|
82
|
+
'name':
|
|
83
|
+
'prefix',
|
|
84
|
+
'message':
|
|
85
|
+
'Prefix:',
|
|
86
|
+
'choices': [
|
|
87
|
+
*choices, {
|
|
88
|
+
'value': 'project',
|
|
89
|
+
'name': 'project',
|
|
90
|
+
'key': 'o'
|
|
91
|
+
}, {
|
|
92
|
+
'value': '',
|
|
93
|
+
'name': '(empty)',
|
|
94
|
+
'key': 'n'
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}, {
|
|
98
|
+
'type': 'input',
|
|
99
|
+
'name': 'title',
|
|
100
|
+
'message': 'Commit title:'
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
@override
|
|
104
|
+
def example(self) -> str:
|
|
105
|
+
return 'module/component: short description of the change'
|
|
106
|
+
|
|
107
|
+
@override
|
|
108
|
+
def schema(self) -> str:
|
|
109
|
+
return '<prefix>: <schema>'
|
|
110
|
+
|
|
111
|
+
@override
|
|
112
|
+
def message(self, answers: Mapping[str, Any]) -> str:
|
|
113
|
+
return f'{answers["prefix"]}: {answers.get("title", "(no message provided)")}'
|
|
File without changes
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "poetry.core.masonry.api"
|
|
3
|
+
requires = ["poetry-core"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
classifiers = [
|
|
7
|
+
"Development Status :: 4 - Beta",
|
|
8
|
+
"Intended Audience :: Developers",
|
|
9
|
+
"Programming Language :: Python",
|
|
10
|
+
"Programming Language :: Python :: 3.10",
|
|
11
|
+
"Programming Language :: Python :: 3.11",
|
|
12
|
+
"Programming Language :: Python :: 3.12",
|
|
13
|
+
"Programming Language :: Python :: 3.13",
|
|
14
|
+
"Typing :: Typed",
|
|
15
|
+
]
|
|
16
|
+
description = "Commitizen plugin that prefixes commit messages with the common path or prefix of staged files."
|
|
17
|
+
dynamic = ["dependencies", "requires-python"]
|
|
18
|
+
keywords = ["commitizen", "commit messages", "git", "version control"]
|
|
19
|
+
license = "MIT"
|
|
20
|
+
name = "cz-path"
|
|
21
|
+
readme = "README.md"
|
|
22
|
+
version = "0.0.1"
|
|
23
|
+
|
|
24
|
+
[[project.authors]]
|
|
25
|
+
email = "audvare@gmail.com"
|
|
26
|
+
name = "Andrew Udvare"
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Issues = "https://github.com/Tatsh/cz-path/issues"
|
|
32
|
+
documentation = "https://cz-path.readthedocs.org"
|
|
33
|
+
homepage = "https://tatsh.github.io/cz-path/"
|
|
34
|
+
repository = "https://github.com/Tatsh/cz-path"
|
|
35
|
+
|
|
36
|
+
[tool.commitizen]
|
|
37
|
+
name = "cz_path"
|
|
38
|
+
remove_path_prefixes = ["cz_path"]
|
|
39
|
+
tag_format = "v$version"
|
|
40
|
+
version_files = [
|
|
41
|
+
".wiswa.jsonnet",
|
|
42
|
+
"CITATION.cff",
|
|
43
|
+
"README.md",
|
|
44
|
+
"docs/index.rst",
|
|
45
|
+
"package.json",
|
|
46
|
+
"cz_path/__init__.py",
|
|
47
|
+
]
|
|
48
|
+
version_provider = "pep621"
|
|
49
|
+
|
|
50
|
+
[tool.coverage.report]
|
|
51
|
+
exclude_also = ["if TYPE_CHECKING:"]
|
|
52
|
+
omit = ["conftest.py", "tests.py", "tests/test_*.py"]
|
|
53
|
+
show_missing = true
|
|
54
|
+
|
|
55
|
+
[tool.coverage.run]
|
|
56
|
+
branch = true
|
|
57
|
+
omit = ["conftest.py", "tests.py", "tests/test_*.py"]
|
|
58
|
+
|
|
59
|
+
[tool.djlint]
|
|
60
|
+
max_line_length = 100
|
|
61
|
+
no_line_after_yaml = true
|
|
62
|
+
preserve_blank_lines = true
|
|
63
|
+
preserve_leading_space = true
|
|
64
|
+
profile = "jinja"
|
|
65
|
+
use_gitignore = true
|
|
66
|
+
|
|
67
|
+
[tool.doc8]
|
|
68
|
+
max-line-length = 100
|
|
69
|
+
|
|
70
|
+
[tool.mypy]
|
|
71
|
+
cache_dir = "~/.cache/mypy"
|
|
72
|
+
explicit_package_bases = true
|
|
73
|
+
platform = "linux"
|
|
74
|
+
python_version = "3.10"
|
|
75
|
+
show_column_numbers = true
|
|
76
|
+
strict = true
|
|
77
|
+
strict_optional = true
|
|
78
|
+
warn_unreachable = true
|
|
79
|
+
|
|
80
|
+
[tool.poetry.dependencies]
|
|
81
|
+
commitizen = "^4.8.3"
|
|
82
|
+
gitpython = "^3.1.44"
|
|
83
|
+
python = ">=3.10,<3.14"
|
|
84
|
+
typing-extensions = "^4.14.0"
|
|
85
|
+
|
|
86
|
+
[tool.poetry.group.dev]
|
|
87
|
+
optional = true
|
|
88
|
+
|
|
89
|
+
[tool.poetry.group.dev.dependencies]
|
|
90
|
+
commitizen = "^4.8.3"
|
|
91
|
+
djlint = "^1.36.4"
|
|
92
|
+
mypy = "^1.16.1"
|
|
93
|
+
ruff = "^0.12.0"
|
|
94
|
+
yapf = "^0.43.0"
|
|
95
|
+
|
|
96
|
+
[tool.poetry.group.docs]
|
|
97
|
+
optional = true
|
|
98
|
+
|
|
99
|
+
[tool.poetry.group.docs.dependencies]
|
|
100
|
+
autodoc-pydantic = "^2.2.0"
|
|
101
|
+
doc8 = "^2.0.0"
|
|
102
|
+
docutils = "^0.21.2"
|
|
103
|
+
esbonio = "^0.16.5"
|
|
104
|
+
numpydoc = "^1.8.0"
|
|
105
|
+
restructuredtext-lint = "^1.4.0"
|
|
106
|
+
sphinx-click = "^6.0.0"
|
|
107
|
+
sphinx-datatables = "^0.3.0"
|
|
108
|
+
sphinx-hoverxref = "^1.4.2"
|
|
109
|
+
sphinx-immaterial = "^0.13.5"
|
|
110
|
+
|
|
111
|
+
[tool.poetry.group.docs.dependencies.enum-tools]
|
|
112
|
+
extras = ["sphinx"]
|
|
113
|
+
version = "^0.13.0"
|
|
114
|
+
|
|
115
|
+
[[tool.poetry.group.docs.dependencies.sphinx]]
|
|
116
|
+
python = ">=3.11"
|
|
117
|
+
version = "^8.2.3"
|
|
118
|
+
|
|
119
|
+
[[tool.poetry.group.docs.dependencies.sphinx]]
|
|
120
|
+
python = "<3.11"
|
|
121
|
+
version = "^7.2.5"
|
|
122
|
+
|
|
123
|
+
[tool.poetry.group.tests]
|
|
124
|
+
optional = true
|
|
125
|
+
|
|
126
|
+
[tool.poetry.group.tests.dependencies]
|
|
127
|
+
mock = "^5.2.0"
|
|
128
|
+
pytest = "^8.4.0"
|
|
129
|
+
pytest-cov = "^6.2.1"
|
|
130
|
+
pytest-mock = "^3.14.1"
|
|
131
|
+
|
|
132
|
+
[tool.poetry.group.tests.dependencies.coveralls]
|
|
133
|
+
python = "<3.13"
|
|
134
|
+
version = "^4.0.1"
|
|
135
|
+
|
|
136
|
+
[[tool.poetry.packages]]
|
|
137
|
+
include = "cz_path"
|
|
138
|
+
|
|
139
|
+
[tool.poetry.plugins."commitizen.plugin"]
|
|
140
|
+
cz_path = "cz_path.plugin:PathCommitizen"
|
|
141
|
+
|
|
142
|
+
[tool.pyright]
|
|
143
|
+
deprecateTypingAliases = true
|
|
144
|
+
enableExperimentalFeatures = true
|
|
145
|
+
include = ["./cz_path", "./tests"]
|
|
146
|
+
pythonPlatform = "Linux"
|
|
147
|
+
pythonVersion = "3.10"
|
|
148
|
+
reportCallInDefaultInitializer = "warning"
|
|
149
|
+
reportImplicitOverride = "warning"
|
|
150
|
+
reportImportCycles = "error"
|
|
151
|
+
reportMissingModuleSource = "error"
|
|
152
|
+
reportPropertyTypeMismatch = "error"
|
|
153
|
+
reportShadowedImports = "error"
|
|
154
|
+
reportUnnecessaryTypeIgnoreComment = "none"
|
|
155
|
+
typeCheckingMode = "off"
|
|
156
|
+
useLibraryCodeForTypes = false
|
|
157
|
+
|
|
158
|
+
[tool.pytest.ini_options]
|
|
159
|
+
mock_use_standalone_module = true
|
|
160
|
+
norecursedirs = ["node_modules"]
|
|
161
|
+
python_files = ["tests.py", "test_*.py", "*_tests.py"]
|
|
162
|
+
testpaths = ["tests"]
|
|
163
|
+
|
|
164
|
+
[tool.ruff]
|
|
165
|
+
cache-dir = "~/.cache/ruff"
|
|
166
|
+
force-exclude = true
|
|
167
|
+
line-length = 100
|
|
168
|
+
namespace-packages = ["docs", "tests"]
|
|
169
|
+
target-version = "py310"
|
|
170
|
+
unsafe-fixes = true
|
|
171
|
+
|
|
172
|
+
[tool.ruff.lint]
|
|
173
|
+
extend-select = [
|
|
174
|
+
"A",
|
|
175
|
+
"AIR",
|
|
176
|
+
"ANN",
|
|
177
|
+
"ARG",
|
|
178
|
+
"ASYNC",
|
|
179
|
+
"B",
|
|
180
|
+
"BLE",
|
|
181
|
+
"C4",
|
|
182
|
+
"C90",
|
|
183
|
+
"COM",
|
|
184
|
+
"CPY",
|
|
185
|
+
"D",
|
|
186
|
+
"DJ",
|
|
187
|
+
"DOC",
|
|
188
|
+
"DTZ",
|
|
189
|
+
"E",
|
|
190
|
+
"EM",
|
|
191
|
+
"ERA",
|
|
192
|
+
"EXE",
|
|
193
|
+
"F",
|
|
194
|
+
"FA",
|
|
195
|
+
"FAST",
|
|
196
|
+
"FBT",
|
|
197
|
+
"FIX",
|
|
198
|
+
"FLY",
|
|
199
|
+
"FURB",
|
|
200
|
+
"G",
|
|
201
|
+
"I",
|
|
202
|
+
"ICN",
|
|
203
|
+
"INP",
|
|
204
|
+
"INT",
|
|
205
|
+
"ISC",
|
|
206
|
+
"LOG",
|
|
207
|
+
"N",
|
|
208
|
+
"NPY",
|
|
209
|
+
"PD",
|
|
210
|
+
"PERF",
|
|
211
|
+
"PGH",
|
|
212
|
+
"PIE",
|
|
213
|
+
"PL",
|
|
214
|
+
"PT",
|
|
215
|
+
"PTH",
|
|
216
|
+
"PYI",
|
|
217
|
+
"Q",
|
|
218
|
+
"RET",
|
|
219
|
+
"RSE",
|
|
220
|
+
"RUF",
|
|
221
|
+
"S",
|
|
222
|
+
"SIM",
|
|
223
|
+
"SLF",
|
|
224
|
+
"SLOT",
|
|
225
|
+
"T10",
|
|
226
|
+
"T20",
|
|
227
|
+
"TC",
|
|
228
|
+
"TD",
|
|
229
|
+
"TID",
|
|
230
|
+
"TRY",
|
|
231
|
+
"UP",
|
|
232
|
+
"W",
|
|
233
|
+
"YTT",
|
|
234
|
+
]
|
|
235
|
+
ignore = [
|
|
236
|
+
"ANN401",
|
|
237
|
+
"COM812",
|
|
238
|
+
"CPY001",
|
|
239
|
+
"D201",
|
|
240
|
+
"D203",
|
|
241
|
+
"D204",
|
|
242
|
+
"D212",
|
|
243
|
+
"DOC201",
|
|
244
|
+
"N818",
|
|
245
|
+
"S101",
|
|
246
|
+
"S404",
|
|
247
|
+
"S603",
|
|
248
|
+
"TD002",
|
|
249
|
+
"UP046",
|
|
250
|
+
"UP047",
|
|
251
|
+
]
|
|
252
|
+
preview = true
|
|
253
|
+
|
|
254
|
+
[tool.ruff.lint.flake8-builtins]
|
|
255
|
+
allowed-modules = ["typing", "types"]
|
|
256
|
+
|
|
257
|
+
[tool.ruff.lint.flake8-quotes]
|
|
258
|
+
inline-quotes = "single"
|
|
259
|
+
multiline-quotes = "double"
|
|
260
|
+
|
|
261
|
+
[tool.ruff.lint.isort]
|
|
262
|
+
case-sensitive = true
|
|
263
|
+
combine-as-imports = true
|
|
264
|
+
from-first = true
|
|
265
|
+
required-imports = ["from __future__ import annotations"]
|
|
266
|
+
section-order = ["future", "standard-library", "third-party", "local-folder"]
|
|
267
|
+
|
|
268
|
+
[tool.ruff.lint.mccabe]
|
|
269
|
+
max-complexity = 20
|
|
270
|
+
|
|
271
|
+
[tool.ruff.lint.pep8-naming]
|
|
272
|
+
extend-ignore-names = ["test_*"]
|
|
273
|
+
|
|
274
|
+
[tool.ruff.lint.per-file-ignores]
|
|
275
|
+
"main.py" = ["PLR0913"]
|
|
276
|
+
|
|
277
|
+
[tool.ruff.lint.pydocstyle]
|
|
278
|
+
convention = "numpy"
|
|
279
|
+
|
|
280
|
+
[tool.ruff.lint.pylint]
|
|
281
|
+
max-branches = 20
|
|
282
|
+
|
|
283
|
+
[tool.yapf]
|
|
284
|
+
align_closing_bracket_with_visual_indent = true
|
|
285
|
+
allow_multiline_dictionary_keys = false
|
|
286
|
+
allow_multiline_lambdas = false
|
|
287
|
+
allow_split_before_dict_value = true
|
|
288
|
+
blank_line_before_class_docstring = false
|
|
289
|
+
blank_line_before_module_docstring = false
|
|
290
|
+
blank_line_before_nested_class_or_def = false
|
|
291
|
+
blank_lines_around_top_level_definition = 2
|
|
292
|
+
coalesce_brackets = true
|
|
293
|
+
column_limit = 100
|
|
294
|
+
continuation_align_style = "SPACE"
|
|
295
|
+
continuation_indent_width = 4
|
|
296
|
+
dedent_closing_brackets = false
|
|
297
|
+
disable_ending_comma_heuristic = false
|
|
298
|
+
each_dict_entry_on_separate_line = true
|
|
299
|
+
indent_dictionary_value = true
|
|
300
|
+
indent_width = 4
|
|
301
|
+
join_multiple_lines = true
|
|
302
|
+
no_spaces_around_selected_binary_operators = false
|
|
303
|
+
space_between_ending_comma_and_closing_bracket = false
|
|
304
|
+
spaces_around_default_or_named_assign = false
|
|
305
|
+
spaces_around_power_operator = true
|
|
306
|
+
spaces_before_comment = 2
|
|
307
|
+
split_all_comma_separated_values = false
|
|
308
|
+
split_arguments_when_comma_terminated = false
|
|
309
|
+
split_before_bitwise_operator = true
|
|
310
|
+
split_before_closing_bracket = true
|
|
311
|
+
split_before_dict_set_generator = true
|
|
312
|
+
split_before_dot = false
|
|
313
|
+
split_before_expression_after_opening_paren = false
|
|
314
|
+
split_before_first_argument = false
|
|
315
|
+
split_before_logical_operator = true
|
|
316
|
+
split_before_named_assigns = true
|
|
317
|
+
split_complex_comprehension = false
|
|
318
|
+
split_penalty_after_opening_bracket = 30
|
|
319
|
+
split_penalty_after_unary_operator = 10000
|
|
320
|
+
split_penalty_before_if_expr = 0
|
|
321
|
+
split_penalty_bitwise_operator = 300
|
|
322
|
+
split_penalty_comprehension = 80
|
|
323
|
+
split_penalty_excess_character = 7000
|
|
324
|
+
split_penalty_for_added_line_split = 30
|
|
325
|
+
split_penalty_import_names = 0
|
|
326
|
+
split_penalty_logical_operator = 300
|
|
327
|
+
use_tabs = false
|
|
328
|
+
|
|
329
|
+
[tool.yapfignore]
|
|
330
|
+
ignore_patterns = ["node_modules/**"]
|