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

Bundle installation mode #36

Merged
merged 3 commits into from
Sep 25, 2020
Merged

Conversation

davidlatwe
Copy link
Collaborator

@davidlatwe davidlatwe commented Sep 22, 2020

New Feature - Bundle install

When building Rez package with pipz, presenting --bundle option in Rez package's build_command will make all PyPI packages and their requirements be installed in that Rez package.

That way, reproducing the build/release process of that Rez package is much easier. Plus, the result of this PyPI packages bundling would be just like making that Rez package as a portable Python virtual environment.

For example:

# in package.py

name = "my_env"
version = "1.0"

pip_packages = [
    "pysftp==0.2.9",
    "pymongo",
]
private_build_requires = ["pipz"]
build_command = "install %s --bundle" % " ".join(pip_packages)

Also, I think this is a good workaround for #30.

Noted :

  • --bundle option only works in Rez's package building session ($REZ_BUILD_ENV is set).
  • Currently only available in command-line interface, pip.install not supported.

@davidlatwe davidlatwe requested a review from mottosso September 22, 2020 15:32
@mottosso
Copy link
Owner

Sorry, missed this. Bundle huh? Looks interesting, where exactly does the bundled packages go? Could you share an example folder hierarchy?

@davidlatwe
Copy link
Collaborator Author

davidlatwe commented Sep 25, 2020

Hey, sure !

Here's a example package rich

# package.py
name = "rich"
version = "6.0.0"
requires = []
variants = [
    ["python-3.6"],
    ["python-3.7"],
]
pip_packages = [
    "rich==6.0.0",
]
private_build_requires = ["pipz"]
build_command = "install %s --bundle" % " ".join(pip_packages)

def commands():
    env = globals()["env"]
    env.PATH.prepend("{root}/bin")
    env.PYTHONPATH.prepend("{root}/python")

And here what the installed package's filesystem hierarchy looks like :

~\packages\install\rich\6.0.0\python-3.7
|
|   build.rxt
|   variant.json
|
+---bin
|       cmark
|       cmark.exe
|       cmark.shim
|       pygmentize
|       pygmentize.exe
|       pygmentize.shim
|
\---python
    |
    +---colorama
    |
    +---colorama-0.4.3.dist-info
    |
    +---commonmark
    |
    +---commonmark-0.9.1.dist-info
    |
    +---pygments
    |
    +---Pygments-2.7.1.dist-info
    |
    +---rich
    |
    +---rich-6.0.0.dist-info
    |
    +---typing_extensions.py
    |
    \---typing_extensions-3.7.4.3.dist-info

Packages requested in pip_packages attritube and their dependencies are installed in to python and bin dir all together, as a bundle !

@mottosso
Copy link
Owner

Oh wow. That is sweet. :) Good idea, happy for you to merge and release a 1.3.0!

@davidlatwe
Copy link
Collaborator Author

Merge ! 🚀

@davidlatwe davidlatwe merged commit 152307c into mottosso:master Sep 25, 2020
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.

2 participants