You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thus, an alternative way to get the version number is through the
444
-
:class:`!Distribution` instance::
480
+
The full set of available metadata is not described here.
481
+
See the PyPA `Core metadata specification <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ for additional details.
445
482
446
-
>>> dist.version # doctest: +SKIP
447
-
'0.32.3'
483
+
.. attribute:: origin
448
484
449
-
There are all kinds of additional metadata available on :class:`!Distribution`
450
-
instances::
485
+
For editable packages, an ``origin`` property may present :pep:`610`
486
+
metadata (for non-editable packages, ``origin`` is :const:`None`)::
The full set of available metadata is not described here.
464
-
See the PyPA `Core metadata specification <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ for additional details.
496
+
.. attribute:: entry_points
497
+
498
+
The :class:`!EntryPoints` provided by this distribution package.
499
+
500
+
.. attribute:: files
501
+
502
+
A sequence of :class:`!PackagePath`\s contained in this distribution package.
503
+
Like :func:`files`, this returns :const:`None` if there are no records.
504
+
505
+
.. method:: locate_file(path)
506
+
507
+
Like :meth:`!PackagePath.locate`, return a :class:`SimplePath` for the given path.
508
+
Takes a :class:`os.PathLike` or a :class:`str`.
509
+
510
+
.. method:: read_text(filename)
511
+
512
+
A shortcut for ``distribution.locate_file(filename).read_text()``.
465
513
466
-
.. versionadded:: 3.13
467
-
The ``.origin`` property was added.
514
+
.. _distribution-discovery:
468
515
469
516
Distribution Discovery
470
517
======================
@@ -575,8 +622,8 @@ consumer.
575
622
576
623
In practice, to support finding distribution package
577
624
metadata in locations other than the file system, subclass
578
-
``Distribution`` and implement the abstract methods. Then from
579
-
a custom finder, return instances of this derived ``Distribution`` in the
625
+
:class:`!Distribution` and implement the abstract methods. Then from
626
+
a custom finder, return instances of this derived :class:`!Distribution` in the
580
627
``find_distributions()`` method.
581
628
582
629
Example
@@ -653,8 +700,8 @@ packages served by the ``DatabaseImporter``, assuming that the
653
700
``.entry_points`` attributes.
654
701
655
702
The ``DatabaseDistribution`` may also provide other metadata files, like
656
-
``RECORD`` (required for ``Distribution.files``) or override the
657
-
implementation of ``Distribution.files``. See the source for more inspiration.
703
+
``RECORD`` (required for :attr:`!Distribution.files`) or override the
704
+
implementation of :attr:`!Distribution.files`. See the source for more inspiration.
658
705
659
706
660
707
.. _`entry point API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
0 commit comments