An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync.
Reason this release was yanked:
mistake
Project description
Liminal ORM
Liminal ORM1 is a Python package that builds on top of Benchling's LIMS2 platform to keep your Benchling schemas and downstream code dependencies in sync. Liminal provides an ORM framework using 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:
- The ability to run migrations to your Benchling tenant(s) through an easy to use CLI3.
- One source of truth defined in code for your Benchling schema model that your many Benchling tenants can stay in sync with.
- Easy to implement validation rules to reflect business logic for all of your Benchling entities.
- Strongly typed queries for all your Benchling entities.
- CI/CD integration with GitHub Actions to ensure that your Benchling schemas and code are always in sync.
- And more!
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!
For a full and in-depth overview of Liminal, please refer to our [full documentation](coming soon). Below is a quickstart guide to get you Liminal set up in your project.
Reach out in the 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 or reach out directly at opensource@dynotx.com. You can expect responses within 48 hours :)
Table of Contents
Getting Started
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 forum and we'll be happy to help!
Installation
via pip: pip install liminal-orm
via github: python -m pip install git+https://github.com/dynotx/liminal-orm.git --ignore-installed
Setup
-
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. -
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. -
Populate the env.py file with your Benchling connection information, following the instructions in the file. For example:
from liminal.connection import BenchlingConnection PROD_CURRENT_REVISION_ID = "12b31776a755b" # It is highly recommended to use a secrets manager to store your credentials. connection = BenchlingConnection( tenant_name="pizzahouse-prod", tenant_alias="prod", current_revision_id_var_name="PROD_CURRENT_REVISION_ID", api_client_id="my-secret-api-client-id", api_client_secret="my-secret-api-client-secret", warehouse_connection_string="my-warehouse-connection-string", internal_api_admin_email="my-secret-internal-api-admin-email", internal_api_admin_password="my-secret-internal-api-admin-password", )
-
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:benchling/ liminal/ env.py versions/ <revision_id>_initial_init_revision.py dropdowns/ ... entity_schemas/ ...
-
Add your schema imports to the env.py file. For example:
from pizzahouse.dropdowns import * from pizzahouse.entity_schemas import * ...
-
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 section to learn about how you make a change to your Benchling schema model. Refer to the Toolkit section to learn about the additional features the Liminal toolkit provides.
Migration
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).
-
Make a change to your Benchling schema model!
-
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 theversions/
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.If I have multiple Benchling tenants, do I have to run
autogenerate
for each tenant?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. -
Review the generated revision file and set of operations to ensure that it is accurate.
-
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. -
Check out your changes on your Benchling tenant(s)!
Toolkit
With your schemas defined in code, you can now take advantage of the additional capabilities that the Liminal toolkit provides.
-
Entity validation: Easily create custom validation rules for your Benchling entities.
from dyno.liminal.orm.base_model import BaseModel from dyno.liminal.orm.mixins import CustomEntityMixin class Pizza(BaseModel, CustomEntityMixin): ... @validator(BenchlingReportLevel.HIGH) def cook_temp_time(self): if self.cook_time is not None and self.cook_temp is None: raise ValueError("Cook temp is required if cook time is set") if self.cook_time is None and self.cook_temp is not None: raise ValueError("Cook time is required if cook temp is set")
-
Strongly typed queries: Write type-safe queries using SQLAlchemy to access your Benchling entities.
with BenchlingSession(benchling_connection, with_db=True) as session: pizza = session.query(Pizza).filter(Pizza.name == "Margherita").first() print(pizza)
-
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.
-
And more to come!
Community
We're excited to hear from you! Feel free to introduce yourself on the Liminal GitHub Discussions page
Please refer to CODE_OF_CONDUCT.md to learn more about how to interact with the community.
Please refer to GOVERNANCE.md to learn more about the project's governance structure.
Contributing
Contributions of any kind are welcome and encouraged! This ranges from feedback and feature requests all the way to code contributions. Please refer to CONTRIBUTING.md to learn how to contribute to Liminal!
License
Liminal ORM is distributed under the Apache License, Version 2.0.
Acknowledgements
This project could not have been started without the support of Dyno Therapeutics and the help of the following people.
- Steve Northup: For being an incredibly supportive manager and mentor, making key technical contributions, and providing guidance on the project's direction.
- Joyce Samson: 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.
- David Levy-Booth: For providing leadership and guidance on releasing this as an open source software.
- The rest of the Dyno team...
Footnotes
ORM1: 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 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.
LIMS2: Laboratory Information Management System. A LIMS is a piece of software that allows you to effectively manage samples and associated data. Benchling is an industry-leading LIMS software.
CLI3: 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 to construct the CLI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file liminal_orm-1.0.0a0.tar.gz
.
File metadata
- Download URL: liminal_orm-1.0.0a0.tar.gz
- Upload date:
- Size: 61.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 403343cb8ecb4a443e05dbbf704569d2e29679fa2ff883a26d508c1c99903678 |
|
MD5 | f31d2b4a58e3e7aa3692fbf8648434f1 |
|
BLAKE2b-256 | 9cb2b9f73264b313616bcf378311a6e992f420822d8e41f4fb495b5335cbf20c |
File details
Details for the file liminal_orm-1.0.0a0-py3-none-any.whl
.
File metadata
- Download URL: liminal_orm-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 77.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bbc76e2efcccd889526a50107de854a42e2d484933c22864a1ff15d800dc899 |
|
MD5 | c45accd669d6f5b3d92622d13ee41f34 |
|
BLAKE2b-256 | ef0430a6b0ffb5067611a1c63e3c253c40a7d51dd13c49a7cdb68de0977b6229 |