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

Add Check Discovery #8

Open
scott-wilson opened this issue Dec 30, 2022 · 0 comments
Open

Add Check Discovery #8

scott-wilson opened this issue Dec 30, 2022 · 0 comments
Labels
lang-c Issues related to C lang-cpp Issues related to C++ lang-python Issues related to Python lang-rust Issues related to Rust

Comments

@scott-wilson
Copy link
Owner

scott-wilson commented Dec 30, 2022

Let's say that a rigger is about to publish their rig, or an animator is about to publish their animation. It would be nice if the checks API would look like this (In Python):

import my_studio_checks

context = StudioAsset("/myAsset")

checks = my_studio_checks.gather(context)

for check in checks:
    result = pychecks.run(check)

I suspect that behind the scenes, the my_studio_checks might look like this:

# my_studio_checks.py

import pychecks

_CACHE = None


def gather(context):
    _init_checks()
    
    return _CACHE.gather(context)


def _init_checks():
    global _CACHE

    if _CACHE:
        return

    _CACHE = pychecks.DiscoveryRegistrar()
    _CACHE.register(_is_context_rig, _generate_rig_checks)


def _is_context_rig(context):
    if not isinstance(context, StudioAsset):
        return False

    return context.asset_type() == "rig"


def _generate_rig_checks(context):
    return [
        RigCheckA(context),
        RigCheckB(context),
        RigCheckC(context),
    ]

Blocked by:

@scott-wilson scott-wilson added lang-rust Issues related to Rust lang-python Issues related to Python lang-c Issues related to C lang-cpp Issues related to C++ labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-c Issues related to C lang-cpp Issues related to C++ lang-python Issues related to Python lang-rust Issues related to Rust
Projects
None yet
Development

No branches or pull requests

1 participant