Various utilities... that could be moved to external projects.
Utilities related to networking.
Return True if host responds to ping before timeout.
Utilities related to packaging.
This module may be packaged as a standalone library.
Assert that distribution claims support for Python version.
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']
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']
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']
Return True if distribution claims support of version.
>>> 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