liminal-orm 1.0.3__py3-none-any.whl → 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,16 @@ from typing import Any
3
3
 
4
4
 
5
5
  class BaseDropdown(ABC):
6
+ """_summary_
7
+
8
+ Parameters
9
+ ----------
10
+ __benchling_name__: str
11
+ The name of the dropdown in Benchling. There can be no duplicate dropdown names in Benchling.
12
+ __allowed_values__: list[str]
13
+ The list of values for the dropdown. Order matters and reflects the order of the dropdown in Benchling. Values must be unique.
14
+ """
15
+
6
16
  __benchling_name__: str
7
17
  __allowed_values__: list[str]
8
18
 
@@ -27,9 +27,9 @@ class BenchlingService(Benchling):
27
27
  The connection object that contains the credentials for the Benchling tenant.
28
28
  use_api: bool
29
29
  Whether to connect to the Benchling SDK. Requires api_client_id and api_client_secret from the connection object.
30
- use_db: bool
30
+ use_db: bool = False
31
31
  Whether to connect to the Benchling Postgres database. Requires warehouse_connection_string from the connection object.
32
- use_internal_api: bool
32
+ use_internal_api: bool = False
33
33
  Whether to connect to the Benchling internal API. Requires internal_api_admin_email and internal_api_admin_password from the connection object.
34
34
  """
35
35
 
@@ -165,7 +165,7 @@ class Revision(BaseModel):
165
165
  Path
166
166
  The path to the revision file that was written.
167
167
  """
168
- created_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
168
+ created_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
169
169
  upgrade_operation_strings = [
170
170
  o.revision_file_string() for o in self.upgrade_operations
171
171
  ]
liminal/migrate/utils.py CHANGED
@@ -15,8 +15,9 @@ def _check_env_file(env_file_path: Path) -> None:
15
15
  def read_local_env_file(
16
16
  env_file_path: Path, benchling_tenant: str
17
17
  ) -> tuple[str, BenchlingConnection]:
18
- """Imports the env.py file from the current working directory and returns the CURRENT_REVISION_ID variable.
18
+ """Imports the env.py file from the current working directory and returns the CURRENT_REVISION_ID variable along with the BenchlingConnection object.
19
19
  The env.py file is expected to have the CURRENT_REVISION_ID variable set to the revision id you are currently on.
20
+ The BenchlingConnection object is expected to be defined and have connection information for the Benchling API client and internal API.
20
21
  """
21
22
  _check_env_file(env_file_path)
22
23
  module_path = Path.cwd() / env_file_path
@@ -26,22 +27,34 @@ def read_local_env_file(
26
27
  module = importlib.util.module_from_spec(spec)
27
28
  spec.loader.exec_module(module)
28
29
  for attr_name in dir(module):
29
- attr = getattr(module, attr_name)
30
- if isinstance(attr, BenchlingConnection) and (
31
- benchling_tenant == attr.tenant_name
32
- or benchling_tenant == attr.tenant_alias
33
- ):
30
+ bc = getattr(module, attr_name)
31
+ if isinstance(bc, BenchlingConnection):
32
+ if not (
33
+ benchling_tenant == bc.tenant_name
34
+ or benchling_tenant == bc.tenant_alias
35
+ ):
36
+ raise Exception(
37
+ f"tenant name {benchling_tenant} does not match tenant name {bc.tenant_name} or alias {bc.tenant_alias} in liminal/env.py."
38
+ )
39
+ if not bc.api_client_id or not bc.api_client_secret:
40
+ raise Exception(
41
+ "api_client_id and api_client_secret must be provided in BenchlingConnection in liminal/env.py. This is necessary for the migration service."
42
+ )
43
+ if not bc.internal_api_admin_email or not bc.internal_api_admin_password:
44
+ raise Exception(
45
+ "internal_api_admin_email and internal_api_admin_password must be provided in BenchlingConnection in liminal/env.py. This is necessary for the migration service."
46
+ )
34
47
  try:
35
48
  current_revision_id: str = getattr(
36
- module, attr.current_revision_id_var_name
49
+ module, bc.current_revision_id_var_name
37
50
  )
38
- return current_revision_id, attr
51
+ return current_revision_id, bc
39
52
  except Exception as e:
40
53
  raise Exception(
41
- f"CURRENT_REVISION_ID variable not found in liminal/env.py. Given variable name: {attr.current_revision_id_var_name}"
54
+ f"CURRENT_REVISION_ID variable not found in liminal/env.py. Given variable name: {bc.current_revision_id_var_name}"
42
55
  ) from e
43
56
  raise Exception(
44
- f"BenchlingConnection with tenant_name {benchling_tenant} not found in liminal/env.py. Please update the env.py file with the correctly defined BenchlingConnection."
57
+ "BenchlingConnection not found in liminal/env.py. Please update the env.py file with a correctly defined BenchlingConnection."
45
58
  )
46
59
 
47
60
 
liminal/orm/column.py CHANGED
@@ -15,21 +15,21 @@ class Column(SqlColumn):
15
15
 
16
16
  Parameters
17
17
  ----------
18
- name : str | None
18
+ name : str
19
19
  The external facing name of the field.
20
- type : BenchlingFieldType | None
20
+ type : BenchlingFieldType
21
21
  The type of the field.
22
- required : bool | None
22
+ required : bool
23
23
  Whether the field is required.
24
- is_multi : bool | None
24
+ is_multi : bool = False
25
25
  Whether the field is a multi-value field.
26
- parent_link : bool | None
26
+ parent_link : bool = False
27
27
  Whether the entity link field is a parent of the entity schema.
28
- dropdown : str | None
29
- The name of the dropdown for the field.
30
- entity_link : str | None
28
+ dropdown : Type[BaseDropdown] | None = None
29
+ The dropdown for the field.
30
+ entity_link : str | None = None
31
31
  The warehouse name of the entity the field links to.
32
- tooltip : str | None
32
+ tooltip : str | None = None
33
33
  The tooltip text for the field.
34
34
  """
