Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin system #91

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Plugin system #91

wants to merge 11 commits into from

Conversation

JeanChristopheMorinPerso
Copy link
Owner

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Feb 3, 2024

Draft PR for visibility. It kind of works on Linux.

It adds a new plugin system with multiple hooks. There is an example plugin to add support for correctly installing PySide6>=6.3. The plugin takes care of merging all the PySide6 related packages (PySide6, PySide6-Addons and PySide6-Essentials) into one rez package. There is also a shiboken6 plugin that takes care of removing the vendored PySide6 stuff...

$ rez-pip2 PySide6 --prefix /tmp/asd --python 3.11 -- --find-links /tmp/wheels --no-index

$ rez-env PySide6 --paths ~/rez_packages:/tmp/asd -- python -c 'import PySide6,shiboken6; print(PySide6); print(shiboken6)'
<module 'PySide6' from '/tmp/asd/PySide6/6.6.1/9645a50b415bcaad6bcde791aeb0859a43c56501/python/PySide6/__init__.py'>
<module 'shiboken6' from '/tmp/asd/shiboken6/6.6.1/9645a50b415bcaad6bcde791aeb0859a43c56501/python/shiboken6/__init__.py'>

🎉

TODOs:

  • Add option to disable plugins/hooks
  • Test if builtin plugins can be overridden
  • Test on Windows
  • Write tests
  • Cleanup the code
  • Write docs (and automatically generate docs for builtin plugins).

src/rez_pip/rez.py Outdated Show resolved Hide resolved
src/rez_pip/plugins/__init__.py Outdated Show resolved Hide resolved
@@ -113,8 +136,8 @@ def make_root(variant: rez.packages.Variant, path: str) -> None:
pkg.pip = {
"name": dist.name,
"version": dist.version,
"is_pure_python": metadata["is_pure_python"],
"wheel_url": wheelURL,
"is_pure_python": isPure,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This annoys me. I don't think we really need this...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is annoying about it?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of useless and getting the value of "is pure" is annoying. Do you think I should keep it?

src/rez_pip/plugins/PySide6.py Outdated Show resolved Hide resolved
src/rez_pip/cli.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: Patch coverage is 67.32283% with 83 lines in your changes are missing coverage. Please review.

Project coverage is 77.46%. Comparing base (f3bd30f) to head (361601a).

Files Patch % Lines
src/rez_pip/plugins/PySide6.py 50.90% 19 Missing and 8 partials ⚠️
src/rez_pip/cli.py 26.92% 16 Missing and 3 partials ⚠️
src/rez_pip/pip.py 69.69% 9 Missing and 1 partial ⚠️
src/rez_pip/plugins/__init__.py 87.27% 5 Missing and 2 partials ⚠️
src/rez_pip/plugins/shiboken6.py 58.82% 5 Missing and 2 partials ⚠️
src/rez_pip/install.py 50.00% 4 Missing ⚠️
src/rez_pip/rez.py 87.50% 1 Missing and 3 partials ⚠️
src/rez_pip/utils.py 25.00% 2 Missing and 1 partial ⚠️
src/rez_pip/compat.py 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
- Coverage   81.25%   77.46%   -3.79%     
==========================================
  Files           8       12       +4     
  Lines         720      914     +194     
  Branches      150      207      +57     
==========================================
+ Hits          585      708     +123     
- Misses        119      173      +54     
- Partials       16       33      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Repository owner deleted a comment from sonarcloud bot Mar 6, 2024
@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title Initial commit adding a plugin system and a PySide6 plugin Plugin system Apr 28, 2024
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Copy link

@BryceGattis BryceGattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple questions/comments.

"rez": ("https://rez.readthedocs.io/en/stable/", None),
}

# Force usage of :external:
intersphinx_disabled_reftypes = ["*"]
# intersphinx_disabled_reftypes = ["*"]

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?

Copy link
Owner Author

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.

=======
Plugins
=======

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a small writeup of what plugins are in rez-pip and how they work at the top here.

Copy link
Owner Author

Choose a reason for hiding this comment

The 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.

self.__localPath = path


class PackageGroup:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What functionality does this new class provide?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mainly a convenience that saves me from having to use zip in multiple places. A package groups contains the grouped packages and also has their distribution objects. It's also slightly easier to work with a list of PackageGroup than a list of list. I first implemented the code without this class, and the result was 🍝.


On Windows, the PySide6/openssl folder has to be added to PATH, see https://inspector.pypi.io/project/pyside6/6.6.1/packages/ec/3d/1da1b88d74cb5318466156bac91f17ad4272c6c83a973e107ad9a9085009/PySide6-6.6.1-cp38-abi3-win_amd64.whl/PySide6/__init__.py#line.81.

So it's at least a 3 steps process:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you only listed 2 steps here 😆

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outdated I think

if typing.TYPE_CHECKING:
from rez_pip.compat import importlib_metadata

# PySide6 was initiall a single package that had shiboken as a dependency.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of typos in these comments.

packages: typing.List[str],
) -> None:
pyside6Seen = False
variantsSeens = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be variantsSeen?

@@ -113,8 +136,8 @@ def make_root(variant: rez.packages.Variant, path: str) -> None:
pkg.pip = {
"name": dist.name,
"version": dist.version,
"is_pure_python": metadata["is_pure_python"],
"wheel_url": wheelURL,
"is_pure_python": isPure,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is annoying about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants