Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the need for uses_tagged_union deco #140

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Conversation

coretl
Copy link
Contributor

@coretl coretl commented Aug 27, 2024

At present we support people adding to the list of Specs after importing the service. This requires a uses_tagged_union decorator on any BaseModel that references a Spec. We cannot currently think of a use case for Specs being implemented outside of scanspec.specs, so removing this requirement means we can ditch the decorator. It also makes the docs (next PR) easier to write:

  • Put your specs in src/scanspec/specs.py
  • Release a new version
  • Update both blueapi and the scanspec service to use that new version

At present we support people adding to the list
of Specs after importing the service. This requires a uses_tagged_union decorator on any
BaseModel that references a Spec. We cannot
currently think of a use case for Specs being implemented outside of scanspec.specs,
so removing this requirement means we can ditch the decorator. It also makes the docs (next PR) easier to write:
- Put your specs in src/scanspec/specs.py
- Release a new version
- Update both blueapi and the scanspec service to use that new version
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.89%. Comparing base (0f7329f) to head (9e6e436).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
- Coverage   96.05%   95.89%   -0.17%     
==========================================
  Files           9        9              
  Lines         939      926      -13     
==========================================
- Hits          902      888      -14     
- Misses         37       38       +1     

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

@DiamondJoseph
Copy link
Contributor

Blueapi requires being able to make BaseModels with fields that are Specs/Regions as we create BaseModels for the signature of plan functions. This looks from the tests that remain that this is still supported.

But if we're acknowledging that all Spec implementations will be in this library we can just make a hardcoded _Spec_ref = Line | ......

@coretl coretl merged commit f5251e8 into main Aug 30, 2024
21 of 22 checks passed
@coretl coretl deleted the remove-uses-tagged-union branch August 30, 2024 08:28
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.

3 participants