Skip to content

Conversation

@AndrewSazonov
Copy link
Member

@AndrewSazonov AndrewSazonov commented Sep 25, 2025

This PR makes a major refactor of the core object system, improves type safety, and updates related APIs, tests, and CI.

Core refactor

  • Split object.py into parameters.py, categories.py, datablocks.py, and guards.py.
  • Split Collection into CategoryCollection and DatablockCollection for clearer semantics.
  • Rename Component to CategoryItem for consistency.
  • Switch from _locked to a public attributes set to restrict allowed attributes.
  • Switch to randomly generated uid (with full_name and cif_uid preserved).

API & Parameters

  • Split add into dedicated methods in SampleModel. Temporary name: add_from_args.
  • Add value_type, default_value, and full_cif_names to Descriptor.
  • Move CIF-specific logic for parameters into a dedicated mixin.
  • Improve consistency by using name instead of id across parameters, categories, and datablocks.
  • Add support for parsing CIF parameters with the uncertainties package.

Validation & Logging

  • Introduce guards system for type/range validation and to block invalid attributes.
  • Reimplement custom logger using rich with support for log levels and modes.

Tests, Tutorials & CI

  • Update tutorials, unit tests, and functional tests to the new API.
  • Improve CI with auto-triggered dashboard builds.
  • Add hidden editable install of easydiffraction via uv (using pixi tasks) to avoid permanent pixi.lock change.

Solves #21

AndrewSazonov and others added 30 commits September 16, 2025 12:50
Release: merge develop into master
Release: merge develop into master
Release: merge develop into master
@AndrewSazonov AndrewSazonov force-pushed the 21-refactor-the-samplemodeladd branch from df3000a to e49c142 Compare October 16, 2025 07:41
@AndrewSazonov AndrewSazonov merged commit 0b21681 into develop Oct 16, 2025
43 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants