Skip to content

Commit a6038c3

Browse files
committed
Add an example of how a custom provider might leverage the DistributionFinder.Context.
1 parent 8635240 commit a6038c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

importlib_metadata/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,17 @@ class Context:
667667
Each DistributionFinder may expect any parameters
668668
and should attempt to honor the canonical
669669
parameters defined below when appropriate.
670+
671+
This mechanism gives a custom provider a means to
672+
solicit additional details from the caller beyond
673+
"name" and "path" when searching distributions.
674+
For example, imagine a provider that exposes suites
675+
of packages in either a "public" or "private" ``realm``.
676+
A caller may wish to query only for distributions in
677+
a particular realm and could call
678+
``distributions(realm="private")`` to signal to the
679+
custom provider to only include distributions from that
680+
realm.
670681
"""
671682

672683
name = None

0 commit comments

Comments
 (0)