-
Notifications
You must be signed in to change notification settings - Fork 7
[v4.0] Restrict top-level design space types. #1015
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
Merged
anoto-moniz
merged 1 commit into
release/v4.0
from
feature/restrict-top-level-design-spaces
Jan 28, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,87 +1,10 @@ | ||
| """Tools for working with design spaces.""" | ||
| from typing import Optional, Type | ||
| from uuid import UUID | ||
|
|
||
| from citrine._rest.asynchronous_object import AsynchronousObject | ||
| from citrine._serialization import properties | ||
| from citrine._serialization.polymorphic_serializable import PolymorphicSerializable | ||
| from citrine._serialization.serializable import Serializable | ||
| from citrine._session import Session | ||
| from citrine.resources.sample_design_space_execution import \ | ||
| SampleDesignSpaceExecutionCollection | ||
|
|
||
|
|
||
| __all__ = ['DesignSpace'] | ||
|
|
||
|
|
||
| class DesignSpace(PolymorphicSerializable['DesignSpace'], AsynchronousObject): | ||
| """A Citrine Design Space describes the set of materials that can be made. | ||
| class DesignSpace: | ||
| """Parent type of the individual design space on the Citrine Platform. | ||
|
|
||
| Abstract type that returns the proper type given a serialized dict. | ||
| The Predictor class unifies TopLevelDesignSpace types and the DesignSubspace types, | ||
| but does not provide any functionality on its own. | ||
|
|
||
| """ | ||
|
|
||
| uid = properties.Optional(properties.UUID, 'id', serializable=False) | ||
| """:Optional[UUID]: Citrine Platform unique identifier""" | ||
| name = properties.String('data.name') | ||
| description = properties.Optional(properties.String(), 'data.description') | ||
|
|
||
| locked_by = properties.Optional(properties.UUID, 'metadata.locked.user', | ||
| serializable=False) | ||
| """:Optional[UUID]: id of the user whose action cause the design space to | ||
| be locked, if it is locked""" | ||
| lock_time = properties.Optional(properties.Datetime, 'metadata.locked.time', | ||
| serializable=False) | ||
| """:Optional[datetime]: date and time at which the resource was locked, | ||
| if it is locked""" | ||
|
|
||
| @staticmethod | ||
| def wrap_instance(subspace_data: dict) -> dict: | ||
| """Insert a serialized embedded design space into an entity envelope. | ||
|
|
||
| This facilitates deserialization. | ||
| """ | ||
| return { | ||
| "data": { | ||
| "name": subspace_data.get("name", ""), | ||
| "description": subspace_data.get("description", ""), | ||
| "instance": subspace_data | ||
| } | ||
| } | ||
|
|
||
| _response_key = None | ||
| _project_id: Optional[UUID] = None | ||
| _session: Optional[Session] = None | ||
| _in_progress_statuses = ["VALIDATING", "CREATED"] | ||
| _succeeded_statuses = ["READY"] | ||
| _failed_statuses = ["INVALID", "ERROR"] | ||
|
|
||
| @classmethod | ||
| def get_type(cls, data) -> Type[Serializable]: | ||
| """Return the subtype.""" | ||
| from .data_source_design_space import DataSourceDesignSpace | ||
| from .enumerated_design_space import EnumeratedDesignSpace | ||
| from .formulation_design_space import FormulationDesignSpace | ||
| from .product_design_space import ProductDesignSpace | ||
| from .hierarchical_design_space import HierarchicalDesignSpace | ||
|
|
||
| return { | ||
| 'Univariate': ProductDesignSpace, | ||
| 'ProductDesignSpace': ProductDesignSpace, | ||
| 'EnumeratedDesignSpace': EnumeratedDesignSpace, | ||
| 'FormulationDesignSpace': FormulationDesignSpace, | ||
| 'DataSourceDesignSpace': DataSourceDesignSpace, | ||
| 'HierarchicalDesignSpace': HierarchicalDesignSpace | ||
| }[data['data']['instance']['type']] | ||
|
|
||
| @property | ||
| def is_locked(self) -> bool: | ||
| """If is_locked is true, edits to the design space will be rejected.""" | ||
| return self.locked_by is not None | ||
|
|
||
| @property | ||
| def sample_design_space_executions(self): | ||
| """Start a Sample Design Space Execution using the current Design Space.""" | ||
| return SampleDesignSpaceExecutionCollection( | ||
| project_id=self._project_id, design_space_id=self.uid, session=self._session | ||
| ) |
62 changes: 0 additions & 62 deletions
62
src/citrine/informatics/design_spaces/enumerated_design_space.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this technically a migration? It doesn't look like running
currently issues a deprecation warning. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecation warning is only issued if the user attempts to read or write any of the deprecated types.