Utilities¶
A set of small, helper utilities for dealing with Python packages.
Reference¶
-
packaging.utils.
canonicalize_name
(name)[source]¶ This function takes a valid Python package name, and returns the normalized form of it.
- Parameters
name (str) – The name to normalize.
>>> from packaging.utils import canonicalize_name >>> canonicalize_name("Django") 'django' >>> canonicalize_name("oslo.concurrency") 'oslo-concurrency' >>> canonicalize_name("requests") 'requests'
-
packaging.utils.
canonicalize_version
(version)[source]¶ This function takes a string representing a package version (or a
Version
instance), and returns the normalized form of it.- Parameters
version (str) – The version to normalize.
>>> from packaging.utils import canonicalize_version >>> canonicalize_version('1.4.0.0.0') '1.4'