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

How to add package of the same version but different variants to the same profile file? #116

Closed
loonghao opened this issue Oct 22, 2020 · 9 comments

Comments

@loonghao
Copy link

loonghao commented Oct 22, 2020

Hi all,

I want to know how to add a package of the same version but different variants to the same profile file?

For instance, I want to display the same version of Conan in the GUI, but it comes from two different variants, one is python3 and the other is python2.
As far as I know, the profile cannot directly implement this structure, so I created two new packages for testing.

# conan_python2

name = 'conan_python2'

version = '0.1.0'
tools = [
    "conan"
]
requires = [
    "conan",
    "python-2"
]
_data = {
    "label": "Conan (python2)"
}
# conan_python3

name = 'conan_python3'

version = '0.1.0'
tools = [
    "conan"
]
requires = [
    "conan",
    "python-3"
]
_data = {
    "label": "Conan (python3)"
}

Then if I do not weakly reference python in the two newly created packages, I will get a conflict error similar to the following
image

image

If I change both of them to weak references, they can run normally, but when I click start cmd, the newly started cmd does not resolve to the Conan and python environment.

# conan_python2

name = 'conan_python2'

version = '0.1.0'
tools = [
    "conan"
]
requires = [
    "~conan",
    "~python-2"
]
_data = {
    "label": "Conan (python2)"
}
# conan_python3

name = 'conan_python3'

version = '0.1.0'
tools = [
    "conan"
]
requires = [
    "~conan",
    "~python-3"
]
_data = {
    "label": "Conan (python3)"
}

I would like to ask if there are any good suggestions or solutions for this situation, Thanks!

@davidlatwe
Copy link
Collaborator

davidlatwe commented Oct 22, 2020

Hi @loonghao

I assume that your conan package is looking like this :

# package.py

name = "conan"
variants = [
    ["python-2"],
    ["python-3"],
]
...

correct ?

And the profile, would this work ?

name = "conan_pack"
version = "0.1.0"
tools = [
    "conan"
]
requires = [
    "conan",
    "~python-2",
    "~python-3",
]

Edit

Since "python" is the application that you want to launch, and "conan" is the dependency, so the "python" should be the only one that needs to be weak referenced.

@loonghao
Copy link
Author

loonghao commented Oct 22, 2020

@davidlatwe Thank you for your reply, the package.py of Conan is like you mentioned and the profile like your mentioned I tested still no work. (due to conan is not weak references so that no show in the GUI.)
image

I think if we don’t auto-resolve the dependency package in requires in the profile when we start the GUI and switch the profile I guess we won’t have these issues.
Only when the user clicks to run launch, the dependent packages are resolved. This may be avoided because they are a brand new context.

@davidlatwe
Copy link
Collaborator

davidlatwe commented Oct 22, 2020

Sorry, just have a test and I found that I miss guided.

Here's my test package named "foo", which should equivalent to your "conan" :

# package.py
name = "foo"
version = "1"
variants = [
    ["python-2"],
    ["python-3"],
]
tools = [
    "python --version",
]

I add a command python --version as a tool of it, which should later print out the current python version in console.

Here's my profile :

name = "test_dev"
version = "1.0.0"
requires = [
    "~foo",
]

We won't need to add Python explicitly into requires, since Python already is the variant requirement in "foo".

And here's the operation GIF :

after

You can go to "Packages" page, find the "Python" and double click the "version" column to change the version. Which it will patch the current resolved context, and give you the Python version you need.

image

But the proper way for this I think is to implement #96, or you may try the link in #96 👉🏼 https://allzpark.com/gui/#multiple-application-versions

Hope this helps 🤞🏼

@loonghao
Copy link
Author

@davidlatwe The #96 mentioned maybe a little different from what I want most.
I think my profile can achieve a structure similar to the following so that we can configure different tools as needed in a profile and the environment of each tool is independent.

name = "my dev profile"
version = "0.1.0"

_data = {
    "apps": [
        {
            "maya_a": {
                "requires": ["maya-2018", "maya_plguinb-xxx", "maya_plguina-xxx"],
                "command": "maya"
            },
            "maya_b": {
                "requires": ["maya-2019", "maya_plguina-xxx", "maya_plguinb-xxx""maya_plguinc-xxx"],
                "command": "maya"
            },
            "conan (python 3)": {
                "requires": ["conan", "python-3",],
                "command": "conan -h"
            },
            "conan (python 2)": {
                "requires": ["conan", "python-2",],
                "command": "conan -h"
            },
            "custom tool": {
                "requires": ["python-3", "pyside2", "pyyaml", "xxxx", "xxxx"],
                "command": "mytool -v"
            },
            "nuke-9 test profile": {
                "requires": ["nuke-9", "nuke_plugin-xxx"],
                "command": "nuke"
            },
        }
    ]
}

@davidlatwe
Copy link
Collaborator

Just dropping a quick reply.

With the example profile you gave, looks like what you are after is rez-suite ?

Not sure, need to have a closer look when I back to office.

@loonghao
Copy link
Author

loonghao commented Oct 23, 2020

I have tested using the rez env --input and rez env --output seems can implement what I want.

rez env package_a-xxx package_b-xxx --output mytool.rxt
rez env --input mytool.rxt -- tool -h

But I don’t know how to use it in allzpark

@davidlatwe
Copy link
Collaborator

Simply output/input .rxt file with rez-env is not rez-suite. :P
See here 👉🏼 https://github.com/nerdvegas/rez/wiki/Suites#the-rez-suite-tool

When the suite is created, should be able to wrap it as another package and put into Allzpark. 🤔 (Haven't done that before)

But I still have a feeling that you actually won't need those as long as you can change application version in Allzpark.

and the environment of each tool is independent.

Perhaps you could elaborate more about why this need ?

@loonghao
Copy link
Author

Hi @davidlatwe Sorry for the late reply, I created a project rez-tools to do that, we just want to make assembly and configuration easier.

Maybe it's because I use it wrong, I always encounter the problem of package environment variable conflict when configuring different software.

We hope to be able to add different combinations of commands in the same profile.

@loonghao
Copy link
Author

@davidlatwe Thank you, closing the issues.

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

No branches or pull requests

2 participants