-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin system #91
base: main
Are you sure you want to change the base?
Plugin system #91
Changes from all commits
d13b135
54d7e18
552a169
399aa58
50ef9fe
2dc8ef5
e57ce92
64de12b
4b8672f
a2a1f9e
361601a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
======= | ||
Plugins | ||
======= | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could use a small writeup of what plugins are in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. I'll write something up once I'm fully happy with the plugin system. |
||
|
||
.. py:decorator:: rez_pip.plugins.hookimpl | ||
|
||
Decorator used to register a plugin hook. | ||
|
||
Hooks | ||
===== | ||
|
||
.. py:function:: prePipResolve(packages: list[str], requirements: list[str]) -> None | ||
|
||
The pre-pip resolve hook allows a plugin to run some checks *before* resolving the | ||
requested packages using pip. The hook **must** not modify the content of the | ||
arguments passed to it. | ||
|
||
Some use cases are allowing or disallowing the installation of some packages. | ||
|
||
:param packages: List of packages requested by the user. | ||
:param requirements: List of `requirements files <https://pip.pypa.io/en/stable/reference/requirements-file-format/#requirements-file-format>`_ if any. | ||
|
||
.. py:function:: postPipResolve(packages: list[rez_pip.pip.PackageInfo]) -> None | ||
|
||
The post-pip resolve hook allows a plugin to run some checks *after* resolving the | ||
requested packages using pip. The hook **must** not modify the content of the | ||
arguments passed to it. | ||
|
||
Some use cases are allowing or disallowing the installation of some packages. | ||
|
||
:param packages: List of resolved packages. | ||
|
||
.. py:function:: groupPackages(packages: list[rez_pip.pip.PackageInfo]) -> list[rez_pip.pip.PackageGroup]: | ||
|
||
Merge packages into groups of packages. The name and version of the first package | ||
in the group will be used as the name and version for the rez package. | ||
|
||
The hook **must** pop grouped packages out of the "packages" variable. | ||
|
||
:param packages: List of resolved packages. | ||
:returns: A list of package groups. | ||
|
||
.. py:function:: metadata(package: rez.package_maker.PackageMaker) -> None | ||
|
||
Modify/inject metadata in the rez package. The plugin is expected to modify | ||
"package" in place. | ||
|
||
:param package: An instanciate PackageMaker. | ||
|
||
.. py:function:: cleanup(dist: importlib.metadata.Distribution, path: str) -> None | ||
|
||
Cleanup a package post-installation. | ||
|
||
:param dist: Python distribution. | ||
:param path: Root path of the rez variant. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import sys | ||
|
||
if sys.version_info <= (3, 8): | ||
from typing import Sequence, MutableSequence, Mapping | ||
else: | ||
from collections.abc import Sequence, MutableSequence, Mapping | ||
|
||
if sys.version_info >= (3, 10): | ||
import importlib.metadata as importlib_metadata | ||
else: | ||
import importlib_metadata | ||
|
||
__all__ = ["Sequence", "MutableSequence", "Mapping", "importlib_metadata"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we are wanting to keep commented out or remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember the exact reason I did this, but I remember that it was causing issues. I'll probably have to investigate this more to remember why I changed that.