Skip to content

Commit fb4103c

Browse files
Merge pull request #47 from biosimulations/improve-package-representation-in-db
Improve Package Representation in DB
2 parents c99a115 + 60ab5df commit fb4103c

30 files changed

+1658
-634
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

compose_api/api/client/models/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
"""Contains all the data models used in inputs/outputs"""
22

3+
from .bi_graph_compute_type import BiGraphComputeType
4+
from .bi_graph_process import BiGraphProcess
5+
from .bi_graph_step import BiGraphStep
36
from .body_analyze_simulation_omex import BodyAnalyzeSimulationOmex
47
from .body_run_simulation import BodyRunSimulation
58
from .check_health_health_get_response_check_health_health_get import CheckHealthHealthGetResponseCheckHealthHealthGet
69
from .containerization_file_repr import ContainerizationFileRepr
7-
from .experiment_primary_dependencies import ExperimentPrimaryDependencies
810
from .hpc_run import HpcRun
911
from .http_validation_error import HTTPValidationError
1012
from .job_status import JobStatus
1113
from .job_type import JobType
14+
from .package_type import PackageType
15+
from .registered_package import RegisteredPackage
1216
from .registered_simulators import RegisteredSimulators
1317
from .simulation_experiment import SimulationExperiment
1418
from .simulation_experiment_metadata import SimulationExperimentMetadata
1519
from .simulator_version import SimulatorVersion
1620
from .validation_error import ValidationError
1721