35
35
 
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: liminal-orm
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync.
5
+ Home-page: https://github.com/dynotx/liminal-orm
5
6
  Author: DynoTx Open Source
6
7
  Author-email: opensource@dynotx.com
7
8
  Requires-Python: >=3.9,<4
@@ -19,26 +20,30 @@ Requires-Dist: rich (>=13.9.2,<14.0.0)
19
20
  Requires-Dist: sqlalchemy (<2)
20
21
  Requires-Dist: tenacity (>=8,<10)
21
22
  Requires-Dist: typer (>=0.12.5,<0.13.0)
23
+ Project-URL: Bug Tracker, https://github.com/dynotx/liminal-orm/issues
24
+ Project-URL: Documentation, https://dynotx.github.io/liminal-orm/
25
+ Project-URL: Repository, https://github.com/dynotx/liminal-orm
22
26
  Description-Content-Type: text/markdown
23
27
 
24
28
  # [Liminal ORM](#liminal-orm)
25
29
 
26
- Liminal ORM<sup>1</sup> is a Python package that builds on top of [Benchling](https://www.benchling.com/)'s LIMS<sup>2</sup> platform to keep your Benchling schemas and downstream code dependencies in sync. Liminal provides an ORM framework using [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy) that allows you to define all your Benchling schemas in code. This creates a single source of truth that Benchling managers can use to keep multiple tenants in sync. This enables a code-first approach for managing Benchling tenants and accessing Benchling data. With the schemas defined in code, you can now take advantage of the additional capabilities that the Liminal toolkit provides. This includes:
30
+ Liminal ORM<sup>1</sup> is an open-source Python package that builds on [Benchling's](https://www.benchling.com/) LIMS<sup>2</sup> platform and provides a simple framework to keep your upstream Benchling schemas and downstream dependencies in sync. Liminal provides an ORM framework using [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy) along with a schema migration service inspired by [Alembic](https://alembic.sqlalchemy.org/en/latest/). This allows you to define your Benchling schemas in code and create a *single source of truth* that synchronizes with your upstream Benchling tenant(s) and downstream dependencies. Through one line CLI commands, Liminal enables a code-first approach for managing Benchling tenants and accessing Benchling data. With the schemas defined in code, you can also take advantage of the additional capabilities that the Liminal toolkit provides. This includes:
27
31
 
28
- - The ability to run migrations to your Benchling tenant(s) through an easy to use CLI<sup>3</sup>.
32
+ - The ability to run migrations to your Benchling tenant(s) through an easy to use CLI.
29
33
  - One source of truth defined in code for your Benchling schema model that your many Benchling tenants can stay in sync with.
30
34
  - Easy to implement validation rules to reflect business logic for all of your Benchling entities.
31
35
  - Strongly typed queries for all your Benchling entities.
32
36
  - CI/CD integration with GitHub Actions to ensure that your Benchling schemas and code are always in sync.
33
- - And more!
37
+ - And more based on community contributions/feedback :)
34
38
 
35
39
  Benchling is an industry standard cloud platform for life sciences R&D. Liminal builds on top of Benchling's platform and assumes that you already have a Benchling tenant set up and have (or have access to) an admin user account. If not, learn more about getting started with Benchling [here](https://www.benchling.com/explore-benchling)!
36
40
 
37
- For a full and in-depth overview of Liminal, please refer to our [full documentation](https://dynotx.github.io/liminal-orm/). Below is a [quickstart guide](#getting-started) to get you Liminal set up in your project.
41
+ If you are a Benchling user, try out Liminal by following the [quickstart guide](./getting-started/prerequisites.md)! Reach out in the [Discussions](https://github.com/dynotx/liminal-orm/discussions) forum with any questions or to simply introduce yourself! If there is something blocking you from using Liminal or you're having trouble setting Liminal up, please share in [Issues](https://github.com/dynotx/liminal-orm/issues) or reach out directly (contact information below). You can expect responses within 48 hours :)
38
42
 
39
- Reach out in the [Discussions](https://github.com/dynotx/liminal-orm/discussions) forum with any questions or to simply introduce yourself! If you run into any issues, during setup or usage, don't hesitate to post in [Issues](https://github.com/dynotx/liminal-orm/issues) or reach out directly at <opensource@dynotx.com>. You can expect responses within 48 hours :)
43
+ Nirmit Damania is the creator and current maintainer of Liminal (I post Liminal updates to [Discussions](https://github.com/dynotx/liminal-orm/discussions) and my [LinkedIn](https://www.linkedin.com/in/nirmit-damania/)). Most importantly, **you** have the ability to influence the future of Liminal! Any feedback, positive or negative, is highly encouraged and will be used to steer the direction of Liminal. Refer to the [Contributing guide](https://github.com/dynotx/liminal-orm/blob/main/CONTRIBUTING.md) to learn more about how you can contribute to Liminal.
40
44
 
41
45
  ⭐️ Leave a star on the repo to spread the word!
46
+ If you or your organization use Liminal, please consider adding yourself or your organization to the [Users](https://github.com/dynotx/liminal-orm/blob/main/USERS.md) list.
42
47
 
43
48
  <img width="793" alt="liminal_simple_graph" src="https://github.com/user-attachments/assets/52e32cd0-3407-49f5-b100-5763bee3830c">
44
49
 
@@ -50,6 +55,7 @@ Reach out in the [Discussions](https://github.com/dynotx/liminal-orm/discussions
50
55
  - [Setup](#setup)
51
56
  - [Migration](#migration)
52
57
  - [Toolkit](#toolkit)
58
+ - [Mission](#mission)
53
59
  - [Community](#community)
54
60
  - [Contributing](#contributing)
55
61
  - [License](#license)
@@ -141,18 +147,22 @@ With your schemas defined in code, you can now take advantage of the additional
141
147
  1. Entity validation: Easily create custom validation rules for your Benchling entities.
142
148
 
143
149
  ```python
144
- from dyno.liminal.orm.base_model import BaseModel
145
- from dyno.liminal.orm.mixins import CustomEntityMixin
146
-
147
- class Pizza(BaseModel, CustomEntityMixin):
148
- ...
149
-
150
- @validator(BenchlingReportLevel.HIGH)
151
- def cook_temp_time(self):
152
- if self.cook_time is not None and self.cook_temp is None:
153
- raise ValueError("Cook temp is required if cook time is set")
154
- if self.cook_time is None and self.cook_temp is not None:
155
- raise ValueError("Cook time is required if cook temp is set")
150
+ from liminal.validation import BenchlingValidator, BenchlingValidatorReport, BenchlingReportLevel
151
+ from liminal.orm.base_model import BaseModel
152
+
153
+ class CookTempValidator(BenchlingValidator):
154
+ """Validates that a field value is a valid enum value for a Benchling entity"""
155
+
156
+ def validate(self, entity: type[BaseModel]) -> BenchlingValidatorReport:
157
+ valid = True
158
+ message = None
159
+ if entity.cook_time is not None and entity.cook_temp is None:
160
+ valid = False
161
+ message = "Cook temp is required if cook time is set"
162
+ if entity.cook_time is None and entity.cook_temp is not None:
163
+ valid = False
164
+ message = "Cook time is required if cook temp is set"
165
+ return self.create_report(valid, BenchlingReportLevel.MED, entity, message)
156
166
  ```
157
167
 
158
168
  2. Strongly typed queries: Write type-safe queries using SQLAlchemy to access your Benchling entities.
@@ -167,6 +177,10 @@ With your schemas defined in code, you can now take advantage of the additional
167
177
 
168
178
  4. And more to come!
169
179
 
180
+ ## [Mission](#mission)
181
+
182
+ The democratization of software in Biotech is crucial. By building a community around complex, yet common, problems and creating open-source solutions, we can work together to tackle these challenges together and enable faster innovation in the industry. By breaking down the silos between private platforms, we can enable a more dynamic and open ecosystem. This was the motivation for Liminal's creation. Liminal's goal is to create an open-source software product that enables a standard, code-first approach to configuration and change management for LIMS systems. We started with Benchling, but the goal is to make Liminal the go-to solution for any LIMS system.
183
+
170
184
  ## [Community](#community)
171
185
 
172
186
  We're excited to hear from you! Feel free to introduce yourself on the [Liminal GitHub Discussions page](https://github.com/dynotx/liminal-orm/discussions/categories/intros)
@@ -184,6 +198,11 @@ Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) to learn how to contribute
184
198
 
185
199
  Liminal ORM is distributed under the [Apache License, Version 2.0](./LICENSE.md).
186
200
 
201
+ ## [Direct Contact](#direct-contact)
202
+
203
+ - Email: <opensource@dynotx.com>
204
+ - LinkedIn: [Nirmit Damania](https://www.linkedin.com/in/nirmit-damania/)
205
+
187
206
  ## [Acknowledgements](#acknowledgements)
188
207
 
189
208
  This project could not have been started without the support of Dyno Therapeutics and the help of the following people.
@@ -1,5 +1,5 @@
1
1
  liminal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- liminal/base/base_dropdown.py,sha256=cRJV-E1XDGO94pjXlRIwJag-tkJrNOKX6CTD_7Dk9r4,2167
2
+ liminal/base/base_dropdown.py,sha256=Unk4l_5Y8rj_eSWYqzFi2BAFSQToQDWW2qdXwiCHTg8,2523
3
3
  liminal/base/base_operation.py,sha256=Yi0EOyLzXOFjiX4lGZW2mV_uo0lxfyRMs9-6HFVxf1w,3101
4
4
  liminal/base/base_validation_filters.py,sha256=2Q4QhqDSloZqc313p_fc8dnSw0uMhk_iMtsEtsC_5LQ,536
5
5
  liminal/base/compare_operation.py,sha256=hkpv4ewHhxy4dlTPKgJuzBjsAqO6Km7OrrKB44pRA_o,352
@@ -12,7 +12,7 @@ liminal/cli/live_test_dropdown_migration.py,sha256=i20JkY5xmLffHrB73WOl3Tjyb4V2R
12
12
  liminal/cli/live_test_entity_schema_migration.py,sha256=X03tEYYHYDXeXHWgLc9tcwksKVvr0b7nlYQndDS4MvA,5683
13
13
  liminal/connection/__init__.py,sha256=3z4pSANIOkc9mh1Xp763oYQuJZDEh4lauN901PU4vqI,166
14
14
  liminal/connection/benchling_connection.py,sha256=ZcKmaQE6T_yjAaSPF69e2PnhoZz5yZ_0TywjVykr0TM,2358
15
- liminal/connection/benchling_service.py,sha256=SEydyYUV3Zm55gAWs8tL2U9feLgbZITV_hH40aXIfBU,7397
15
+ liminal/connection/benchling_service.py,sha256=DQDeRjgoUHeFisY5xZXJJ-Vb0xE8lu6hXj--j5kEvnU,7413
16
16
  liminal/dropdowns/api.py,sha256=n5oxi1EhkmpmPpNi1LOI4xcIQmk1C069XFaGP5XSBx8,6959
17
17
  liminal/dropdowns/compare.py,sha256=5cz8djtaStozUun_Cp8t_5PVjq-aovme2Qq5J8FXFg4,6829
18
18
  liminal/dropdowns/generate_files.py,sha256=IqnBs-IyLsIZE0NUkdB99zd5EAF-1f9CPBeblz-GzJE,2041
@@ -36,12 +36,12 @@ liminal/enums/benchling_sequence_type.py,sha256=TBI4C5c1XKE4ZXqsz1ApDUzy2wR-04u-
36
36
  liminal/external/__init__.py,sha256=5VrSpJ3wPedgoCrtMwvv2CM7u70KSwiTAt_1yU2Oje0,1052
37
37
  liminal/mappers.py,sha256=gevTAWU5nJe8hgUuOezhwFvnaVqVnURamafmq3w1fDU,8539
38
38
  liminal/migrate/components.py,sha256=ShkcYM3tfdfF01HbuPI_yrGpV8oxSLzJJ0tA1ZutQ3I,3328
39
- liminal/migrate/revision.py,sha256=0D8TbOO0aVcUpZoevqyDp_qkHNFaXy78aWOvVho9Pxw,7777
39
+ liminal/migrate/revision.py,sha256=KppU0u-d0JsfPsXsmncxy9Q_XBJyf-o4e16wNZAJODM,7774
40
40
  liminal/migrate/revisions_timeline.py,sha256=06qf_7E1Hecucfczpm85rV3ATLDjpCf7y6TUfah5aLM,14450
41
- liminal/migrate/utils.py,sha256=0TOhlfCowqQ1WMp1O5VIGcULxbsfkvR5wdJJYcM7h7Q,2578
41
+ liminal/migrate/utils.py,sha256=geVe2da2VB9wSaiv1-3GtTRM3l23fDDk3JQQCpUCZ48,3528
42
42
  liminal/orm/base.py,sha256=fFSpiNRYgK5UG7lbXdQGV8KgO8pwjMqt0pycM3rWJ2o,615
43
43
  liminal/orm/base_model.py,sha256=dLbhAFaD2hPEbEmAQTkMBRumkthGWdSd0YjHcbzE4hU,10925
44
- liminal/orm/column.py,sha256=robViEET2y0ugPxssOI4ZcDpVES6HSgeQ-0ZtyX4qSw,4504
44
+ liminal/orm/column.py,sha256=dSYtqjpPgF2ECvw7CJ1AiMLGF8TdYT7IdaebIA0U_t8,4509
45
45
  liminal/orm/mixins.py,sha256=wm5DvI_6th94bfsgsbwzFSvTRbjEZfdT6R85J_NjvOc,4356
46
46
  liminal/orm/relationship.py,sha256=Zl4bMHbtDSPx1psGHYnojGGJpA8B8hwcPJdgjB1lmW0,2490
47
47
  liminal/orm/schema_properties.py,sha256=vZBOwS2SFtI6CjlYsaGno08TpXi47PC832mPmCJM3KI,2049
@@ -54,8 +54,8 @@ liminal/tests/test_dropdown_compare.py,sha256=yHB0ovQlBLRu8-qYkqIPd8VtYEOmOft_93
54
54
  liminal/tests/test_entity_schema_compare.py,sha256=FBYxqIB9oeFArWYKnbGV8I7NPzv2syziaPjEQg-wZ1o,15529
55
55
  liminal/utils.py,sha256=UT07vILwm9fu8DLgwIxMm1DxEPFIIsW-0mgBU8oNrNY,2566
56
56
  liminal/validation/__init__.py,sha256=SBd48xxBMJrBzI48G2RcK056EMlevt5YjmZMkfCWN1I,6924
57
- liminal_orm-1.0.3.dist-info/LICENSE.md,sha256=oVA877F_D1AV44dpjsv4f-4k690uNGApX1EtzOo3T8U,11353
58
- liminal_orm-1.0.3.dist-info/METADATA,sha256=kZKg7zRldnulEPHB9ryLiPzSs9EnRYil6QbJSBLJT48,11796
59
- liminal_orm-1.0.3.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
60
- liminal_orm-1.0.3.dist-info/entry_points.txt,sha256=atIrU63rrzH81dWC2sjUbFLlc5FWMmYRdMxXEWexIZA,47
61
- liminal_orm-1.0.3.dist-info/RECORD,,
57
+ liminal_orm-1.0.4.dist-info/LICENSE.md,sha256=oVA877F_D1AV44dpjsv4f-4k690uNGApX1EtzOo3T8U,11353
58
+ liminal_orm-1.0.4.dist-info/METADATA,sha256=qJ5daAJRXXiSRdnqu8hwiarlXrF8pkB85gcm1hORNBw,14118
59
+ liminal_orm-1.0.4.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
60
+ liminal_orm-1.0.4.dist-info/entry_points.txt,sha256=atIrU63rrzH81dWC2sjUbFLlc5FWMmYRdMxXEWexIZA,47
61
+ liminal_orm-1.0.4.dist-info/RECORD,,