text stringlengths 0 888 |
|---|
tomli-w==1.2.0 |
truststore==0.10.4 |
dependency-groups==1.3.1 |
Pluggable Distributions of Python Software |
========================================== |
Distributions |
------------- |
A "Distribution" is a collection of files that represent a "Release" of a |
"Project" as of a particular point in time, denoted by a |
"Version":: |
>>> import sys, pkg_resources |
>>> from pkg_resources import Distribution |
>>> Distribution(project_name="Foo", version="1.2") |
Foo 1.2 |
Distributions have a location, which can be a filename, URL, or really anything |
else you care to use:: |
>>> dist = Distribution( |
... location="http://example.com/something", |
... project_name="Bar", version="0.9" |
... ) |
>>> dist |
Bar 0.9 (http://example.com/something) |
Distributions have various introspectable attributes:: |
>>> dist.location |
'http://example.com/something' |
>>> dist.project_name |
'Bar' |
>>> dist.version |
'0.9' |
>>> dist.py_version == '{}.{}'.format(*sys.version_info) |
True |
>>> print(dist.platform) |
None |
Including various computed attributes:: |
>>> from pkg_resources import parse_version |
>>> dist.parsed_version == parse_version(dist.version) |
True |
>>> dist.key # case-insensitive form of the project name |
'bar' |
Distributions are compared (and hashed) by version first:: |
>>> Distribution(version='1.0') == Distribution(version='1.0') |
True |
>>> Distribution(version='1.0') == Distribution(version='1.1') |
False |
>>> Distribution(version='1.0') < Distribution(version='1.1') |
True |
but also by project name (case-insensitive), platform, Python version, |
location, etc.:: |
>>> Distribution(project_name="Foo",version="1.0") == \ |
... Distribution(project_name="Foo",version="1.0") |
True |
>>> Distribution(project_name="Foo",version="1.0") == \ |
... Distribution(project_name="foo",version="1.0") |
True |
>>> Distribution(project_name="Foo",version="1.0") == \ |
... Distribution(project_name="Foo",version="1.1") |
False |
>>> Distribution(project_name="Foo",py_version="2.3",version="1.0") == \ |
... Distribution(project_name="Foo",py_version="2.4",version="1.0") |
False |
>>> Distribution(location="spam",version="1.0") == \ |
... Distribution(location="spam",version="1.0") |
True |
>>> Distribution(location="spam",version="1.0") == \ |
... Distribution(location="baz",version="1.0") |
False |
Hash and compare distribution by prio/plat |
Get version from metadata |
provider capabilities |
egg_name() |
as_requirement() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.