liminal-orm 1.0.4.dev1__py3-none-any.whl → 1.0.6__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
 
@@ -97,3 +97,12 @@ class BaseSchemaProperties(BaseModel):
97
97
  if not isinstance(other, BaseSchemaProperties):
98
98
  return False
99
99
  return self.model_dump() == other.model_dump()
100
+
101
+ def __str__(self) -> str:
102
+ return ", ".join(
103
+ [f"{k}={v}" for k, v in self.model_dump(exclude_unset=True).items()]
104
+ )
105
+
106
+ def __repr__(self) -> str:
107
+ """Generates a string representation of the class so that it can be executed."""
108
+ return f"{self.__class__.__name__}({', '.join([f'{k}={v.__repr__()}' for k, v in self.model_dump(exclude_defaults=True).items()])})"
liminal/cli/cli.py CHANGED
@@ -79,7 +79,10 @@ def generate_files(
79
79
  ..., help="Benchling tenant (or alias) to connect to."
80
80
  ),
81
81
  write_path: Path = typer.Option(
82
- Path("."), help="The path to write the generated files to."
82
+ Path("."),
83
+ "-p",
84
+ "--write-path",
85
+ help="The path to write the generated files to.",
83
86
  ),
84
87
  ) -> None:
85
88
  current_revision_id, benchling_connection = read_local_env_file(
@@ -9,7 +9,12 @@ from bs4 import BeautifulSoup
9
9
  from sqlalchemy import create_engine
10
10
  from sqlalchemy.engine import Engine
11
11
  from sqlalchemy.orm import Session, configure_mappers
12
- from tenacity import retry, retry_if_exception_type, stop_after_attempt
12
+ from tenacity import (
13
+ retry,
14
+ retry_if_exception_type,
15
+ stop_after_attempt,
16
+ wait_exponential,
17
+ )
13
18
 
14
19
  from liminal.connection.benchling_connection import BenchlingConnection
15
20
 
@@ -27,9 +32,9 @@ class BenchlingService(Benchling):
27
32
  The connection object that contains the credentials for the Benchling tenant.
28
33
  use_api: bool
29
34
  Whether to connect to the Benchling SDK. Requires api_client_id and api_client_secret from the connection object.
30
- use_db: bool
35
+ use_db: bool = False
31
36
  Whether to connect to the Benchling Postgres database. Requires warehouse_connection_string from the connection object.
32
- use_internal_api: bool
37
+ use_internal_api: bool = False
33
38
  Whether to connect to the Benchling internal API. Requires internal_api_admin_email and internal_api_admin_password from the connection object.
34
39
  """
35
40
 
@@ -144,6 +149,7 @@ class BenchlingService(Benchling):
144
149
  @retry(
145
150
  stop=stop_after_attempt(3),
146
151
  retry=retry_if_exception_type(ValueError),
152
+ wait=wait_exponential(multiplier=1, min=1, max=8),
147
153
  reraise=True,
148
154
  )
149
155
  def autogenerate_auth(
@@ -106,14 +106,14 @@ def generate_all_entity_schema_files(
106
106
  ):
107
107
  if not col.is_multi:
108
108
  relationship_strings.append(
109
- f"""{tab}single_relationship("{wh_name_to_classname[col.entity_link]}", {col_name})"""
109
+ f"""{tab}{col_name}_entity = single_relationship("{wh_name_to_classname[col.entity_link]}", {col_name})"""
110
110
  )
111
111
  import_strings.append(
112
112
  "from liminal.orm.relationship import single_relationship"
113
113
  )
114
114
  else:
115
115
  relationship_strings.append(
116
- f"""{tab}multi_relationship("{wh_name_to_classname[col.entity_link]}", "{classname}", "{col_name}")"""
116
+ f"""{tab}{col_name}_entities = multi_relationship("{wh_name_to_classname[col.entity_link]}", "{classname}", "{col_name}")"""
117
117
  )
118
118
  import_strings.append(
119
119
  "from liminal.orm.relationship import multi_relationship"
@@ -195,10 +195,10 @@ class UpdateEntitySchema(BaseOperation):
195
195
  return update_tag_schema(benchling_service, tag_schema.id, update.model_dump())
196
196
 
197
197
  def describe_operation(self) -> str:
198
- return f"Updating properties for entity schema {self.wh_schema_name}: {repr(self.update_props)}."
198
+ return f"Updating properties for entity schema {self.wh_schema_name}: {str(self.update_props)}."
199
199
 
200
200
  def describe(self) -> str:
201
- return f"Schema properties for {self.wh_schema_name} are different in code versus Benchling: {repr(self.update_props)}."
201
+ return f"Schema properties for {self.wh_schema_name} are different in code versus Benchling: {str(self.update_props)}."
202
202
 
203
203
  def _validate(self, benchling_service: BenchlingService) -> TagSchemaModel:
204
204
  all_schemas = TagSchemaModel.get_all_json(benchling_service)
@@ -485,11 +485,7 @@ class UpdateEntitySchemaField(BaseOperation):
485
485
  # Only if changing name of field
486
486
  if self.update_props.name:
487
487
  existing_new_field = next(
488
- (
489
- f
490
- for f in tag_schema.allFields
491
- if f.systemName == self.update_props.name
492
- ),
488
+ (f for f in tag_schema.allFields if f.name == self.update_props.name),
493
489
  None,
494
490
  )
495
491
  if existing_new_field:
@@ -59,6 +59,7 @@ class CreateTagSchemaFieldModel(BaseModel):
59
59
  systemName: str
60
60
  name: str
61
61
  requiredLink: FieldRequiredLinkShortModel | None = None
62
+ tooltipText: str | None = None
62
63
 
63
64
  @classmethod
64
65
  def from_props(
@@ -121,6 +122,7 @@ class CreateTagSchemaFieldModel(BaseModel):
121
122
  folderItemType=folder_item_type,
122
123
  tagSchema=tagSchema,
123
124
  ),
125
+ tooltipText=new_props.tooltip,
124
126
  )
125
127
 
126
128
 
@@ -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,32 @@ 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
+ continue
37
+ if not bc.api_client_id or not bc.api_client_secret:
38
+ raise Exception(
39
+ "api_client_id and api_client_secret must be provided in BenchlingConnection in liminal/env.py. This is necessary for the migration service."
40
+ )
41
+ if not bc.internal_api_admin_email or not bc.internal_api_admin_password:
42
+ raise Exception(
43
+ "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."
44
+ )
34
45
  try:
35
46
  current_revision_id: str = getattr(
36
- module, attr.current_revision_id_var_name
47
+ module, bc.current_revision_id_var_name
37
48
  )
38
- return current_revision_id, attr
49
+ return current_revision_id, bc
39
50
  except Exception as e:
40
51
  raise Exception(
41
- f"CURRENT_REVISION_ID variable not found in liminal/env.py. Given variable name: {attr.current_revision_id_var_name}"
52
+ f"CURRENT_REVISION_ID variable not found in liminal/env.py. Given variable name: {bc.current_revision_id_var_name}"
42
53
  ) from e
43
54
  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."
55
+ f"BenchlingConnection with tenant name or alias {benchling_tenant} not found in liminal/env.py. Please update the env.py file with a correctly defined BenchlingConnection."
45
56
  )
46
57
 
47
58
 
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
 
@@ -82,7 +82,7 @@ class Column(SqlColumn):
82
82
  super().__init__(
83
83
  self.sqlalchemy_type,
84
84
  foreign_key,
85
- nullable=not properties.required,
85
+ nullable=not required,
86
86
  info={"benchling_properties": properties},
87
87
  **kwargs,
88
88
  )
@@ -107,3 +107,7 @@ class Column(SqlColumn):
107
107
  f"Could not set benchling properties for column {column.name}. Please check that the column has a valid benchling properties set."
108
108
  )
109
109
  return Column(**properties.model_dump())
110
+
111
+ def _constructor(self, *args: Any, **kwargs: Any) -> SqlColumn:
112
+ """Returns a new instance of the SqlAlchemy Column class."""
113
+ return SqlColumn(*args, **kwargs)
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.1
2
+ Name: liminal-orm
3
+ Version: 1.0.6
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
6
+ Author: DynoTx Open Source
7
+ Author-email: opensource@dynotx.com
8
+ Requires-Python: >=3.9,<4
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Requires-Dist: benchling-sdk (>=1.8.0)
14
+ Requires-Dist: bs4 (>=0.0.2,<0.0.3)
15
+ Requires-Dist: lxml (>=5.3.0,<6.0.0)
16
+ Requires-Dist: pandas (>=1.5.3)
17
+ Requires-Dist: psycopg2-binary (>=2.9.10,<3.0.0)
18
+ Requires-Dist: pydantic (>=2,<=2.7)
19
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
20
+ Requires-Dist: rich (>=13.9.2,<14.0.0)
21
+ Requires-Dist: sqlalchemy (<2)
22
+ Requires-Dist: tenacity (>=8,<10)
23
+ Requires-Dist: typer (>=0.12.5,<0.13.0)
24
+ Project-URL: Bug Tracker, https://github.com/dynotx/liminal-orm/issues
25
+ Project-URL: Documentation, https://dynotx.github.io/liminal-orm/
26
+ Project-URL: Repository, https://github.com/dynotx/liminal-orm
27
+ Description-Content-Type: text/markdown
28
+
29
+ # [Liminal ORM](#liminal-orm)
30
+
31
+ [![PyPI version](https://img.shields.io/pypi/v/liminal-orm.svg)](https://pypi.org/project/liminal-orm/)
32
+ [![License](https://img.shields.io/github/license/dynotx/liminal-orm)](https://github.com/dynotx/liminal-orm/blob/main/LICENSE.md)
33
+ [![CI](https://github.com/dynotx/liminal-orm/actions/workflows/liminal.yml/badge.svg)](https://github.com/dynotx/liminal-orm/actions/workflows/liminal.yml)
34
+ [![Downloads](https://static.pepy.tech/personalized-badge/liminal-orm?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/liminal-orm)
35
+
36
+ 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, code-first approach for synchronizing and managing your Benchling schemas. Check out the [**full documentation here**](https://dynotx.github.io/liminal-orm/) and join our [**Slack community here**](https://join.slack.com/t/liminalorm/shared_invite/zt-2ujrp07s3-bctook4e~cAjn1LgOLVY~Q)!
37
+
38
+ 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 between your upstream Benchling tenant(s) and downstream dependencies. By creating a standard interface and through using one-line CLI<sup>3</sup> 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:
39
+
40
+ - The ability to run migrations to your Benchling tenant(s) through an easy to use CLI.
41
+ - One source of truth defined in code for your Benchling schema model that your many Benchling tenants can stay in sync with.
42
+ - Easy to implement validation rules to reflect business logic for all of your Benchling entities.
43
+ - Strongly typed queries for all your Benchling entities.
44
+ - CI/CD integration with GitHub Actions to ensure that your Benchling schemas and code are always in sync.
45
+ - And more based on community contributions/feedback :)
46
+
47
+ If you are a Benchling user, try out Liminal by following the [**Quick Start Guide**](https://dynotx.github.io/liminal-orm/getting-started/prerequisites/)! 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 :)
48
+
49
+ 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)!
50
+
51
+ 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.
52
+
53
+ ⭐️ Leave a star on the repo to spread the word!
54
+ 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.
55
+
56
+ <img width="793" alt="liminal_simple_graph" src="https://github.com/user-attachments/assets/52e32cd0-3407-49f5-b100-5763bee3830c">
57
+
58
+ ## Table of Contents
59
+
60
+ - [Overview](#liminal-orm)
61
+ - [Getting Started](#getting-started)
62
+ - [Toolkit](#toolkit)
63
+ - [Mission](#mission)
64
+ - [Community](#community)
65
+ - [Contributing](#contributing)
66
+ - [License](#license)
67
+ - [Acknowledgements](#acknowledgements)
68
+ - [Footnotes](#footnotes)
69
+
70
+ ## [Getting Started](#getting-started)
71
+
72
+ Note: Liminal requires you to have (or have access to) an admin user account for your Benchling tenant. If you run into any issues, please reach out to us on the [Discussions](https://github.com/dynotx/liminal-orm/discussions/categories/q-a) forum and we'll be happy to help!
73
+
74
+ Check out this [Quick Start Guide](https://dynotx.github.io/liminal-orm/getting-started/prerequisites/) to get you setup with Liminal!
75
+
76
+ ## [Toolkit](#toolkit)
77
+
78
+ With your schemas defined in code, you can now take advantage of the additional capabilities that the Liminal toolkit provides.
79
+
80
+ 1. Entity validation: Easily create custom validation rules for your Benchling entities.
81
+
82
+ ```python
83
+ from liminal.validation import BenchlingValidator, BenchlingValidatorReport, BenchlingReportLevel
84
+ from liminal.orm.base_model import BaseModel
85
+
86
+ class CookTempValidator(BenchlingValidator):
87
+ """Validates that a field value is a valid enum value for a Benchling entity"""
88
+
89
+ def validate(self, entity: type[BaseModel]) -> BenchlingValidatorReport:
90
+ valid = True
91
+ message = None
92
+ if entity.cook_time is not None and entity.cook_temp is None:
93
+ valid = False
94
+ message = "Cook temp is required if cook time is set"
95
+ if entity.cook_time is None and entity.cook_temp is not None:
96
+ valid = False
97
+ message = "Cook time is required if cook temp is set"
98
+ return self.create_report(valid, BenchlingReportLevel.MED, entity, message)
99
+ ```
100
+
101
+ 2. Strongly typed queries: Write type-safe queries using SQLAlchemy to access your Benchling entities.
102
+
103
+ ```python
104
+ with BenchlingSession(benchling_connection, with_db=True) as session:
105
+ pizza = session.query(Pizza).filter(Pizza.name == "Margherita").first()
106
+ print(pizza)
107
+ ```
108
+
109
+ 3. CI/CD integration: Use Liminal to automatically generate and apply your revision files to your Benchling tenant(s) as part of your CI/CD pipeline.
110
+
111
+ 4. And more to come!
112
+
113
+ ## [Mission](#mission)
114
+
115
+ 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.
116
+
117
+ ## [Community](#community)
118
+
119
+ 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)
120
+
121
+ Please refer to [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) to learn more about how to interact with the community.
122
+
123
+ Please refer to [GOVERNANCE.md](./GOVERNANCE.md) to learn more about the project's governance structure.
124
+
125
+ ## [Contributing](#contributing)
126
+
127
+ Contributions of any kind are welcome and encouraged! This ranges from feedback and feature requests all the way to code contributions.
128
+ Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) to learn how to contribute to Liminal!
129
+
130
+ ## [License](#license)
131
+
132
+ Liminal ORM is distributed under the [Apache License, Version 2.0](./LICENSE.md).
133
+
134
+ ## [Direct Contact](#direct-contact)
135
+
136
+ - Email: <opensource@dynotx.com>
137
+ - LinkedIn: [Nirmit Damania](https://www.linkedin.com/in/nirmit-damania/)
138
+
139
+ ## [Acknowledgements](#acknowledgements)
140
+
141
+ This project could not have been started without the support of Dyno Therapeutics and the help of the following people.
142
+
143
+ - [Steve Northup](https://github.com/steve-dyno): For being an incredibly supportive manager and mentor, making key technical contributions, and providing guidance on the project's direction.
144
+ - [Joyce Samson](https://github.com/samsonjoyce): For being Liminal's first power user at Dyno Therapeutics, providing valuable feedback that informed the project's direction, and coming up with Liminal's name.
145
+ - [David Levy-Booth](https://github.com/davidlevybooth): For providing leadership and guidance on releasing this as an open source software.
146
+ - The rest of the Dyno team...
147
+
148
+ ## [Footnotes](#footnotes)
149
+
150
+ ORM<sup>1</sup>: Object-Relational Mapper. An ORM is a piece of software designed to translate between the data representations used by databases and those used in object-oriented programming. In this case, Liminal provides an ORM layer built specifically for Benchling that allows for users to quickly and easily define Benchling entities in code. [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy) is the underlying ORM that Liminal uses to interact with your Benchling tenant(s) and is an open-source software that is an industry standard software.
151
+
152
+ LIMS<sup>2</sup>: Laboratory Information Management System. A LIMS is a piece of software that allows you to effectively manage samples and associated data. [Benchling](https://www.benchling.com/) is an industry-leading LIMS software.
153
+
154
+ CLI<sup>3</sup>: Command Line Interface. A CLI is a piece of software that allows you to interact with a software program via the command line. Liminal provides a CLI that allows you to interact with your Liminal environment. This project uses [Typer](https://github.com/fastapi/typer) to construct the CLI
155
+
@@ -1,18 +1,18 @@
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
6
6
  liminal/base/properties/base_field_properties.py,sha256=V9UlY_geSoOhx_Iwiw2eZ7kDKghYy4Xa5bbGcCOFDk8,4511
7
- liminal/base/properties/base_schema_properties.py,sha256=XIgTZvWYjqpSXJ-_uSew0sp-wWRb62-McmJtJ5rdNg0,3925
7
+ liminal/base/properties/base_schema_properties.py,sha256=fM4wT60yUggT32xS_F8u31bidjBWOS9Xpn0I6FlXZaQ,4335
8
8
  liminal/base/str_enum.py,sha256=jF3d-Lo8zsHUe6GsctX2L-TSj92Y3qCYDrTD-saeJoc,210
9
- liminal/cli/cli.py,sha256=Bv0H_RWLpPxaCNmD4X9l_0wYQ8VCDbAHwALvCTUxB1g,8998
9
+ liminal/cli/cli.py,sha256=JxWHLO9KMeMaOnOYwzdH0w71l0477ScFOkWNtTlc97Y,9045
10
10
  liminal/cli/controller.py,sha256=QNj3QO9TMb9hfc6U-VhLuFa0_aohOHZUmvY4XkATPhw,10118
11
11
  liminal/cli/live_test_dropdown_migration.py,sha256=i20JkY5xmLffHrB73WOl3Tjyb4V2RPb3rt7-wh-BwME,2826
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=HNL-5CpL9vA3XH-MybCJMCswNhYxZV3e8h0HJMV7eoA,7511
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
@@ -21,9 +21,9 @@ liminal/dropdowns/utils.py,sha256=1-H7bTszCUeqeRBpiYXjRjreDzhn1Fd1MFwIsrEI-o4,41
21
21
  liminal/entity_schemas/api.py,sha256=Dkd44NGJ4JqRTJLJtPsZ8Qan2owbEYf446A6EuP8iL0,2786
22
22
  liminal/entity_schemas/compare.py,sha256=EL5v82FEBxMIubhlQmsmQO7a-EZeMWXRU2pBt9HmzPI,13849
23
23
  liminal/entity_schemas/entity_schema_models.py,sha256=X2ouBUWIonrWeB3hMVj0bCqchbcztrp3joaftv8yHWo,5393
24
- liminal/entity_schemas/generate_files.py,sha256=ZiTk_6wqnW_5_uW6gfCP13qUGd8uqlIh-wi7ydSk8N0,8442
25
- liminal/entity_schemas/operations.py,sha256=sub6rigZjro72EMqqsayOYNxPL6eDYwCCIlzMr9sNfQ,23306
26
- liminal/entity_schemas/tag_schema_models.py,sha256=VVqI9iC7T_p1RZJSu09AsptK7Cr-YQvXjYP5cjhpeBo,15979
24
+ liminal/entity_schemas/generate_files.py,sha256=O8SPg4lQDYsfz7NPHH3AJdRj9naDy_13hGH9cQStXt8,8484
25
+ liminal/entity_schemas/operations.py,sha256=piimMjnEFnKpucb2mLvPAXmUKjTbTEI7ZZD5B7amydE,23220
26
+ liminal/entity_schemas/tag_schema_models.py,sha256=jl6J_3iB0mxE51FbRKdwScRF24fRAumKpQDhfHGcqy8,16057
27
27
  liminal/entity_schemas/utils.py,sha256=tJVEfpJ6CtpuYI1_LWOE5-pGzNe0bsrGluLbU8sc9EM,4192
28
28
  liminal/enums/__init__.py,sha256=jz_c-B_fifatvrYoESlHZ9ljYdz-3rNl0sBazoESiHI,523
29
29
  liminal/enums/benchling_api_field_type.py,sha256=DEMlkvKuc8kaslnKdWsdB8Z70OY3CGwOHfZNC3a1SOE,528
@@ -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=HdSr3N2WN_1S-PLRGVWSMYl-4gIcP-Ph2wPycGi2cGg,3404
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=YjFORf_DF4COE80kX40OFuDMSeZ6M2je6b_iUaUOtKs,4678
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.4.dev1.dist-info/LICENSE.md,sha256=oVA877F_D1AV44dpjsv4f-4k690uNGApX1EtzOo3T8U,11353
58
- liminal_orm-1.0.4.dev1.dist-info/METADATA,sha256=FvlicMo6Ef2UAWWgLejJ0InFYIZVHh5hO2co7ASiIHg,11801
59
- liminal_orm-1.0.4.dev1.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
60
- liminal_orm-1.0.4.dev1.dist-info/entry_points.txt,sha256=atIrU63rrzH81dWC2sjUbFLlc5FWMmYRdMxXEWexIZA,47
61
- liminal_orm-1.0.4.dev1.dist-info/RECORD,,
57
+ liminal_orm-1.0.6.dist-info/LICENSE.md,sha256=oVA877F_D1AV44dpjsv4f-4k690uNGApX1EtzOo3T8U,11353
58
+ liminal_orm-1.0.6.dist-info/METADATA,sha256=Jwa6P74ZUhDNYtMvI3y4jvcn_wvJluQ1kHAZXOtuoqo,11165
59
+ liminal_orm-1.0.6.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
60
+ liminal_orm-1.0.6.dist-info/entry_points.txt,sha256=atIrU63rrzH81dWC2sjUbFLlc5FWMmYRdMxXEWexIZA,47
61
+ liminal_orm-1.0.6.dist-info/RECORD,,
@@ -1,203 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: liminal-orm
3
- Version: 1.0.4.dev1
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
- Author: DynoTx Open Source
6
- Author-email: opensource@dynotx.com
7
- Requires-Python: >=3.9,<4
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Requires-Dist: benchling-sdk (>=1.8.0)
13
- Requires-Dist: bs4 (>=0.0.2,<0.0.3)
14
- Requires-Dist: lxml (>=5.3.0,<6.0.0)
15
- Requires-Dist: pandas (>=1.5.3)
16
- Requires-Dist: pydantic (>=2,<=2.7)
17
- Requires-Dist: requests (>=2.32.3,<3.0.0)
18
- Requires-Dist: rich (>=13.9.2,<14.0.0)
19
- Requires-Dist: sqlalchemy (<2)
20
- Requires-Dist: tenacity (>=8,<10)
21
- Requires-Dist: typer (>=0.12.5,<0.13.0)
22
- Description-Content-Type: text/markdown
23
-
24
- # [Liminal ORM](#liminal-orm)
25
-
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:
27
-
28
- - The ability to run migrations to your Benchling tenant(s) through an easy to use CLI<sup>3</sup>.
29
- - One source of truth defined in code for your Benchling schema model that your many Benchling tenants can stay in sync with.
30
- - Easy to implement validation rules to reflect business logic for all of your Benchling entities.
31
- - Strongly typed queries for all your Benchling entities.
32
- - CI/CD integration with GitHub Actions to ensure that your Benchling schemas and code are always in sync.
33
- - And more!
34
-
35
- 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
-
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.
38
-
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 :)
40
-
41
- ⭐️ Leave a star on the repo to spread the word!
42
-
43
- <img width="793" alt="liminal_simple_graph" src="https://github.com/user-attachments/assets/52e32cd0-3407-49f5-b100-5763bee3830c">
44
-
45
- ## Table of Contents
46
-
47
- - [Overview](#liminal-orm)
48
- - [Getting Started](#getting-started)
49
- - [Installation](#installation)
50
- - [Setup](#setup)
51
- - [Migration](#migration)
52
- - [Toolkit](#toolkit)
53
- - [Community](#community)
54
- - [Contributing](#contributing)
55
- - [License](#license)
56
- - [Acknowledgements](#acknowledgements)
57
- - [Footnotes](#footnotes)
58
-
59
- ## [Getting Started](#getting-started)
60
-
61
- Note: Liminal requires you to have (or have access to) an admin user account for your Benchling tenant. If you run into any issues, please reach out to us on the [Discussions](https://github.com/dynotx/liminal-orm/discussions/categories/q-a) forum and we'll be happy to help!
62
-
63
- ### [Installation](#installation)
64
-
65
- via pip: `pip install liminal-orm`
66
-
67
- via github: `python -m pip install git+https://github.com/dynotx/liminal-orm.git --ignore-installed`
68
-
69
- ### [Setup](#setup)
70
-
71
- 1. `cd` into the directory where you want to instantiate your *Liminal environment*. This will be the root directory where your schemas will live. Note: the Liminal CLI must always be run from within this root directory.
72
-
73
- 2. Run `liminal init` to initialize your Liminal project. This will create a liminal/ directory with an env.py file and a versions/ directory with an empty first revision file.
74
-
75
- 3. Populate the env.py file with your Benchling connection information, following the instructions in the file. For example:
76
-
77
- ```python
78
- from liminal.connection import BenchlingConnection
79
-
80
- PROD_CURRENT_REVISION_ID = "12b31776a755b"
81
-
82
- # It is highly recommended to use a secrets manager to store your credentials.
83
- connection = BenchlingConnection(
84
- tenant_name="pizzahouse-prod",
85
- tenant_alias="prod",
86
- current_revision_id_var_name="PROD_CURRENT_REVISION_ID",
87
- api_client_id="my-secret-api-client-id",
88
- api_client_secret="my-secret-api-client-secret",
89
- warehouse_connection_string="my-warehouse-connection-string",
90
- internal_api_admin_email="my-secret-internal-api-admin-email",
91
- internal_api_admin_password="my-secret-internal-api-admin-password",
92
- )
93
- ```
94
-
95
- 4. If your Benchling tenant has pre-existing schemas, run `liminal generate-files` to populate the root directory with the schema files. Your file structure should now look like this:
96
-
97
- ```text
98
- benchling/
99
- liminal/
100
- env.py
101
- versions/
102
- <revision_id>_initial_init_revision.py
103
- dropdowns/
104
- ...
105
- entity_schemas/
106
- ...
107
- ```
108
-
109
- 5. Add your schema imports to the env.py file. For example:
110
-
111
- ```python
112
- from pizzahouse.dropdowns import *
113
- from pizzahouse.entity_schemas import *
114
- ...
115
- ```
116
-
117
- 6. Set up is complete! You're now ready to start using your schemas defined in code as the single source of truth for your Benchling tenant(s). Refer to the [Migration](#migration) section to learn about how you make a change to your Benchling schema model. Refer to the [Toolkit](#toolkit) section to learn about the additional features the Liminal toolkit provides.
118
-
119
- ## [Migration](#migration)
120
-
121
- This section will walk you through the process of making a change to your Benchling schema model and syncing it to your Benchling tenant(s).
122
-
123
- 1. Make a change to your Benchling schema model!
124
-
125
- 2. Run `liminal autogenerate <benchling_tenant_name> <description_of_changes>` to generate a new revision file. For example: `liminal autogenerate prod "new oven schema"`. This will create a new revision file in the `versions/` directory. This revision file defines the set of steps (or "operations") that will be needed to make the targeted Benchling tenant up to date with the changes made in the schema model.
126
-
127
- If I have multiple Benchling tenants, do I have to run `autogenerate` for each tenant?
128
-
129
- No, Liminal only keeps a single thread of revision history that are linked together for easy upgrade/downgrade. In the case of multiple tenants that need to stay in sync together, we recommend pointing `autogenerate` at your production tenant, or the tenant that acts as the production environment. When ready, you can then apply the revision to all your tenants.
130
-
131
- 3. Review the generated revision file and set of operations to ensure that it is accurate.
132
-
133
- 4. Run `liminal upgrade <benchling_tenant_name> <upgrade_descriptor>` to migrate your Benchling tenant(s) to the new schema. For example: `liminal upgrade prod head`. This will apply the revision to the targeted Benchling tenant. For example: `liminal upgrade prod head` will apply the revision to the production tenant.
134
-
135
- 5. Check out your changes on your Benchling tenant(s)!
136
-
137
- ## [Toolkit](#toolkit)
138
-
139
- With your schemas defined in code, you can now take advantage of the additional capabilities that the Liminal toolkit provides.
140
-
141
- 1. Entity validation: Easily create custom validation rules for your Benchling entities.
142
-
143
- ```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")
156
- ```
157
-
158
- 2. Strongly typed queries: Write type-safe queries using SQLAlchemy to access your Benchling entities.
159
-
160
- ```python
161
- with BenchlingSession(benchling_connection, with_db=True) as session:
162
- pizza = session.query(Pizza).filter(Pizza.name == "Margherita").first()
163
- print(pizza)
164
- ```
165
-
166
- 3. CI/CD integration: Use Liminal to automatically generate and apply your revision files to your Benchling tenant(s) as part of your CI/CD pipeline.
167
-
168
- 4. And more to come!
169
-
170
- ## [Community](#community)
171
-
172
- 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)
173
-
174
- Please refer to [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) to learn more about how to interact with the community.
175
-
176
- Please refer to [GOVERNANCE.md](./GOVERNANCE.md) to learn more about the project's governance structure.
177
-
178
- ## [Contributing](#contributing)
179
-
180
- Contributions of any kind are welcome and encouraged! This ranges from feedback and feature requests all the way to code contributions.
181
- Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) to learn how to contribute to Liminal!
182
-
183
- ## [License](#license)
184
-
185
- Liminal ORM is distributed under the [Apache License, Version 2.0](./LICENSE.md).
186
-
187
- ## [Acknowledgements](#acknowledgements)
188
-
189
- This project could not have been started without the support of Dyno Therapeutics and the help of the following people.
190
-
191
- - [Steve Northup](https://github.com/steve-dyno): For being an incredibly supportive manager and mentor, making key technical contributions, and providing guidance on the project's direction.
192
- - [Joyce Samson](https://github.com/samsonjoyce): For being Liminal's first power user at Dyno Therapeutics, providing valuable feedback that informed the project's direction, and coming up with Liminal's name.
193
- - [David Levy-Booth](https://github.com/davidlevybooth): For providing leadership and guidance on releasing this as an open source software.
194
- - The rest of the Dyno team...
195
-
196
- ## [Footnotes](#footnotes)
197
-
198
- ORM<sup>1</sup>: Object-Relational Mapper. An ORM is a piece of software designed to translate between the data representations used by databases and those used in object-oriented programming. In this case, Liminal provides an ORM layer built specifically for Benchling that allows for users to quickly and easily define Benchling entities in code. [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy) is the underlying ORM that Liminal uses to interact with your Benchling tenant(s) and is an open-source software that is an industry standard software.
199
-
200
- LIMS<sup>2</sup>: Laboratory Information Management System. A LIMS is a piece of software that allows you to effectively manage samples and associated data. [Benchling](https://www.benchling.com/) is an industry-leading LIMS software.
201
-
202
- CLI<sup>3</sup>: Command Line Interface. A CLI is a piece of software that allows you to interact with a software program via the command line. Liminal provides a CLI that allows you to interact with your Liminal environment. This project uses [Typer](https://github.com/fastapi/typer) to construct the CLI
203
-