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

venv, revision and shell prompt #4

Merged
merged 24 commits into from
Apr 21, 2021
Merged

venv, revision and shell prompt #4

merged 24 commits into from
Apr 21, 2021

Conversation

davidlatwe
Copy link
Owner

@davidlatwe davidlatwe commented Apr 21, 2021

Revision & Virtual Env

To support updating rez tools in production time, revision is introduced : A time-slice of a container that contains a set of venv(s) managed rez tools.

Previously, rezup can provide multiple containers for user to access, and will use the default one if container name is not specified. Which means, updating rez tools that are installed in the default container can be risky. To solve that, the container needs a version-liked sub-structure to avoid user and manager accessing the same set of rez tools. Hence the revision.

The revisions are sorted by timestamp in container which will ensure the latest one can be used, and a revision can only be accessed by user when it's been marked as ready. Also, revision should not be edited after installed, just create new one.

Downside is, disk space can be consumed really fast, 30 revisions would cost about 450 MB on Windows, a set of default rez tools with one venv per revision. But this could be solved by implementing auto cleanup, which is my next TODO.

Here's the folder layout of a container revision and it's content :

{container}/
    |
    +-- {timestamp}/
    |   |   <revision>
    :   |
        +-- venv/
        |   |
        |   +-- _rez/
        |   |   <default rez venv>
        |   |
        |   +-- {extension}/
        |   |   <venv for extension that requires isolation>
        |   :
        |
        +-- bin/
        |   <all bin tools>
        |
        >-- rezup.toml
        |   <recipe file>
        |
        >-- revision.json
        |   <info of this container revision>
        |
        >-- up.*
            <shell launching scripts>

Recipe

As a prep for AcademySoftwareFoundation/rez#1040, revision can not only contain default rez tools, but variety of rez extensions which can be installed with pip. To support rez tooling customization and testing, revision is designed to be created with recipe file.

Here's an example revision recipe file :

# ~/rezup.toml
description = "My production container revision recipe"

[rez]
name = "rez"
url = "rez>=2.83"

[[extensions]]
name = "foo"
url = "~/dev/foo"
edit = true

[[extensions]]
name = "bar"
url = "git+git://github.com/get-bar/bar"
isolation = true
python = 2.7

The url will be passed to pip CLI, and as you can see, each extension include rez can be installed in edit mode which is useful for development. And if isolation is set to true, additional venv will be created (with specified python version if given) for that extension (ahead for case like extension A & B requires different Qt bindings for it's GUI).

Custom recipe can be saved in ~/rezup.toml and will be used by rezup when creating new revision.

Shell Prompt

Not tested in all shells.

fdefd0e7-d756-46c1-8870-586a441eda75

@davidlatwe davidlatwe merged commit e6460db into main Apr 21, 2021
@davidlatwe davidlatwe deleted the venv branch April 21, 2021 20:21
@davidlatwe davidlatwe added the enhancement New feature or request label Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant