Skip to content

Delivery: support per-representation template overrides - #1960

Draft
jakubjezek001 wants to merge 5 commits into
developfrom
enhancement/delivery-tool-override-presets
Draft

Delivery: support per-representation template overrides#1960
jakubjezek001 wants to merge 5 commits into
developfrom
enhancement/delivery-tool-override-presets

Conversation

@jakubjezek001

@jakubjezek001 jakubjezek001 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Changelog Description

Adds configurable overrides for delivery templates on a per-representation basis. Studios can now define override presets in project settings that swap the directory/file template for specific representation names, instead of being locked to a single delivery template. Also adds support for using {publishedFilename} without its extension in templates.

Additional info

  • New settings models (DeliveryToolModel, DeliveryTemplateOverrideModel, DeliveryRepresentationRuleModel) expose override presets under Delivery tool settings, matched by representation name.
  • check_destination_path and deliver_single_file accept an optional explicit_template_obj to bypass the named anatomy template lookup.
  • Delivery UI builds the override template object per representation, merging {directory}/{file} tokens from the original template when only one side is overridden.
  • Strips stray frame-number segments from the destination folder when {publishedFilename} (without extension) is used in a directory token.
image image image

Testing notes:

  1. Configure a delivery override preset in project settings (AYON Core > Delivery) with a representation rule overriding directory/file template.
  2. Run the Delivery tool against a representation matching the rule and confirm files land at the overridden path.
  3. Verify representations without a matching rule still use the default delivery template.

Dependency

Close #1961

Related support tickets

YN-0942

Allow delivery functions to accept an explicit anatomy template object
instead of looking it up by name in the project anatomy. This enables
dynamic template overrides based on representation rules.

Also includes:
- New delivery tool settings models for template override rules
- Support for `{publishedFilename}` without extension in templates
- Integration of override lookups in the delivery UI logic
Implement template overrides for representation delivery and fix an
issue where frame numbers were incorrectly included in directory paths
when using the publishedFilename token. Also corrects the settings path
for delivery overrides.
@ynbot ynbot added size/S type: enhancement Improvement of existing functionality or minor addition labels Jul 17, 2026
@jakubjezek001 jakubjezek001 changed the title Add support for delivery template overrides Delivery: support per-representation template overrides Jul 17, 2026
@jakubjezek001 jakubjezek001 self-assigned this Jul 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable per-representation delivery template overrides via project settings, allowing studios to override the delivery directory/file templates based on representation name (instead of being locked to a single delivery template).

Changes:

  • Introduces new Delivery settings models under global tool settings to define override presets and representation rules.
  • Updates the Delivery UI to load override presets from project settings and build an explicit anatomy TemplateItem per representation when a rule matches.
  • Extends delivery pipeline helpers to accept an explicit_template_obj and adjusts {publishedFilename} handling for templates.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
server/settings/tools.py Adds Delivery settings models and defaults for per-representation template override presets.
client/ayon_core/tools/delivery/delivery.py Loads delivery override presets from project settings and builds explicit template objects per representation; updates {publishedFilename} handling.
client/ayon_core/pipeline/delivery.py Adds support for explicit template items in check_destination_path / deliver_single_file and includes frame-related path adjustments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/settings/tools.py
Comment on lines +843 to +846
"delivery": {
"enabled": False,
"overrides": [],
},
Comment on lines +193 to +201
# Remove frame number if is find in folder path
# usually due publishedFilename token used in directory
frame = anatomy_data.get("frame")
if frame is not None:
frame_pattern = f".{frame}"
if frame_pattern in delivery_folder:
delivery_folder = delivery_folder.replace(frame_pattern, "")
delivery_path = os.path.join(
delivery_folder, os.path.basename(delivery_path))
Comment on lines +309 to 311
filename, _ = os.path.splitext(publish_basename)
template_data["publishedFilename"] = filename
args[0] = src_path
Comment on lines +380 to +383
# make sure if file or directory is in template it is
# wrapped into double braces so it is not formatted
# e.g. "{directory}" should be "{{directory}}" so it is not
# replaced by the format method
for src_path, frame in sources_and_frames.items():
# Support {publishedFilename} token
template_data["publishedFilename"] = os.path.basename(
publish_basename = os.path.basename(

@iLLiCiTiT iLLiCiTiT Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? This is supposed to be filename, not basename. Filename has extension. It doesn't make sense to change extension of a file during delivery.

@ynbot ynbot moved this to Review In Progress in PR reviewing Jul 21, 2026
@iLLiCiTiT

iLLiCiTiT commented Jul 21, 2026

Copy link
Copy Markdown
Member

This PR adds multiple things at the same time. I would split it.

First of all if someone needs to use the filename as a directory -> without frame and extensions, then don't change publishedFilename. We should add new keys that do what it needs to do instead of changing what is now explicitly defined and well defined. It might be useless, but don't store extensionless and frameless filename into publishedFilename, it is not publishedFilename if it is modified.

I really don't like that we do add different delivery templates to the settings. Rather add an enum of delivery templates from project anatomy, with that you don't need the explicit_template_obj argument, which is kinda weird, and the whole logic to resolve the templates from settings is super confusing.

@BigRoy BigRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I somewhat agree with Kuba here. This is just overcomplicating things and I really wonder whether we're not stretching it too far. And with the amount of complication this adds, I feel like it doesn't solve enough. The pure single representation name switching I think doesn't suffice.

Would people maybe want to differentiate certain representations within a single delivery template, sure. Would it be up to representation name only - I don't think so. Also, what if you have two representation names you now want to apply this delivery template to, etc. (or what if camera_exr, exr and raw_exr or whatever special representation names you may have from ingests. The design doesn't scale well. It'd almost need to be profile filtering based, etc. (but we all know how complex that can get to set up in settings)

It's really getting to the point where it just starts making more sense for the delivery tool to be able to specify custom delivery rules/scripts, like a "use this script to define the template" where you can essentially put in your own custom Python script to evaluate it to something custom, etc. because we're seeing the granularity that studios want their deliveries to behave like for their needs. Especially with AI/LLMs being able to write some custom logic would be trivial? We could have a custom delivery format where you get access to the "context" and e.g. just return the template you want to apply. Complexity for the admin? yes, but allows you to get very granular and move the responsibility to the one maintaining the delivery system not having to dive deeper and deeper into growingly scattered and complex settings?

In short, I wonder - are we solving this the right way?

@BigRoy

BigRoy commented Aug 27, 2026

Copy link
Copy Markdown
Member

Perhaps the "batch delivery" 'script' approach we discussed could apply here too @jakubjezek001 ?

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

Labels

size/S type: enhancement Improvement of existing functionality or minor addition

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

YN-0942: Deliver Version tool representation template override rules

5 participants