Improving rez.vendor embedded requirements #1404
Replies: 2 comments 1 reply
-
Hi @ttrently , thanks for bring the subject of our vendored dependencies here. I think the way forward would be to unvendor everything. As you said it, vendoring has a huge cost and to me only has downsides. And yes I really think there is no upside to vendoring in rez. Vendoring dependencies makes it pretty painful to upgrade dependencies, it's a security risk that I personally don't want to deal with, it makes it more difficult (or even impossible) to track where the code comes from (again a security issue). For your specific case, I would suggest that the S3 repository be a plugin, external to the main rez repo and make it installable via pip. This would allow you to have the dependencies that you want without any downsides. One thing to note is that the TSC members slightly touched that subject not too long ago, but we unfortunately didn't go far in our conversation. From what I remember we mostly stated where we stand in regards to vendored dependencies. The result was mixed. (I already anticipate replies saying that rez should be self contained because some companies/studios block internet from machines. And to me that is not a good argument to vendor dependencies. If a studio/company wants to block internet access, that is their problem, not our. These companies/studios already know how to deal with that and already have processes and the infrastructure in place to proxy package indexes (PyPI, etc)). This subject will be like a pandora box though. It touches the installer, dependencies (obviously), #1349, security, how plugins are implemented and deployed, etc. One of the only case I can think of where vendoring makes sense is for bootstrapping purposes. For example |
Beta Was this translation helpful? Give feedback.
-
Closing in favor of #1668. |
Beta Was this translation helpful? Give feedback.
-
I'd like to propose some updates to how
rez.vendor
packages are handled and how we might move away from embedded requirements.Recently we have had the need with internal development to include additional packages into the
rez/vendor
location, but have realized there's a hidden implementation cost. This cost is the need to correct the packages internal imports to be from absolute to relative in order to function correctly fromrez.vendor
.Take for example the
pymongo
package, by default when installed, this package references all of its imports as absolute, but makes it unusable from withinrez.vendor
.Normally to correct this, once the package is installed to the
rez/vendor
location, an additional refactor pass must be made to correct these import statements and tested, some of which can be automated, but can require some manual work as well depending on the size of the install.In this case, the previous import line would need to be changed to:
This can become tedious though as more requirements are added and managed.
Proposal
site-packages
Treat rez requirements as such through an internal
site-packages
directory that is bootstrapped at runtime or when a requested plugin is loaded.Example:
We have a package_repository for mongo that has a requirement on the
pymongo
package. Normally we would either manually install it torez.vendor
or to the global rez install location. The only problem with this is time taken to maintain the requirement and that it is not recognized when binding or installing rez as a package.The solution here would be to install
pymongo
as a requirement of themongo
package repository undersite-packages
and have the initialization add the site location when requested.Then in
__init__.py
of the package repository plugin:This can then be implemented at higher levels as well from within rez, replacing
rez.vendor
with arez/site-packages
location that is added upon rez initialization. The few benefits of this:requirements.txt
to handle installs either during a rez install or when distributing specific plugins.I'd be interested in others thoughts or if there may be another way to handle this. In our case we were looking for a low-effort, minimum-impact solution to providing additional requirements without having to either manipulate the installer, or incur the work of converting these libraries.
Beta Was this translation helpful? Give feedback.
All reactions