dependence 1.2.0__tar.gz → 1.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dependence
3
- Version: 1.2.0
3
+ Version: 1.2.2
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.2
16
+ Requires-Dist: tomli~=2.3
17
17
  Description-Content-Type: text/markdown
18
18
 
19
19
  # dependence
@@ -55,6 +55,7 @@ def main() -> None:
55
55
  except ImportError:
56
56
  print(get_exception_text()) # noqa: T201
57
57
  _print_help()
58
+ sys.exit(1)
58
59
 
59
60
 
60
61
  if __name__ == "__main__":
@@ -81,6 +81,7 @@ def get_frozen_requirements( # noqa: C901
81
81
  *,
82
82
  exclude: Iterable[str] = (),
83
83
  exclude_recursive: Iterable[str] = (),
84
+ keep_version_specifier: Iterable[str] = (),
84
85
  no_version: Iterable[str] = (),
85
86
  dependency_order: bool = False,
86
87
  reverse: bool = False,
@@ -101,8 +102,14 @@ def get_frozen_requirements( # noqa: C901
101
102
  exclude_recursive: One or more distributions to exclude/ignore.
102
103
  Note: Excluding a distribution here excludes all requirements which
103
104
  would be identified through recursion.
105
+ keep_version_specifier: Keep the original (non-frozen) version
106
+ specifier for package names matching any of these patterns. This
107
+ supercedes `no_version`, if both sets of patterns match a package
108
+ name.
104
109
  no_version: Exclude version numbers from the output
105
- (only return distribution names)
110
+ (only return distribution names). This is superceded by
111
+ `keep_version_specifier`, if both sets of patterns match a package
112
+ name.
106
113
  dependency_order: Sort requirements so that dependents
107
114
  precede dependencies
108
115
  depth: Depth of recursive requirement discovery
@@ -119,6 +126,10 @@ def get_frozen_requirements( # noqa: C901
119
126
  no_version = (no_version,)
120
127
  elif not isinstance(no_version, tuple):
121
128
  no_version = tuple(no_version)
129
+ if isinstance(keep_version_specifier, str):
130
+ keep_version_specifier = (keep_version_specifier,)
131
+ elif not isinstance(keep_version_specifier, tuple):
132
+ keep_version_specifier = tuple(keep_version_specifier)
122
133
  # Separate requirement strings from requirement files
123
134
  configuration_files: dict[str, dict[str, tuple[str, ...]]] = {}
124
135
  requirement_strings: MutableSet[str] = set()
@@ -191,6 +202,7 @@ def get_frozen_requirements( # noqa: C901
191
202
  ),
192
203
  exclude_recursive=set(map(normalize_name, exclude_recursive)),
193
204
  no_version=no_version,
205
+ keep_version_specifier=keep_version_specifier,
194
206
  depth=depth,
195
207
  )
196
208
  if dependency_order:
@@ -217,13 +229,20 @@ def _iter_frozen_requirements(
217
229
  exclude_recursive: MutableSet[str],
218
230
  no_version: Iterable[str] = (),
219
231
  depth: int | None = None,
232
+ keep_version_specifier: Iterable[str] = (),
220
233
  ) -> Iterable[str]:
221
- def get_requirement_string(distribution_name: str) -> str | None:
222
- def distribution_name_matches_pattern(pattern: str) -> bool:
223
- return fnmatch(distribution_name, pattern)
234
+ # This retains a mapping of distribution names to their original
235
+ # requirement strings in order to return those which match
236
+ # `keep_version_specifier` patterns with their original specifiers
237
+ distribution_names_specifiers: dict[str, str] = {}
224
238
 
239
+ def get_requirement_string(distribution_name: str) -> str | None:
240
+ if distribution_names_specifiers and (
241
+ distribution_name in distribution_names_specifiers
242
+ ):
243
+ return distribution_names_specifiers[distribution_name]
225
244
  if (distribution_name in _DO_NOT_PIN_DISTRIBUTION_NAMES) or any(
226
- map(distribution_name_matches_pattern, no_version)
245
+ fnmatch(distribution_name, pattern) for pattern in no_version
227
246
  ):
228
247
  return distribution_name
229
248
  distribution: Distribution
@@ -246,6 +265,10 @@ def _iter_frozen_requirements(
246
265
  )
247
266
  if name in exclude_recursive:
248
267
  return set()
268
+ if keep_version_specifier and any(
269
+ fnmatch(name, pattern) for pattern in keep_version_specifier
270
+ ):
271
+ distribution_names_specifiers[name] = requirement_string
249
272
  distribution_names: MutableSet[str] = {name}
250
273
  if (depth_ is None) or depth_:
251
274
  distribution_names |= get_required_distribution_names(
@@ -72,6 +72,7 @@ def upgrade(
72
72
  requirements,
73
73
  exclude=exclude,
74
74
  exclude_recursive=exclude_recursive,
75
+ keep_version_specifier="*",
75
76
  no_version="*",
76
77
  depth=depth,
77
78
  include_pointers=include_pointers,
@@ -1,22 +1,29 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
2
+ requires = [
3
+ "hatchling",
4
+ ]
3
5
  build-backend = "hatchling.build"
4
6
 
5
7
  [project]
6
8
  name = "dependence"
7
- version = "1.2.0"
9
+ version = "1.2.2"
8
10
  description = "A dependency management tool for python projects"
9
11
  readme = "README.md"
10
12
  license = "MIT"
11
13
  requires-python = "~=3.9"
12
- authors = [{ email = "david@belais.me" }]
13
- keywords = ["dependencies", "requirements"]
14
+ authors = [
15
+ { email = "david@belais.me" },
16
+ ]
17
+ keywords = [
18
+ "dependencies",
19
+ "requirements",
20
+ ]
14
21
  dependencies = [
15
22
  "packaging",
16
23
  "pip",
17
24
  "setuptools>63",
18
25
  "tomli-w~=1.2",
19
- "tomli~=2.2",
26
+ "tomli~=2.3",
20
27
  "jsonpointer",
21
28
  ]
22
29
 
@@ -28,50 +35,87 @@ Documentation = "https://dependence.enorganic.org"
28
35
  Repository = "https://github.com/enorganic/dependence"
29
36
 
30
37
  [tool.hatch.build.targets.sdist]
31
- packages = ["src/dependence"]
38
+ packages = [
39
+ "src/dependence",
40
+ ]
32
41
 
33
42
  [tool.hatch.build.targets.sdist.sources]
34
43
  src = ""
35
44
 
36
45
  [tool.hatch.build.targets.wheel]
37
- packages = ["src/dependence"]
46
+ packages = [
47
+ "src/dependence",
48
+ ]
38
49
 
39
50
  [tool.hatch.build.targets.wheel.sources]
40
51
  src = ""
41
52
 
42
53
  [tool.hatch.envs.default]
43
54
  python = "3.9"
44
- dependencies = ["mypy", "pytest", "ruff"]
45
- pre-install-commands = ["pip install --upgrade pip setuptools"]
55
+ dependencies = [
56
+ "mypy",
57
+ "pytest",
58
+ "ruff",
59
+ ]
60
+ pre-install-commands = [
61
+ "uv pip install --upgrade pip setuptools",
62
+ ]
46
63
  post-install-commands = [
47
64
  "hatch run mypy --install-types --non-interactive || echo",
48
65
  ]
49
66
 
50
- [tool.hatch.envs.default.scripts]
51
- lint = "ruff check . && ruff format --check . && mypy"
52
-
53
67
  [tool.hatch.envs.docs]
54
68
  template = "docs"
55
69
  python = "3.13"
56
- dependencies = ["mkdocs-material", "mkdocstrings[python]", "black"]
70
+ dependencies = [
71
+ "mkdocs-material",
72
+ "mkdocstrings[python]",
73
+ "black",
74
+ ]
57
75
 
58
76
  [tool.hatch.envs.hatch-static-analysis]
59
77
  skip-install = false
60
78
 
61
79
  [tool.hatch.envs.hatch-test]
62
80
  template = "hatch-test"
63
- extra-dependencies = ["ruff", "mypy", "flake8", "tox", "black"]
64
- extra-arguments = ["--cache-clear"]
81
+ extra-dependencies = [
82
+ "ruff",
83
+ "mypy",
84
+ "flake8",
85
+ "tox",
86
+ "black",
87
+ ]
88
+ extra-arguments = [
89
+ "--cache-clear",
90
+ ]
65
91
 
66
92
  [[tool.hatch.envs.hatch-test.matrix]]
67
- python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
93
+ python = [
94
+ "3.9",
95
+ "3.10",
96
+ "3.11",
97
+ "3.12",
98
+ "3.13",
99
+ ]
68
100
 
69
101
  [tool.ruff]
70
102
  line-length = 79
71
103
 
72
104
  [tool.ruff.lint]
73
- ignore = ["F842", "INP001"]
74
- extend-select = ["E", "F", "UP", "B", "SIM", "I", "C", "N"]
105
+ ignore = [
106
+ "F842",
107
+ "INP001",
108
+ ]
109
+ extend-select = [
110
+ "E",
111
+ "F",
112
+ "UP",
113
+ "B",
114
+ "SIM",
115
+ "I",
116
+ "C",
117
+ "N",
118
+ ]
75
119
 
76
120
  [tool.ruff.lint.mccabe]
77
121
  max-complexity = 10
@@ -82,21 +126,38 @@ docstring-code-line-length = 20
82
126
 
83
127
  [tool.black]
84
128
  line-length = 79
85
- target-version = ["py39", "py310", "py311", "py312", "py313"]
129
+ target-version = [
130
+ "py39",
131
+ "py310",
132
+ "py311",
133
+ "py312",
134
+ "py313",
135
+ ]
86
136
 
87
137
  [tool.mypy]
88
138
  python_version = "3.9"
89
- files = ["src", "tests"]
90
- exclude = ["tests/test_projects"]
139
+ files = [
140
+ "src",
141
+ "tests",
142
+ ]
143
+ exclude = [
144
+ "tests/test_projects",
145
+ ]
91
146
  disallow_untyped_defs = true
92
147
  disallow_incomplete_defs = true
93
148
 
94
149
  [tool.coverage.run]
95
- include = ["src/**/*.py"]
96
- omit = ["src/**/_*.py"]
150
+ include = [
151
+ "src/**/*.py",
152
+ ]
153
+ omit = [
154
+ "src/**/_*.py",
155
+ ]
97
156
 
98
157
  [tool.coverage.paths]
99
- source = ["src/**"]
158
+ source = [
159
+ "src/**",
160
+ ]
100
161
 
101
162
  [tool.coverage.report]
102
163
  fail_under = 70
File without changes
File without changes