๐งฉ Pyxel Contribution: Optional ModelFunction Name
Summary: Makes the name parameter optional for pipeline
ModelFunction entries by automatically deriving it from func
when omitted.
URL:
https://gitlab.com/esa/pyxel/-/merge_requests/1166
Date: 2026-01-13
โจ Overview
This contribution resolves issue #768 by removing the implicit
requirement for users to manually specify a name field in pipeline
model definitions.
If name is not provided in the YAML configuration, it is now
automatically derived from the model function path.
For example, optical_psf is derived from
pyxel.models.photon_collection.optical_psf.
This simplifies YAML configurations, especially for workshops, tutorials, and SPIE demo setups, while preserving full backward compatibility.
Related issue: #768
๐ Problem Analysis
Initially, the issue appeared to be related to YAML schema or metadata validation.
After inspecting metadata.schema.json and model metadata files, it became
clear that these layers were not enforcing the name requirement.
Tracing the YAML loading path revealed that ModelFunction instances are
created directly from pipeline configuration dictionaries, making the
name field effectively mandatory at runtime.
This meant that missing name entries caused execution issues even though
the information could be inferred safely.
๐ง Technical Changes
File modified: pyxel/pipelines/model_function.py
The ModelFunction initializer was updated so that:
nameis now optional- If omitted, it is derived from the last segment of
func - Existing configurations continue to behave identically
- Pipeline execution and logging remain unchanged
This change ensures that model execution remains stable while reducing configuration verbosity.
๐ YAML Before & After
Before (mandatory name):
pipeline:
photon_collection:
- name: optical_psf
func: pyxel.models.photon_collection.optical_psf
enabled: true After (name optional):
pipeline:
photon_collection:
- func: pyxel.models.photon_collection.optical_psf
enabled: true ๐งช Validation
- โ Existing YAML configurations remain valid
- โ
Pipeline execution succeeds with missing
name - โ Model names are correctly inferred at runtime
- โ No schema or metadata changes required
๐ Documentation Update
The ModelFunction docstring was updated to clarify that
name is optional and automatically derived when not provided.
๐ Impact
- Simpler YAML files for users
- Improved workshop and demo usability
- Reduced configuration friction
- Cleaner onboarding experience for new users
๐ฆ Authored by: Doby Baxter
๐ Contribution for: ESA Pyxel Project