Skip to content

Make attribute label, description, and value optional with auto-label generation + add unit tests#3042

Merged
fabiencastan merged 7 commits intodevelopfrom
copilot/update-attributes-defaults
Mar 18, 2026
Merged

Make attribute label, description, and value optional with auto-label generation + add unit tests#3042
fabiencastan merged 7 commits intodevelopfrom
copilot/update-attributes-defaults

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

label, description, and value were required positional arguments on all attribute constructors, forcing verbose boilerplate even when defaults were sufficient. This PR makes all three optional and adds tests validating the behavior.

Description

All attribute descriptor constructors (File, BoolParam, IntParam, FloatParam, StringParam, ColorParam, PushButtonParam, ChoiceParam, ListAttribute, GroupAttribute, and geometry variants) now accept name as the only required argument.

Before:

desc.File(name="outputFile", label="Output File", description="", value=None)
desc.IntParam(name="frameCount", label="Frame Count", description="", value=0, range=(0, 1000, 1))

After:

desc.File(name="outputFile")          # label="Output File", description="", isDynamicValue=True as output
desc.IntParam(name="frameCount", range=(0, 1000, 1))  # label="Frame Count", description="", value=0 as input

Features list

  • label=None on all attribute constructors — auto-generated from the name via convertToLabel() (camelCase → "Camel Case", snake_case → "Snake Case", acronyms preserved: useGPU"Use GPU")
  • description=None on all attribute constructors — defaults to ""
  • value=None on all typed param constructors — when used as an output, the attribute is isDynamicValue=True (value computed at runtime); when used as an input, the runtime value is the type's zero-value (str()→"", int()→0, float()→0.0, bool()→False)
  • Fix mutable default values=[] in ChoiceParamvalues=None
  • convertToLabel(name) added to desc/attribute.py (mirrors existing implementation in bin/meshroom_newNodeType)
  • Unit tests in tests/test_attributeDescDefaults.py covering minimal creation for all types, isDynamicValue on descriptors, input type defaults at runtime, and output None values before computation

Implementation remarks

getDefaultValue() in meshroom/core/attribute.py was extended: when desc.value is None, the attribute is an input, and _valueType is not None, it returns _valueType() instead of None. This gives typed inputs a sensible default without requiring node authors to specify it explicitly.

ListAttribute and GroupAttribute always initialize with value=[] / value={} internally, so they remain isDynamicValue=False regardless.

Param.__init__ retains positional-style signature internally; the optional defaults are applied at each concrete subclass level and propagate upward.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ptors with auto-label generation

Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update attributes to make label and description optional Make label, description, and value optional on all attribute descriptors Mar 13, 2026
Copilot AI requested a review from fabiencastan March 13, 2026 19:15
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 95.74468% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.36%. Comparing base (9ccb5e5) to head (e938a1d).
⚠️ Report is 18 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
meshroom/core/desc/attribute.py 90.69% 4 Missing ⚠️
tests/test_attributeDescDefaults.py 97.84% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3042      +/-   ##
===========================================
+ Coverage    83.05%   83.36%   +0.30%     
===========================================
  Files           72       73       +1     
  Lines         9657     9843     +186     
===========================================
+ Hits          8021     8206     +185     
- Misses        1636     1637       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread meshroom/core/desc/attribute.py Outdated
Comment thread meshroom/core/desc/attribute.py Outdated
@fabiencastan fabiencastan added the feature new feature (proposed as PR or issue planned by dev) label Mar 13, 2026
@fabiencastan fabiencastan added this to the Meshroom 2026.1.0 milestone Mar 13, 2026
…fault value behavior

Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot AI changed the title Make label, description, and value optional on all attribute descriptors Make attribute label, description, and value optional with auto-label generation + add unit tests Mar 13, 2026
Copilot AI requested a review from fabiencastan March 13, 2026 21:05
@fabiencastan fabiencastan marked this pull request as ready for review March 16, 2026 15:06
Comment thread meshroom/core/attribute.py Outdated
Comment thread meshroom/core/desc/attribute.py Outdated
@fabiencastan fabiencastan merged commit 4fe1cb5 into develop Mar 18, 2026
4 checks passed
@fabiencastan fabiencastan deleted the copilot/update-attributes-defaults branch March 18, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature new feature (proposed as PR or issue planned by dev)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants