Skip to content

Adding SdkSettings utility class - #89

Merged
birkholz-cubert merged 6 commits into
developfrom
feature/add_settings_utilities
Aug 19, 2026
Merged

Adding SdkSettings utility class#89
birkholz-cubert merged 6 commits into
developfrom
feature/add_settings_utilities

Conversation

@birkholz-cubert

@birkholz-cubert birkholz-cubert commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Adds cuvis.SdkSettings, a utility for writing the SDK's cuvis.settings file from Python instead of maintaining it by hand.
Ported from an internal tool where the same pattern was already in use.

  • Build settings in code: cuvis.SdkSettings(force_gpu_mode="cuda", processing_thread_count=8).
  • Inspect and edit them like a dict - it is a MutableMapping, and xml_str shows the exact file that will be written.
  • Load an existing configuration from a settings file or from the directory containing one; keyword arguments override what was loaded.
  • Use it as a context manager to serialize it into a temporary directory, for pointing other consumers at the same configuration.
  • cuvis.init() accepts an SdkSettings directly, so cuvis.init(cuvis.SdkSettings(...)) works.
  • Values are stored as strings: bool becomes true/false, an Enum becomes its value, anything else goes through str(), and None drops the entry.
  • No new dependency - loaded files are validated with xml.etree.ElementTree rather than an XSD validator, which would have meant adding lxml.
  • 24 tests in tests/test_sdk_settings.py cover coercion, the mapping surface, loading from a file and a directory, round trips, the rejection cases and the context manager.

Documentation lives in the SdkSettings class docstring rather than in the README.

Known limitation, deliberately out of scope: setting ids are free-form, so a typo produces a valid file the SDK silently ignores.
No authoritative list of setting ids exists in this repository or in cuvis-il; sourcing one from the C SDK would be a separate change.

@birkholz-cubert
birkholz-cubert force-pushed the feature/add_settings_utilities branch 2 times, most recently from 68f6303 to ab50124 Compare August 19, 2026 11:59
@birkholz-cubert
birkholz-cubert force-pushed the feature/add_settings_utilities branch from 15dee98 to 49a45fc Compare August 19, 2026 13:16
@birkholz-cubert birkholz-cubert changed the title adding SdkSettings utility class Adding SdkSettings utility class Aug 19, 2026
@birkholz-cubert
birkholz-cubert merged commit 7886d5c into develop Aug 19, 2026
4 checks passed
@birkholz-cubert
birkholz-cubert deleted the feature/add_settings_utilities branch August 19, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant