Skip to content

Commit 082aae7

Browse files
jaracowarsaw
authored andcommitted
Make 'Distribution' official
1 parent 1e2724e commit 082aae7

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

importlib_metadata/docs/using.rst

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,40 +56,6 @@ You can also get a :ref:`distribution's version number <version>`, list its
5656
:ref:`requirements`_.
5757

5858

59-
Distributions
60-
=============
61-
62-
.. CAUTION:: The ``Distribution`` class described here may or may not end up
63-
in the final stable public API. Consider this class `provisional
64-
<https://www.python.org/dev/peps/pep-0411/>`_ until the 1.0
65-
release.
66-
67-
While the above API is the most common and convenient usage, you can get all
68-
of that information from the ``Distribution`` class. A ``Distribution`` is an
69-
abstract object that represents the metadata for a Python package. You can
70-
get the ``Distribution`` instance::
71-
72-
>>> from importlib_metadata import distribution
73-
>>> dist = distribution('wheel')
74-
75-
Thus, an alternative way to get the version number is through the
76-
``Distribution`` instance::
77-
78-
>>> dist.version
79-
'0.32.3'
80-
81-
There are all kinds of additional metadata available on the ``Distribution``
82-
instance::
83-
84-
>>> d.metadata['Requires-Python']
85-
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
86-
>>> d.metadata['License']
87-
'MIT'
88-
89-
The full set of available metadata is not described here. See `PEP 566
90-
<https://www.python.org/dev/peps/pep-0566/>`_ for additional details.
91-
92-
9359
Functional API
9460
==============
9561

@@ -198,6 +164,34 @@ function. Note that this returns an iterator::
198164
["pytest (>=3.0.0) ; extra == 'test'"]
199165

200166

167+
Distributions
168+
=============
169+
170+
While the above API is the most common and convenient usage, you can get all
171+
of that information from the ``Distribution`` class. A ``Distribution`` is an
172+
abstract object that represents the metadata for a Python package. You can
173+
get the ``Distribution`` instance::
174+
175+
>>> from importlib_metadata import distribution
176+
>>> dist = distribution('wheel')
177+
178+
Thus, an alternative way to get the version number is through the
179+
``Distribution`` instance::
180+
181+
>>> dist.version
182+
'0.32.3'
183+
184+
There are all kinds of additional metadata available on the ``Distribution``
185+
instance::
186+
187+
>>> d.metadata['Requires-Python']
188+
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
189+
>>> d.metadata['License']
190+
'MIT'
191+
192+
The full set of available metadata is not described here. See `PEP 566
193+
<https://www.python.org/dev/peps/pep-0566/>`_ for additional details.
194+
201195

202196
Extending the search algorithm
203197
==============================

0 commit comments

Comments
 (0)