-
Notifications
You must be signed in to change notification settings - Fork 40
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
Representation defined by traits #979
Draft
antirotor
wants to merge
76
commits into
develop
Choose a base branch
from
feature/909-define-basic-trait-type-using-dataclasses
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Representation defined by traits #979
antirotor
wants to merge
76
commits into
develop
from
feature/909-define-basic-trait-type-using-dataclasses
+4,342
−349
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…-basic-trait-type-using-dataclasses
added few helper methods to query/set/remove bunch of traits at once
…-basic-trait-type-using-dataclasses
…-dataclasses" and "origin/develop"
…into feature/911-new-traits-based-integrator
note that this needs `pytest-ayon` dependency to run that will be added in subsequent commits
also added versionless trait id processing and trait validation
also added versionless trait id processing and trait validation
…-basic-trait-type-using-dataclasses
…ype-using-dataclasses' into feature/909-define-basic-trait-type-using-dataclasses
antirotor
added
type: feature
Adding something new and exciting to the product
tests
PR contains new unit or integration test or improves the existing ones
labels
Oct 31, 2024
BigRoy
reviewed
Oct 31, 2024
BigRoy
reviewed
Oct 31, 2024
BigRoy
reviewed
Oct 31, 2024
GPGSigned to PGPSigned
this is needed to align with named groups in `clique`. Frame is IMO more descriptive but aligning it simplify the code
BigRoy
reviewed
Dec 19, 2024
FrameRanged: FrameRanged trait. | ||
|
||
""" | ||
col = assemble([path.as_posix() for path in paths])[0][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will error on:
- File paths that do not have a sequence identifier
- File paths that only contain a single frame
Because both won'tbe detected as collections but as remainder
…-basic-trait-type-using-dataclasses
…ype-using-dataclasses' into feature/909-define-basic-trait-type-using-dataclasses
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
size/XXL
tests
PR contains new unit or integration test or improves the existing ones
type: feature
Adding something new and exciting to the product
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Description
Introducing new way of defining representations. Developer friendly, flexible yet strictly typed, easy to extend using Traits as building blocks defining what representation IS.
Additional info
New representation is holder for traits. Each trait define some properties and together with other traits describes the representation. Traits can be anything- their purpose is to help publisher, loader (and basically any other systems) to clearly identify data needed for processing. Like file system path, or frame per second, or resolution. Those properties are grouped together to logical block - frame range specific, resolution specific, etc.
This PR is introducing several new features:
TraitBase - this is Pydantic based model for all Traits. It defines abstract properties like
id
,name
,description
that needs to be in all Traits.Note
Every Trait can re-implement
validate()
method. The one inTraitBase
always returnsTrue
.Representation
is passed to that method so every Trait can validate against all other Trait present in representation.Representation - this is "container" of sorts to hold all Traits. It holds representation
name
andid
. And lot of "helper" methods to work with Traits:Most of them can run on bulk of Traits and you can access Traits by their class or by their Id. More on that below.
There is also mechanism for upgrading and versioning Traits.
Traits
There are some pre-defined Traits that should come with ayon-core to provide "common language". They are all based on
TraitBase
and are grouped to logical chunks or namespaces - content, lifecycle, meta, three_dimensional, time, two_dimensional. Their complete list can be found in the code and is obviously subject to change based on the need.Practical examples
So how to work with traits and representations? To define traits (for example in Collector plugin or in Extractor plugin:
You can work with Traits using classes, but you can also utilize their ids. That is useful when working with representation that was serialized into "plain' dictionary:
There is also feature of version upgrade on Traits. Whenever you want to de-serialize data that are using older version of trait,
upgrade()
method on newer trait definition is called to reconstruct new version (downgrading isn't possible). So, you can have serialized trait like so (type trait without properties):But your current runtime has Image trait
ayon.2d.Image.v2
that is also adding propertyfoo
.Whenever you run
representation.get_trait_by_id("ayon.2d.Image")
without version specifier, it can try to find out the latest Trait definition available and if it differs -v1 != v2
it tries to callupgrade()
method on the latest trait.Warning
🔧 DESCRIPTION IN PROGRESS