MCPcopy
hub / github.com/jazzband/pip-tools / key_from_req

Function key_from_req

piptools/utils.py:69–83  ·  view source on GitHub ↗

Get an all-lowercase version of the requirement's name. **Note:** If the argument is an instance of ``pip._internal.resolution.resolvelib.base.Requirement`` (like ``pip._internal.resolution.resolvelib.requirements.SpecifierRequirement``), then the name might include an extras s

(req: InstallRequirement | Requirement | PipRequirement)

Source from the content-addressed store, hash-verified

67
68
69def key_from_req(req: InstallRequirement | Requirement | PipRequirement) -> str:
70 """
71 Get an all-lowercase version of the requirement's name.
72
73 **Note:** If the argument is an instance of
74 ``pip._internal.resolution.resolvelib.base.Requirement`` (like
75 ``pip._internal.resolution.resolvelib.requirements.SpecifierRequirement``),
76 then the name might include an extras specification.
77 Apply :py:func:`strip_extras` to the result of this function if you need
78 the package name only.
79
80 :param req: the requirement the key is computed for
81 :return: the canonical name of the requirement
82 """
83 return canonicalize_name(req.name)
84
85
86def comment(text: str) -> str:

Callers 6

key_from_ireqFunction · 0.85
_reverse_dependenciesMethod · 0.85
dependency_treeFunction · 0.85
_do_resolveMethod · 0.85

Calls 1

canonicalize_nameFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…