-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve usability of rez_pip as python library. #89
base: main
Are you sure you want to change the base?
Conversation
by exposing this private function publicly, this improves usability of rez-pip as a python library and not simply a CLI. This also make it clear of what really are the input of the function. An improvement over the function argument name was also performed with a focus on explicity.
- rezRelease: to False because to True would be the most "destructive" action, with the biggest consequences.
reduce the size of the rez_install_pip_packages and allow for more re-usability as a python library
make it more explicit that we are expecting path like object
fix mentions of `rez.cli._run`
again in effort to make rez_pip more usable as a python library where its function could be re-used
again in effort to make rez_pip more usable as a python library where its function could be re-used
to avoid confusion when the list[str] is converted to a list[PackageInfo] which trigger mypy
address issue introduced in 9a76574 where type were not as expected for the "list of pip packages"
as we are now using pathlib objects
is actually not that useful, let's keep smaller changes for now
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #89 +/- ##
==========================================
- Coverage 81.91% 81.68% -0.24%
==========================================
Files 8 9 +1
Lines 719 759 +40
Branches 150 153 +3
==========================================
+ Hits 589 620 +31
- Misses 115 123 +8
- Partials 15 16 +1 ☔ View full report in Codecov by Sentry. |
help at achieving specific override per rez package when using rez_pip as python library
the intention is to try to provide as low-level function as possible for a library-use This new function should also provide a workaround for JeanChristopheMorinPerso#46
I have the feeling that the "release" parameter shouldn't part of the createPackage function, so to avoid an annoying refacto in the future that remove this arg, it is best to do it now. It is anyway easier to add arg to the callback than removing some.
again in the effort to make it easier to use rez_pip as a python library
again in the effort to make it easier to use rez_pip as a python library
Hi @MrLixm thanks a lot for creating this PR and for the great PR description :) First of all, rez-pip was not designed to be used as an API. I made design choices knowing full well that the API wouldn't be useable as is. That was kind of intentional. Could you explain in more details what use cases you are facing that rez-pip doesn't cover or what kind of use cases this would enable? I know that we need to fix a couple of bugs, for example the name casing thing or even how PySide is handled. To fix some of these, I've been thinking about implementing a lightweight plugin system that would allow to create hooks, similar to how PyInstaller solves these problems. Basically, before opening the doors to a public API, I'd like to see if we can look at hooks or other solutions. Would you like to collaborate on such an effort? I'm definitely searching for collaborators that are active users to make sure that the solution we come up with fits the needs of users. Let me know what you think. |
Hello, My current context is I am trying to ensure a robust deploy pipeline for pip packages. You can't have any developer calling So my goal is to have version controlled repository that contain a "install script" for every pip package. So if one would run all those scripts on a fresh new central repository, you would get a mirror of the current one. This could be in theory just a bunch of powershell/shell scripts that call the CLI, but with the current limitations and issues of rez_pip I have found myself in need of doing a lot of workaround that are made much easier in python. You could argue that you should not decide to change the scope (CLI > library) of a tool because it is currently missing feature and you'd be right, so it is indeed important to have a look if its really pertinent. Here is some of my current needs:
I would be very happy to collaborate with you if I can be of any help. |
Quality Gate passedIssues Measures |
Warning
Draft pull request, check back when its ready !
Hello,
I don't know if it was in the goal of rez_pip to be usable as a python library and not only as a CLI, but given its current "WIP" state I found myself in need of such behaviour so I could further custom rez_pip behaviour.
The goal is to have rez_pip part of a larger python script, doing the heavy work of installing pip package, but allowing to retrieve those for further manipulations.
changes
⭐ Extract the
cli._run
private function to a newmain
module, asrun_full_installation
function.⭐ Split
run_full_installation
into an additional lower-level functionrun_installation_for_python
have
rez.createPackage
return therez.package_maker.PackageMaker
object createdhave new
run_full_installation
function return a dict of rez package created for each python version, dependent on previous change.⭐ add a
creationCallback
parameter torez.createPackage
andmain.run_full_installation
(in f7b6519)extract 2 functions from
rez.getPythonExecutables
:getPythonExecutable
andfindPythonPackages
change some variable to be
pathlib.Path
objects instead ofstr
(in 13b7ee4 and a184ebf)what to review
Not all those changes are necessary for the initial need. Do not hesitate to oppose to some of them if you think they are not pertinent.
Essential changes are marked with a ⭐ emoji.
notes
I intended commit history to be pretty clean but I actually did some change I choose to revert later for maintaining simplicity.
pitfalls
After a few test it seems rez_pip log/print system is not designed for a library use for now. But we could perhaps address those in another PR.
misc suggestions
Not related to this PR but were found during the development process.
release
param fromrez.createPackage
, instead only use theprefix
param to determine the path of the installation (that could also be renamed to be more explicit).rez.getPythonExecutables
togetPythonExecutableFromRange
?example
Here is a contextual use-case (in reference to issue #88 ):
todo
run_full_installation