sitecustomize

sitecustomize.

Subpackages

Submodules

Package Contents

Classes

SimpleWarning

Functions

fifo_filter(ordered_list)

Remove duplicate entries from an ordered list,

entry_points(**params)

Return EntryPoint objects for all installed packages.

cancel()

No-op function to cancel registered entrypoints.

print_entrypoints([group_name, filtered])

print registered entrypoints.

Attributes

__version__

ENTRYPOINT_GROUPNAME

eps

sitecustomize.__version__ = '1.0.0'
class sitecustomize.SimpleWarning
__enter__()
__exit__(*args)
static simple_warning_format(msg, category, filename, lineno, file=None, line=None)

Simple warning-formatting.

sitecustomize.fifo_filter(ordered_list)

Remove duplicate entries from an ordered list, preserving initial ordering but removing previously seen entries.

Example

>>> fifo_filter([1, 2, 3, 1])
  [2, 3, 1]

This allows you to override the ordering of a registered entrypoint in your own pyproject.toml.

Parameters:

ordered_list (List[NamedObject]) –

Return type:

List[NamedObject]

sitecustomize.entry_points(**params)

Return EntryPoint objects for all installed packages.

Pass selection parameters (group or name) to filter the result to entry points matching those properties (see EntryPoints.select()).

For compatibility, returns SelectableGroups object unless selection parameters are supplied. In the future, this function will return EntryPoints instead of SelectableGroups even when no selection parameters are supplied.

For maximum future compatibility, pass selection parameters or invoke .select with parameters on the result.

Returns:

EntryPoints or SelectableGroups for all installed packages.

Return type:

Union[EntryPoints, SelectableGroups]

sitecustomize.ENTRYPOINT_GROUPNAME = 'sitecustomize'
sitecustomize.eps
sitecustomize.cancel()

No-op function to cancel registered entrypoints.

Imagine your project depends on a package that registers a sitecustomize-entrypoint:

In third third-party package:

[tool.poetry.plugins.”sitecustomize”] foo = “package_foo:foo”

And you register a sitecustomize-entrypoint in your own project:

[tool.poetry.plugins.”sitecustomize”] bar = “package_bar:bar”

You can guarantee the ordering, bv canceling the registered entrypoints and re-registering them in the order you want:

in our own pyproject.toml:

[tool.poetry.plugins.”sitecustomize”] foo = “sitecustomize:cancel” bar = “sitecustomize:cancel”

1_bar = “package_bar:bar” 2_foo = “package_foo:foo”

But please becautioned that the ordering in your pyproject.toml is irrelevant and that after parsing the names of entrypoints will be sorted alpanumerically. Therefore we advice to use integer-prefixes.

Return type:

None

sitecustomize.print_entrypoints(group_name=ENTRYPOINT_GROUPNAME, filtered=False)

print registered entrypoints.

Parameters:
  • group_name (str) –

  • filtered (bool) –