dependence 1.2.7__tar.gz → 1.3.0__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.
- {dependence-1.2.7 → dependence-1.3.0}/PKG-INFO +2 -2
- {dependence-1.2.7 → dependence-1.3.0}/dependence/update.py +16 -23
- {dependence-1.2.7 → dependence-1.3.0}/pyproject.toml +2 -2
- {dependence-1.2.7 → dependence-1.3.0}/.gitignore +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/README.md +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/__init__.py +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/__main__.py +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/_utilities.py +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/freeze.py +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/py.typed +0 -0
- {dependence-1.2.7 → dependence-1.3.0}/dependence/upgrade.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dependence
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A dependency management tool for python projects
|
|
5
5
|
Project-URL: Documentation, https://dependence.enorganic.org
|
|
6
6
|
Project-URL: Repository, https://github.com/enorganic/dependence
|
|
@@ -13,7 +13,7 @@ Requires-Dist: packaging
|
|
|
13
13
|
Requires-Dist: pip
|
|
14
14
|
Requires-Dist: setuptools>63
|
|
15
15
|
Requires-Dist: tomli-w~=1.2
|
|
16
|
-
Requires-Dist: tomli~=2.
|
|
16
|
+
Requires-Dist: tomli~=2.4
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
|
|
19
19
|
# dependence
|
|
@@ -6,6 +6,7 @@ from collections import deque
|
|
|
6
6
|
from configparser import ConfigParser, SectionProxy
|
|
7
7
|
from copy import deepcopy
|
|
8
8
|
from dataclasses import dataclass
|
|
9
|
+
from fnmatch import fnmatch
|
|
9
10
|
from io import StringIO
|
|
10
11
|
from itertools import chain
|
|
11
12
|
from pathlib import Path
|
|
@@ -117,7 +118,7 @@ def _update_requirement_specifiers(
|
|
|
117
118
|
|
|
118
119
|
|
|
119
120
|
def _get_updated_requirement_string(
|
|
120
|
-
requirement_string: str, ignore:
|
|
121
|
+
requirement_string: str, ignore: Iterable[str]
|
|
121
122
|
) -> str:
|
|
122
123
|
"""
|
|
123
124
|
This function updates version numbers in a requirement string to match
|
|
@@ -128,7 +129,8 @@ def _get_updated_requirement_string(
|
|
|
128
129
|
return requirement_string
|
|
129
130
|
requirement: Requirement = Requirement(requirement_string)
|
|
130
131
|
name: str = normalize_name(requirement.name)
|
|
131
|
-
|
|
132
|
+
pattern: str
|
|
133
|
+
if ignore and any(fnmatch(name, pattern) for pattern in ignore):
|
|
132
134
|
return requirement_string
|
|
133
135
|
try:
|
|
134
136
|
distribution: Distribution = get_installed_distributions()[name]
|
|
@@ -147,15 +149,6 @@ def _get_updated_requirement_string(
|
|
|
147
149
|
return str(requirement)
|
|
148
150
|
|
|
149
151
|
|
|
150
|
-
def _normalize_ignore_argument(ignore: Iterable[str]) -> set[str]:
|
|
151
|
-
ignore_set: set[str]
|
|
152
|
-
# Normalize/harmonize excluded project names
|
|
153
|
-
if isinstance(ignore, str):
|
|
154
|
-
ignore = (ignore,)
|
|
155
|
-
ignore_set = set(map(normalize_name, ignore))
|
|
156
|
-
return ignore_set
|
|
157
|
-
|
|
158
|
-
|
|
159
152
|
def _get_updated_requirements_txt(
|
|
160
153
|
data: str, ignore: Iterable[str] = ()
|
|
161
154
|
) -> str:
|
|
@@ -169,10 +162,10 @@ def _get_updated_requirements_txt(
|
|
|
169
162
|
- data (str): The contents of a *requirements.txt* file
|
|
170
163
|
- ignore ([str]): One or more project names to leave as-is
|
|
171
164
|
"""
|
|
172
|
-
|
|
165
|
+
ignore = (ignore,) if isinstance(ignore, str) else ignore
|
|
173
166
|
|
|
174
167
|
def get_updated_requirement_string(requirement: str) -> str:
|
|
175
|
-
return _get_updated_requirement_string(requirement, ignore=
|
|
168
|
+
return _get_updated_requirement_string(requirement, ignore=ignore)
|
|
176
169
|
|
|
177
170
|
return "\n".join(map(get_updated_requirement_string, data.split("\n")))
|
|
178
171
|
|
|
@@ -188,14 +181,14 @@ def _get_updated_setup_cfg(
|
|
|
188
181
|
Parameters:
|
|
189
182
|
|
|
190
183
|
- data (str): The contents of a *setup.cfg* file
|
|
191
|
-
- ignore ([str]): One or more project names to leave as-is
|
|
184
|
+
- ignore ([str]): One or more project names or patterns to leave as-is
|
|
192
185
|
- all_extra_name (str): An (optional) extra name which will
|
|
193
186
|
consolidate requirements from all other extras
|
|
194
187
|
"""
|
|
195
|
-
|
|
188
|
+
ignore = (ignore,) if isinstance(ignore, str) else ignore
|
|
196
189
|
|
|
197
190
|
def get_updated_requirement_string(requirement: str) -> str:
|
|
198
|
-
return _get_updated_requirement_string(requirement, ignore=
|
|
191
|
+
return _get_updated_requirement_string(requirement, ignore=ignore)
|
|
199
192
|
|
|
200
193
|
# Parse
|
|
201
194
|
parser: ConfigParser = ConfigParser()
|
|
@@ -254,14 +247,14 @@ def _get_updated_tox_ini(data: str, ignore: Iterable[str] = ()) -> str:
|
|
|
254
247
|
- data (str): The contents of a **tox.ini** file
|
|
255
248
|
- ignore ([str]): One or more project names to leave as-is
|
|
256
249
|
"""
|
|
257
|
-
|
|
250
|
+
ignore = (ignore,) if isinstance(ignore, str) else ignore
|
|
258
251
|
|
|
259
252
|
def get_updated_requirement_string(requirement: str) -> str:
|
|
260
253
|
prefix: str | None = None
|
|
261
254
|
if ":" in requirement:
|
|
262
255
|
prefix, requirement = requirement.split(":", maxsplit=1)
|
|
263
256
|
requirement = _get_updated_requirement_string(
|
|
264
|
-
requirement, ignore=
|
|
257
|
+
requirement, ignore=ignore
|
|
265
258
|
)
|
|
266
259
|
if prefix is not None:
|
|
267
260
|
requirement = f"{prefix}: {requirement.lstrip()}"
|
|
@@ -307,10 +300,10 @@ def _update_document_requirements(
|
|
|
307
300
|
include_pointers: tuple[str, ...] = (),
|
|
308
301
|
exclude_pointers: tuple[str, ...] = (),
|
|
309
302
|
) -> None:
|
|
310
|
-
|
|
303
|
+
ignore = (ignore,) if isinstance(ignore, str) else ignore
|
|
311
304
|
|
|
312
305
|
def get_updated_requirement_string(requirement: str) -> str:
|
|
313
|
-
return _get_updated_requirement_string(requirement, ignore=
|
|
306
|
+
return _get_updated_requirement_string(requirement, ignore=ignore)
|
|
314
307
|
|
|
315
308
|
# Find and update requirements
|
|
316
309
|
requirements_list: list[str]
|
|
@@ -499,7 +492,7 @@ def update(
|
|
|
499
492
|
Parameters:
|
|
500
493
|
paths: One or more local paths to a pyproject.toml,
|
|
501
494
|
setup.cfg, and/or requirements.txt files
|
|
502
|
-
ignore: One or more project/package names to ignore (leave
|
|
495
|
+
ignore: One or more project/package names or patterns to ignore (leave
|
|
503
496
|
as-is) when updating dependency requirement specifiers.
|
|
504
497
|
all_extra_name: If provided, an extra which consolidates
|
|
505
498
|
the requirements for all other extras will be added/updated to
|
|
@@ -544,8 +537,8 @@ def main() -> None:
|
|
|
544
537
|
type=str,
|
|
545
538
|
action="append",
|
|
546
539
|
help=(
|
|
547
|
-
"A comma-separated list of distributions to ignore
|
|
548
|
-
"any requirements pertaining to the package as-is) "
|
|
540
|
+
"A comma-separated list of distributions or patterns to ignore "
|
|
541
|
+
"(leave any requirements pertaining to the package as-is) "
|
|
549
542
|
),
|
|
550
543
|
)
|
|
551
544
|
parser.add_argument(
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "dependence"
|
|
9
|
-
version = "1.
|
|
9
|
+
version = "1.3.0"
|
|
10
10
|
description = "A dependency management tool for python projects"
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
license = "MIT"
|
|
@@ -23,7 +23,7 @@ dependencies = [
|
|
|
23
23
|
"pip",
|
|
24
24
|
"setuptools>63",
|
|
25
25
|
"tomli-w~=1.2",
|
|
26
|
-
"tomli~=2.
|
|
26
|
+
"tomli~=2.4",
|
|
27
27
|
"jsonpointer",
|
|
28
28
|
]
|
|
29
29
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|