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

Use Class for Package Definition #1880

Open
beatreichenbach opened this issue Nov 17, 2024 · 0 comments
Open

Use Class for Package Definition #1880

beatreichenbach opened this issue Nov 17, 2024 · 0 comments

Comments

@beatreichenbach
Copy link

Use classes for the package definitions. Either use custom classes with class variables or something like a pydantic model.

Something like this:

#  package.py

from rez.configuration import BaseConfiguration

class Configuration(BaseConfiguration):
    name = 'nuke'
    version = '14.0.0'
    tools = ('nuke', 'nukex')
    ...
    
    def commands(self) -> None:
        super().commands()
        self.env.PATH.prepend(f'{self.root}/nuke/bin')
        
        if 'maya' in self.resolve:
            pass

Motivation
Using a Python class would allow IDEs to provide auto-complete and validation while creating packages. It would also prevent IDEs from throwing errors about unresolved references for variables like env or resolve. It would also allow developers to see default values for fields and what fields are required.

This is possible using Python but also YAML schema validation. For Python see spack package definitions. For YAML see docker compose definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant