dependence 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl
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/_utilities.py +13 -1
- dependence/freeze.py +3 -5
- dependence/update.py +3 -4
- dependence/utilities.py +10 -7
- {dependence-0.2.0.dist-info → dependence-0.3.0.dist-info}/METADATA +1 -2
- dependence-0.3.0.dist-info/RECORD +12 -0
- dependence-0.2.0.dist-info/RECORD +0 -12
- {dependence-0.2.0.dist-info → dependence-0.3.0.dist-info}/WHEEL +0 -0
- {dependence-0.2.0.dist-info → dependence-0.3.0.dist-info}/entry_points.txt +0 -0
- {dependence-0.2.0.dist-info → dependence-0.3.0.dist-info}/top_level.txt +0 -0
dependence/_utilities.py
CHANGED
|
@@ -2,11 +2,23 @@ import sys
|
|
|
2
2
|
from functools import lru_cache
|
|
3
3
|
from itertools import chain
|
|
4
4
|
from traceback import format_exception
|
|
5
|
-
from typing import Any, Dict, Iterable, List
|
|
5
|
+
from typing import Any, Dict, Hashable, Iterable, List, Set
|
|
6
6
|
|
|
7
7
|
import tomli
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
def iter_distinct(items: Iterable[Hashable]) -> Iterable:
|
|
11
|
+
"""
|
|
12
|
+
Yield distinct elements, preserving order
|
|
13
|
+
"""
|
|
14
|
+
visited: Set[Hashable] = set()
|
|
15
|
+
item: Hashable
|
|
16
|
+
for item in items:
|
|
17
|
+
if item not in visited:
|
|
18
|
+
visited.add(item)
|
|
19
|
+
yield item
|
|
20
|
+
|
|
21
|
+
|
|
10
22
|
@lru_cache()
|
|
11
23
|
def pyproject_toml_defines_project(pyproject_toml_path: str) -> bool:
|
|
12
24
|
pyproject: Dict[str, Any]
|
dependence/freeze.py
CHANGED
|
@@ -5,9 +5,7 @@ from importlib.metadata import distribution as _get_distribution
|
|
|
5
5
|
from itertools import chain
|
|
6
6
|
from typing import Dict, Iterable, MutableSet, Optional, Tuple, cast
|
|
7
7
|
|
|
8
|
-
from
|
|
9
|
-
|
|
10
|
-
from ._utilities import iter_parse_delimited_values
|
|
8
|
+
from ._utilities import iter_distinct, iter_parse_delimited_values
|
|
11
9
|
from .utilities import (
|
|
12
10
|
get_distribution,
|
|
13
11
|
get_required_distribution_names,
|
|
@@ -113,7 +111,7 @@ def get_frozen_requirements(
|
|
|
113
111
|
requirement_strings: MutableSet[str] = cast(
|
|
114
112
|
MutableSet[str], requirements - requirement_files
|
|
115
113
|
)
|
|
116
|
-
frozen_requirements: Iterable[str] =
|
|
114
|
+
frozen_requirements: Iterable[str] = iter_distinct(
|
|
117
115
|
chain(
|
|
118
116
|
requirement_strings,
|
|
119
117
|
*map(
|
|
@@ -213,7 +211,7 @@ def _iter_frozen_requirements(
|
|
|
213
211
|
)
|
|
214
212
|
|
|
215
213
|
distribution_names: MutableSet[str]
|
|
216
|
-
requirements: Iterable[str] =
|
|
214
|
+
requirements: Iterable[str] = iter_distinct(
|
|
217
215
|
chain(
|
|
218
216
|
*map(
|
|
219
217
|
lambda distribution_names: get_required_distribution_names_(
|
dependence/update.py
CHANGED
|
@@ -21,13 +21,12 @@ from typing import (
|
|
|
21
21
|
|
|
22
22
|
import tomli
|
|
23
23
|
import tomli_w
|
|
24
|
-
from more_itertools import unique_everseen
|
|
25
24
|
from packaging.requirements import Requirement
|
|
26
25
|
from packaging.specifiers import Specifier, SpecifierSet
|
|
27
26
|
from packaging.version import Version
|
|
28
27
|
from packaging.version import parse as parse_version
|
|
29
28
|
|
|
30
|
-
from ._utilities import iter_parse_delimited_values
|
|
29
|
+
from ._utilities import iter_distinct, iter_parse_delimited_values
|
|
31
30
|
from .utilities import (
|
|
32
31
|
get_installed_distributions,
|
|
33
32
|
is_requirement_string,
|
|
@@ -230,7 +229,7 @@ def get_updated_setup_cfg(
|
|
|
230
229
|
# We pre-pend an empty requirement string in order to]
|
|
231
230
|
# force new-line creation at the beginning of the extra
|
|
232
231
|
extras_require[all_extra_name] = "\n".join(
|
|
233
|
-
|
|
232
|
+
iter_distinct([""] + all_extra_requirements)
|
|
234
233
|
)
|
|
235
234
|
# Return as a string
|
|
236
235
|
setup_cfg: str
|
|
@@ -369,7 +368,7 @@ def get_updated_pyproject_toml(
|
|
|
369
368
|
project_optional_dependencies[extra_name] = extra_requirements
|
|
370
369
|
if all_extra_name:
|
|
371
370
|
project_optional_dependencies[all_extra_name] = list(
|
|
372
|
-
|
|
371
|
+
iter_distinct(all_extra_requirements)
|
|
373
372
|
)
|
|
374
373
|
if (
|
|
375
374
|
build_system_requires
|
dependence/utilities.py
CHANGED
|
@@ -32,11 +32,14 @@ from typing import (
|
|
|
32
32
|
from warnings import warn
|
|
33
33
|
|
|
34
34
|
import tomli
|
|
35
|
-
from more_itertools import unique_everseen
|
|
36
35
|
from packaging.requirements import InvalidRequirement, Requirement
|
|
37
36
|
from packaging.utils import canonicalize_name
|
|
38
37
|
|
|
39
|
-
from ._utilities import
|
|
38
|
+
from ._utilities import (
|
|
39
|
+
append_exception_text,
|
|
40
|
+
get_exception_text,
|
|
41
|
+
iter_distinct,
|
|
42
|
+
)
|
|
40
43
|
|
|
41
44
|
_BUILTIN_DISTRIBUTION_NAMES: Tuple[str] = ("distribute",)
|
|
42
45
|
|
|
@@ -330,7 +333,7 @@ def _iter_setup_cfg_requirement_strings(path: str) -> Iterable[str]:
|
|
|
330
333
|
extra_requirements_string.split("\n"),
|
|
331
334
|
),
|
|
332
335
|
)
|
|
333
|
-
return
|
|
336
|
+
return iter_distinct(requirement_strings)
|
|
334
337
|
|
|
335
338
|
|
|
336
339
|
def _iter_tox_ini_requirement_strings(path: str) -> Iterable[str]:
|
|
@@ -358,7 +361,7 @@ def _iter_tox_ini_requirement_strings(path: str) -> Iterable[str]:
|
|
|
358
361
|
)
|
|
359
362
|
return requirements
|
|
360
363
|
|
|
361
|
-
return
|
|
364
|
+
return iter_distinct(
|
|
362
365
|
chain(("tox",), *map(get_section_requirements, parser.sections()))
|
|
363
366
|
)
|
|
364
367
|
|
|
@@ -836,7 +839,7 @@ def _iter_requirement_names(
|
|
|
836
839
|
if distribution is None:
|
|
837
840
|
return ()
|
|
838
841
|
requirements: Tuple[Requirement, ...] = tuple(
|
|
839
|
-
|
|
842
|
+
iter_distinct(
|
|
840
843
|
_iter_distribution_requirements(
|
|
841
844
|
distribution,
|
|
842
845
|
extras=extras,
|
|
@@ -918,7 +921,7 @@ def _iter_requirement_strings_required_distribution_names(
|
|
|
918
921
|
pass
|
|
919
922
|
return set()
|
|
920
923
|
|
|
921
|
-
return
|
|
924
|
+
return iter_distinct(
|
|
922
925
|
chain(*map(get_required_distribution_names_, requirement_strings)),
|
|
923
926
|
)
|
|
924
927
|
|
|
@@ -951,7 +954,7 @@ def get_requirements_required_distribution_names(
|
|
|
951
954
|
name: str
|
|
952
955
|
return set(
|
|
953
956
|
_iter_requirement_strings_required_distribution_names(
|
|
954
|
-
|
|
957
|
+
iter_distinct(
|
|
955
958
|
chain(
|
|
956
959
|
requirement_strings,
|
|
957
960
|
*map(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dependence
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Requirement (dependency) management for python projects
|
|
5
5
|
Home-page: https://github.com/enorganic/dependence
|
|
6
6
|
Author-email: david@belais.me
|
|
@@ -12,7 +12,6 @@ Requires-Dist: packaging
|
|
|
12
12
|
Requires-Dist: pip
|
|
13
13
|
Requires-Dist: tomli ~=2.0
|
|
14
14
|
Requires-Dist: tomli-w ~=1.0
|
|
15
|
-
Requires-Dist: more-itertools >7
|
|
16
15
|
Requires-Dist: setuptools >63
|
|
17
16
|
|
|
18
17
|
# dependence
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
dependence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
dependence/__main__.py,sha256=myBIBZdez2jC3_dkVSE-mOLo39yKi2cF_0NuVXcXF1E,1528
|
|
3
|
+
dependence/_utilities.py,sha256=txNRK5Y7Dd7w8-qG7wGmS6mrAcGvy73DIjAHswW4glA,2684
|
|
4
|
+
dependence/freeze.py,sha256=kGT1Kjr7QeKMqXEO03cg4CD4s_rOc3khjJla_822gOk,13299
|
|
5
|
+
dependence/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
dependence/update.py,sha256=FRl0FsdAIfjWacw1cVS8Fh024ZN7hK3ZHJiQpsRinfQ,16571
|
|
7
|
+
dependence/utilities.py,sha256=8QdX2_O-Qdc-dh-qpi76KuykEROpvKZrApNOzOTaO8I,31816
|
|
8
|
+
dependence-0.3.0.dist-info/METADATA,sha256=Yzr2gGfOu3qEQ9pCgIaAUFqWvB6cU0N8GHzG8JmEIac,5597
|
|
9
|
+
dependence-0.3.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
10
|
+
dependence-0.3.0.dist-info/entry_points.txt,sha256=NStO_B0D81ObVYr9zDs6LCy0whm0a8KCiiFHMmTwOVE,56
|
|
11
|
+
dependence-0.3.0.dist-info/top_level.txt,sha256=5rooMYWKlAUelE8hjGegbf4uuAIqNuRlhlpA7oc7Qro,11
|
|
12
|
+
dependence-0.3.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
dependence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
dependence/__main__.py,sha256=myBIBZdez2jC3_dkVSE-mOLo39yKi2cF_0NuVXcXF1E,1528
|
|
3
|
-
dependence/_utilities.py,sha256=pGK9JAMOAVGvamo4Espmk0NUftosW7UxZnwWXbNM47w,2385
|
|
4
|
-
dependence/freeze.py,sha256=BCbqXNMReXX5N5S0FJK_bqSZCOHOIh2ti0m-4Klzpxc,13332
|
|
5
|
-
dependence/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
dependence/update.py,sha256=9TIU4JC1M-RHZfXYxeAmtbXS_lAFy_Z9sy8Ce1PTz4g,16603
|
|
7
|
-
dependence/utilities.py,sha256=Lo3guZSA7a2gARz3RzEqLenbG6VTWcA5-eucHB9S-58,31837
|
|
8
|
-
dependence-0.2.0.dist-info/METADATA,sha256=H-olY5qur_SwQupzfKeK-OofgWYt2UKg8sEorub_0Q4,5630
|
|
9
|
-
dependence-0.2.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
10
|
-
dependence-0.2.0.dist-info/entry_points.txt,sha256=NStO_B0D81ObVYr9zDs6LCy0whm0a8KCiiFHMmTwOVE,56
|
|
11
|
-
dependence-0.2.0.dist-info/top_level.txt,sha256=5rooMYWKlAUelE8hjGegbf4uuAIqNuRlhlpA7oc7Qro,11
|
|
12
|
-
dependence-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|