Skip to content

Commit

Permalink
WIP [Docs] Add docs on version workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Cowland <tom@foundry.com>
  • Loading branch information
foundrytom committed Nov 2, 2023
1 parent 5bbac62 commit 747ff18
Show file tree
Hide file tree
Showing 8 changed files with 813 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.egg-info
.ipynb_checkpoints
29 changes: 29 additions & 0 deletions examples/resources/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import json

from IPython.display import display
from PIL import Image
from urllib.parse import urlparse, unquote

def print_traits_data(data):
"""
TraitsData objects arent readily convertable to a dict, or printable
at present. This is a little helper to aid the display of OpenAssetIO
data in the context of a notebook. It prints the traits and their
properties using pretty json formatting.
"""
as_dict = {
trait_id: {
property_key: data.getTraitProperty(trait_id, property_key)
for property_key in data.traitPropertyKeys(trait_id)
}
for trait_id in data.traitSet()
}
print(json.dumps(as_dict, indent=4, sort_keys=True))

def display_image(url):
"""
Displays an image in the notebook output.
"""
url_parts = urlparse(url)
image = Image.open(unquote(url_parts.path))
display(image)
3 changes: 3 additions & 0 deletions examples/resources/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
openassetio>=v1.0.0b1rev0
openassetio-mediacreation
Pillow
44 changes: 44 additions & 0 deletions examples/resources/versioning/bal_database.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"managementPolicy": {
"read": {
"default": {
"openassetio-mediacreation:managementPolicy.Managed": {},
"openassetio-mediacreation:content.LocatableContent": {}
}
},
"write": {
"default": {
"openassetio-mediacreation:managementPolicy.Managed": {},
"openassetio-mediacreation:content.LocatableContent": {}
}
}
},
"entities": {
"project_artwork/logos/openassetio": {
"versions": [
{
"traits": {
"openassetio-mediacreation:identity.DisplayName": {
"name": "The OpenAssetOI logo",
"qualifiedName": "logos / openassetio / v1"
},
"openassetio-mediacreation:content.LocatableContent": {
"location": "file:///${bal_library_dir}/logo.jpg"
}
}
},
{
"traits": {
"openassetio-mediacreation:identity.DisplayName": {
"name": "The OpenAssetIO logo",
"qualifiedName": "logos / openassetio / v2"
},
"openassetio-mediacreation:content.LocatableContent": {
"location": "file:///${bal_library_dir}/logo_revised.jpg"
}
}
}
]
}
}
}
Binary file added examples/resources/versioning/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/resources/versioning/logo_revised.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/resources/versioning/openassetio_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[manager]
identifier = "org.openassetio.examples.manager.bal"

[manager.settings]
library_path = "${config_dir}/bal_database.json"
Loading

0 comments on commit 747ff18

Please sign in to comment.