Dobyโ€™s ESA Pyxel Logs๐ŸŒ™

๐Ÿงฉ 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:

  • name is 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

โš™๏ธ Config Lab