dependence 1.2.6__py3-none-any.whl → 1.2.7__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/freeze.py CHANGED
@@ -268,7 +268,27 @@ def _iter_frozen_requirements(
268
268
  if keep_version_specifier and any(
269
269
  fnmatch(name, pattern) for pattern in keep_version_specifier
270
270
  ):
271
- distribution_names_specifiers[name] = requirement_string.rstrip()
271
+ existing_requirement_string: str | None = (
272
+ distribution_names_specifiers.get(name)
273
+ )
274
+ requirement_string = requirement_string.rstrip()
275
+ # Prioritize requirement strings which don't include environment
276
+ # markers over those that do, and prefer more specific requirement
277
+ # strings (longer ones) over less specific requirement strings
278
+ if (
279
+ (not existing_requirement_string)
280
+ or (
281
+ (";" in existing_requirement_string)
282
+ == (";" in requirement_string)
283
+ and len(existing_requirement_string)
284
+ < len(requirement_string)
285
+ )
286
+ or (
287
+ ";" in existing_requirement_string
288
+ and ";" not in requirement_string
289
+ )
290
+ ):
291
+ distribution_names_specifiers[name] = requirement_string
272
292
  distribution_names: MutableSet[str] = {name}
273
293
  if (depth_ is None) or depth_:
274
294
  distribution_names |= get_required_distribution_names(
@@ -306,6 +326,7 @@ def freeze(
306
326
  depth: int | None = None,
307
327
  include_pointers: tuple[str, ...] = (),
308
328
  exclude_pointers: tuple[str, ...] = (),
329
+ keep_version_specifier: Iterable[str] = (),
309
330
  ) -> None:
310
331
  """
311
332
  Print the (frozen) requirements for one or more specified requirements or
@@ -343,6 +364,7 @@ def freeze(
343
364
  depth=depth,
344
365
  include_pointers=include_pointers,
345
366
  exclude_pointers=exclude_pointers,
367
+ keep_version_specifier=keep_version_specifier,
346
368
  )
347
369
  )
348
370
  )
@@ -413,6 +435,18 @@ def main() -> None:
413
435
  "value must be single-quoted if it contains wildcards)"
414
436
  ),
415
437
  )
438
+ parser.add_argument(
439
+ "-kvs",
440
+ "--keep-version-specifier",
441
+ type=str,
442
+ default=[],
443
+ action="append",
444
+ help=(
445
+ "Don't freeze versions (instead retain the most specific version "
446
+ "specifier) for packages matching this/these glob pattern(s) "
447
+ "(note: the value must be single-quoted if it contains wildcards)"
448
+ ),
449
+ )
416
450
  parser.add_argument(
417
451
  "-do",
418
452
  "--dependency-order",
@@ -461,6 +495,7 @@ def main() -> None:
461
495
  iter_parse_delimited_values(namespace.exclude_recursive)
462
496
  ),
463
497
  no_version=namespace.no_version,
498
+ keep_version_specifier=namespace.keep_version_specifier,
464
499
  dependency_order=namespace.dependency_order,
465
500
  depth=namespace.depth,
466
501
  include_pointers=tuple(namespace.include_pointer),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dependence
3
- Version: 1.2.6
3
+ Version: 1.2.7
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
@@ -1,11 +1,11 @@
1
1
  dependence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  dependence/__main__.py,sha256=gsluad-hgMvktrflSNLEMB3F-G_BKvlIGTHL0c1aQd8,1822
3
3
  dependence/_utilities.py,sha256=DqERa9O_RXEklq34y1rDrRXqWit9yz-W-WSG1KG4aWk,39120
4
- dependence/freeze.py,sha256=ybjHOQOzxtuVjJQOUr1077CoMGSGdho3iKj8waygwuQ,17516
4
+ dependence/freeze.py,sha256=IAJr34cpLX5iYdCLa0E2P3IhuUKvif90SAW4ITghQpE,18990
5
5
  dependence/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  dependence/update.py,sha256=KGNj-COhRnbxGVAUikBKdUgJCz0xZ741Z6HEBny7diQ,20852
7
7
  dependence/upgrade.py,sha256=nyOahgBJayeVeicM4AJ72lp2uDMvJOcCNUZIhVKk1do,7882
8
- dependence-1.2.6.dist-info/METADATA,sha256=5V2BE-DyDCimRZ7oqAg4mTgzuM9BeMSksP9hYkX2XOg,8366
9
- dependence-1.2.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
10
- dependence-1.2.6.dist-info/entry_points.txt,sha256=NStO_B0D81ObVYr9zDs6LCy0whm0a8KCiiFHMmTwOVE,56
11
- dependence-1.2.6.dist-info/RECORD,,
8
+ dependence-1.2.7.dist-info/METADATA,sha256=jMnylfWZ3MbmC3xFdORWi3JbyPaAtYcNyh_Sj_xlyU4,8366
9
+ dependence-1.2.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
10
+ dependence-1.2.7.dist-info/entry_points.txt,sha256=NStO_B0D81ObVYr9zDs6LCy0whm0a8KCiiFHMmTwOVE,56
11
+ dependence-1.2.7.dist-info/RECORD,,