1822
__all__ = (
23+
"BiGraphComputeType",
24+
"BiGraphProcess",
25+
"BiGraphStep",
1926
"BodyAnalyzeSimulationOmex",
2027
"BodyRunSimulation",
2128
"CheckHealthHealthGetResponseCheckHealthHealthGet",
2229
"ContainerizationFileRepr",
23-
"ExperimentPrimaryDependencies",
2430
"HpcRun",
2531
"HTTPValidationError",
2632
"JobStatus",
2733
"JobType",
34+
"PackageType",
35+
"RegisteredPackage",
2836
"RegisteredSimulators",
2937
"SimulationExperiment",
3038
"SimulationExperimentMetadata",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from enum import Enum
2+
3+
4+
class BiGraphComputeType(str, Enum):
5+
PROCESS = "process"
6+
STEP = "step"
7+
8+
def __str__(self) -> str:
9+
return str(self.value)
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
from collections.abc import Mapping
2+
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
3+
4+
from attrs import define as _attrs_define
5+
from attrs import field as _attrs_field
6+
7+
from ..types import UNSET, Unset
8+
9+
from ..models.bi_graph_compute_type import BiGraphComputeType
10+
11+
12+
T = TypeVar("T", bound="BiGraphProcess")
13+
14+
15+
@_attrs_define
16+
class BiGraphProcess:
17+
"""
18+
Attributes:
19+
database_id (int):
20+
module (str):
21+
name (str):
22+
compute_type (BiGraphComputeType):
23+
inputs (str):
24+
outputs (str):
25+
"""
26+
27+
database_id: int
28+
module: str
29+
name: str
30+
compute_type: BiGraphComputeType
31+
inputs: str
32+
outputs: str
33+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34+
35+
def to_dict(self) -> dict[str, Any]:
36+
database_id = self.database_id
37+
38+
module = self.module
39+
40+
name = self.name
41+
42+
compute_type = self.compute_type.value
43+
44+
inputs = self.inputs
45+
46+
outputs = self.outputs
47+
48+
field_dict: dict[str, Any] = {}
49+
field_dict.update(self.additional_properties)
50+
field_dict.update({
51+
"database_id": database_id,
52+
"module": module,
53+
"name": name,
54+
"compute_type": compute_type,
55+
"inputs": inputs,
56+
"outputs": outputs,
57+
})
58+
59+
return field_dict
60+
61+
@classmethod
62+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
63+
d = dict(src_dict)
64+
database_id = d.pop("database_id")
65+
66+
module = d.pop("module")
67+
68+
name = d.pop("name")
69+
70+
compute_type = BiGraphComputeType(d.pop("compute_type"))
71+
72+
inputs = d.pop("inputs")
73+
74+
outputs = d.pop("outputs")
75+
76+
bi_graph_process = cls(
77+
database_id=database_id,
78+
module=module,
79+
name=name,
80+
compute_type=compute_type,
81+
inputs=inputs,
82+
outputs=outputs,
83+
)
84+
85+
bi_graph_process.additional_properties = d
86+
return bi_graph_process
87+
88+
@property
89+
def additional_keys(self) -> list[str]:
90+
return list(self.additional_properties.keys())
91+
92+
def __getitem__(self, key: str) -> Any:
93+
return self.additional_properties[key]
94+
95+
def __setitem__(self, key: str, value: Any) -> None:
96+
self.additional_properties[key] = value
97+
98+
def __delitem__(self, key: str) -> None:
99+
del self.additional_properties[key]
100+
101+
def __contains__(self, key: str) -> bool:
102+
return key in self.additional_properties
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
from collections.abc import Mapping
2+
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
3+
4+
from attrs import define as _attrs_define
5+
from attrs import field as _attrs_field
6+
7+
from ..types import UNSET, Unset
8+
9+
from ..models.bi_graph_compute_type import BiGraphComputeType
10+
11+
12+
T = TypeVar("T", bound="BiGraphStep")
13+
14+
15+
@_attrs_define
16+
class BiGraphStep:
17+
"""
18+
Attributes:
19+
database_id (int):
20+
module (str):
21+
name (str):
22+
compute_type (BiGraphComputeType):
23+
inputs (str):
24+
outputs (str):
25+
"""
26+
27+
database_id: int
28+
module: str
29+
name: str
30+
compute_type: BiGraphComputeType
31+
inputs: str
32+
outputs: str
33+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34+
35+
def to_dict(self) -> dict[str, Any]:
36+
database_id = self.database_id
37+
38+
module = self.module
39+
40+
name = self.name
41+
42+
compute_type = self.compute_type.value
43+
44+
inputs = self.inputs
45+
46+
outputs = self.outputs
47+
48+
field_dict: dict[str, Any] = {}
49+
field_dict.update(self.additional_properties)
50+
field_dict.update({
51+
"database_id": database_id,
52+
"module": module,
53+
"name": name,
54+
"compute_type": compute_type,
55+
"inputs": inputs,
56+
"outputs": outputs,
57+
})
58+
59+
return field_dict
60+
61+
@classmethod
62+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
63+
d = dict(src_dict)
64+
database_id = d.pop("database_id")
65+
66+
module = d.pop("module")
67+
68+
name = d.pop("name")
69+
70+
compute_type = BiGraphComputeType(d.pop("compute_type"))
71+
72+
inputs = d.pop("inputs")
73+
74+
outputs = d.pop("outputs")
75+
76+
bi_graph_step = cls(
77+
database_id=database_id,
78+
module=module,
79+
name=name,
80+
compute_type=compute_type,
81+
inputs=inputs,
82+
outputs=outputs,
83+
)
84+
85+
bi_graph_step.additional_properties = d
86+
return bi_graph_step
87+
88+
@property
89+
def additional_keys(self) -> list[str]:
90+
return list(self.additional_properties.keys())
91+
92+
def __getitem__(self, key: str) -> Any:
93+
return self.additional_properties[key]
94+
95+
def __setitem__(self, key: str, value: Any) -> None:
96+
self.additional_properties[key] = value
97+
98+
def __delitem__(self, key: str) -> None:
99+
del self.additional_properties[key]
100+
101+
def __contains__(self, key: str) -> bool:
102+
return key in self.additional_properties

compose_api/api/client/models/experiment_primary_dependencies.py

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from enum import Enum
2+
3+
4+
class PackageType(str, Enum):
5+
CONDA = "conda"
6+
PYPI = "pypi"
7+
8+
def __str__(self) -> str:
9+
return str(self.value)

0 commit comments

Comments
 (0)