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

Add plugin system and local wheels support #91

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

Conversation

JeanChristopheMorinPerso
Copy link
Owner

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Feb 3, 2024

Fixes #64.

Add a new generic plugins system and builtin plugins. The glugin system is based on pluggy and has 5 hooks: prePipResolve, postPipResolve, groupPackages, cleanup and metadata.

The 2 builtin plugins are the PySide6 and shiboken6 plugins for correctly installing PySide6>=6.3. The plugins take care of merging all the PySide6 related packages (PySide6, PySide6-Addons and PySide6-Essentials) into one rez package.

$ 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'>

🎉

This only works on Linux and macOS. On Windows, it works with Python 3.7 but not 3.8 and above. PySide6 on Windows makes use of os.add_dll_directory...

Additionally, add support for installing local wheels. Considering that PySide is a big package, I needed that functionality to speed up the development of the plugin system.

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 95.35714% with 13 lines in your changes missing coverage. Please review.

Project coverage is 90.95%. Comparing base (71ba391) to head (90e8b99).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/rez_pip/pip.py 88.57% 3 Missing and 1 partial ⚠️
src/rez_pip/plugins/__init__.py 94.11% 2 Missing and 1 partial ⚠️
src/rez_pip/cli.py 93.75% 1 Missing and 1 partial ⚠️
src/rez_pip/compat.py 75.00% 1 Missing and 1 partial ⚠️
src/rez_pip/rez.py 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
+ Coverage   81.14%   90.95%   +9.81%     
==========================================
  Files           8       12       +4     
  Lines         716      918     +202     
  Branches      133      174      +41     
==========================================
+ Hits          581      835     +254     
+ Misses        121       59      -62     
- Partials       14       24      +10     

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

Repository owner deleted a comment from sonarqubecloud bot Mar 6, 2024
@JeanChristopheMorinPerso JeanChristopheMorinPerso force-pushed the plugins branch 3 times, most recently from 178c63c to f9b6577 Compare April 28, 2024 23:38
@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title Initial commit adding a plugin system and a PySide6 plugin Plugin system Apr 28, 2024
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.

docs/source/plugins.rst Show resolved Hide resolved
src/rez_pip/pip.py Outdated Show resolved Hide resolved
src/rez_pip/plugins/PySide6.py Outdated Show resolved Hide resolved
src/rez_pip/plugins/PySide6.py Outdated Show resolved Hide resolved
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?

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]>
…e arguments are immutable

The code is also a little bit cleaner IMO

Signed-off-by: Jean-Christophe Morin <[email protected]>
…force immutability at runtime.

Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
… positional arguments instead of kwargs

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]>
@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title Add plugin system Add plugin system and local wheels support Jan 2, 2025
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
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.

Fail to install PySide6
2 participants