Package: bento-lib
Bento Library (for Python Bento microservices)Common utilities and helpers for Bento platform services.Installingbento_libcan be added to a new service through normal installation, with any extras
that may be needed:# Add to a project using Poetry for dependenciespoetryaddbento_lib# Install using pip with the FastAPI extrapipinstallbento_lib[fastapi]# etc...DevelopingClone the repository and set up the Poetry environment using the following commands:gitclonegit@github.com:bento-platform/bento_lib.git
poetryinstall--all-extrasRunning TestsFor tests to complete successfully, the following external servers must be running:A Redis server atlocalhost:6379A Postgres server atlocalhost:5432withpeeraccess for thepostgresrole/databaseThen, tests and linting can be run with the following command:poetryruntoxReleasing1. Release ChecklistAll tests pass and test coverage has not been reducedPackage version has been updated (following semver) inpyproject.tomlThe latest changes have been merged into themasterbranchA release has been created, tagged in the format ofv#.#.#and named
in the format ofVersion #.#.#, listing any changes made, in the GitHub
releases pagetagged from the master branch!1A. Note on VersioningThebento_libproject usessemantic versioningfor
releasing. If the API is broken in any way, including minor differences in the
way a function behaves given an identical set of parameters (excluding bugfixes
for unintentional behaviour), the MAJOR version must be incremented. In this
way, we guarantee that projects relying on this API do not accidentally break
upon upgrading.2. Releasing automaticallyWhen a version is tagged on GitHub, a build + release CI pipeline is automatically triggered.
Make sure that the tagged version is a valid semantic versioning translation of the version inpyproject.toml, and that the versions otherwise match.Modulesauthauthprovides Python service middleware for dealing with the Bento authorization service.dbdbcontains common base classes for setting up database managers.drsdrsprovides utilities for fetching data and record metadata from
GA4GH-compatible DRS services, and Bento's own implementation (which has some
non-standard extensions.)eventseventsfacilitates JSON-serialized message-passing between Bento
microservices. Serialized objects can be at most 512 MB.Events should have a lower-case type which is type-insensitively unique and
adequately describes the associated data.All Bento channels are prefixed withbento..loggingloggingcontains helper functions for standardized Bento logging configuration
and formatting.responsesresponsescontains standardized error message-generating functions
and exception handling functions for different Python web frameworks.schemasschemascontains common JSON schemas which may be useful to a variety of
different Bento services.schemas.bentocontains Bento-specific schemas, andschemas.ga4ghcontains
GA4GH-standardized schemas (possibly not exactly to spec.)searchsearchcontains definitions, validators, and transformations for the query
syntax for Bento, as well as a transpiler to thepsycopg2PostgreSQL IR.The query syntax for Bento takes advantage of JSON schemas augmented with
additional properties about the field's accessibility and, in the case of
Postgres, how the field maps to a table column (or JSON column sub-field.)search.data_structurecontains code for evaluating a Bento query against a
Python data structure.search.operationscontains constants representing valid search operations one
can allow against particular fields from within an augmented JSON schema.search.postgrescontains a "transpiler" from the Bento query syntax to thepsycopg2-providedintermediate representation (IR)for
PostgreSQL, allowing safe queries against a Postgres database.search.queriesprovides definitions for the Bento query AST and some helper
methods for creating and processing ASTs.service_infoservice_infocontains Python typed dictionaries, Pydantic models, and helpers
for common structures and operations related to GA4GH's/service-infospecification.workflowsworkflowscontains common code used for handling workflow metadata processing
and response generation, as well as code associated with Bento's ingestion
routines across the different data services.