Could rez-env
automatically bind missing packages with rez-pip
?
#1266
Unanswered
AustinScola
asked this question in
Q&A
Replies: 1 comment
-
Automatically integrating packages into rez from other sources (eg pip) is
definitely outside the scope of rez-env. It's also a bit of a moot point
given that we would like to move rez-pip out of the rez repository at some
stage and make it an optional extension (which makes sense because rez is a
language-agnostic packager, and pip is specific to python and its packaging
ecosystem).
I recommend managing this yourself and using the rez API, see below:
```
from rez.packages import get_latest_package_from_string
from rez.pip import pip_install_package
for req in my_req_list_from_file:
if not get_latest_package_from_string(req):
name = find_latest_pip_package(req) # <== we would need to add this
pip_install_package(name)
```
What's missing is the ability to search for a pip package in rez, that
would have to be added. There's a complicating factor though - rez- and
pip- package naming isn't a 1-to-1 match, see
https://github.com/nerdvegas/rez/blob/master/src/rez/utils/pip.py#L27, so
you'd have to take that into account.
A general point - note that using rez-env, and creating a python venv, are
fundamentally different things. Python venv constructs a standalone env by
build/installing packages into that env. Rez doesn't work like that -
rez-env is passive, it uses existing rez packages (in the currently visible
package repos) to construct a runtime that _refers_ to these existing
packages and their already built artifacts. Rez currently does not have an
analogy to `pip install` (in the sense that pip finds and builds/installs
packages and their dependencies from a public repo). It's a worthy goal but
also one entirely separate to rez-env. Having said that though, I suspect
that attempting to have such a tool automatically integrate into other
packagers (in the sense that a rez package might go and pull packages from
pip for some of its dependencies) would probably be horrendously
complicated and difficult to configure.
Thx
A
…On Tue, Mar 29, 2022 at 2:17 AM Austin Scola ***@***.***> wrote:
I'm trying to use rez-env in a way that is similar to a Python venv. I
have a file containing rez packages that I want, rez-reqs.txt. Then I use
rez-env to get a configured subshell with rez-env $(cat rez-reqs.txt).
However, I would like to use this in a script that other developers will
use too. And so if I add or change requirements, then I'll need to make
sure that other devs have binded the pip package too.
I was thinking that I would just hack together a conversion from
rez-reqs.txt to python package specifications and use rez-pip but I think
it would be a lot more convenient if there was a way to automatically bind
missing packages with rez-pip. Thoughts?
—
Reply to this email directly, view it on GitHub
<#1266>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMOUSUJAUMRYHL35TBSAHDVCHEPJANCNFSM5R3PVZAA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use
rez-env
in a way that is similar to a Python venv. I have a file containing rez packages that I want,rez-reqs.txt
. Then I userez-env
to get a configured subshell withrez-env $(cat rez-reqs.txt)
. However, I would like to use this in a script that other developers will use too. And so if I add or change requirements, then I'll need to make sure that other devs have binded the pip package too.I was thinking that I would just hack together a conversion from
rez-reqs.txt
to python package specifications and userez-pip
but I think it would be a lot more convenient if there was a way to automatically bind missing packages withrez-pip
. Thoughts?Beta Was this translation helpful? Give feedback.
All reactions