utils Package

utils Package

Various utilities... that could be moved to external projects.

packaging Module

Utilities related to packaging.

This module may be packaged as a standalone library.

hospital.utils.packaging.assert_supported_python_version(test_case, distribution, version=None)

Assert that distribution claims support for Python version.

distribution
Distribution object, as returned by pkg_resources.get_distribution().
version
Python version, as a string. If omitted or None (the default), the current Python version is retrieved from sys.version_info.
hospital.utils.packaging.get_classifiers(distribution)

Return list of classifiers metadata of distribution.

>>> import pkg_resources
>>> dist = pkg_resources.get_distribution('hospital')
>>> from hospital.utils.packaging import get_classifiers
>>> get_classifiers(dist)
['Development Status :: 3 - Alpha', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: Implementation :: CPython']
hospital.utils.packaging.get_metadata(distribution)

Return metadata of installed distribution, as a dictionary.

>>> import pkg_resources
>>> dist = pkg_resources.get_distribution('hospital')
>>> from hospital.utils.packaging import get_metadata
>>> metadata = get_metadata(dist)
>>> metadata['Name']
['hospital']
>>> metadata['License']
['BSD']
hospital.utils.packaging.get_supported_python_versions(distribution)

Return list of supported Python version of distribution.

>>> import pkg_resources
>>> dist = pkg_resources.get_distribution('hospital')
>>> from hospital.utils.packaging import get_supported_python_versions
>>> get_supported_python_versions(dist)
['2.6', '2.7']
hospital.utils.packaging.supports_python_version(distribution, version=None)

Return True if distribution claims support of version.

distribution
Distribution object, as returned by pkg_resources.get_distribution().
version
Python version, as a string. If omitted or None (the default), the current Python version is retrieved from sys.version_info.
>>> import pkg_resources
>>> dist = pkg_resources.get_distribution('hospital')
>>> from hospital.utils.packaging import supports_python_version
>>> supports_python_version(dist, '2.6')
True
>>> supports_python_version(dist, '2.5')
False
Read the Docs v: 0.1
Versions
latest
0.1
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.