Science database interface using Django as the content manager.
Project description
EspressoDB
EspressoDB is a Python framework designed to organize (relational) data without losing flexibility. Its objective is to be intuitive and fast.
More specifically, EspressoDB is built on top of the Object-Relational Mapping web framework Django and adds additional convenience functionalities to easily set up your project. Additionally, EspressoDB provides an extended framework of data consistency checks, giving users the freedom to define data tables and their relationships which uniquely mirror the underlying computation.
What does EspressoDB provide?
EspressoDB provides an easy to use database interface which helps you make educated decisions fast.
Once you have created your Python project (e.g., my_project
) with EspressoDB
- you can use it in all your Python apps to query your data. For example,
import numpy as np from my_project.hamiltonian.models import Contact as ContactHamiltonian # Ask the database for specific entries hamiltonian = ContactHamiltonian.objects.filter(n_sites=20).first() # Use class methods for an intuitive interface ## Print a formatted summary of the table entry print(hamiltonian) ## Allocate an actual matrix for the given entry and use it in computations eigs, vecs = np.linalg.eigh(hamiltonian.matrix)
models
classes are regular classes in Python. They can provide additional methods for convenience. Also, they know how to talk to the database, e.g., you can query (read) and update (write) your data to a central database. - you can generate web views which summarize your tables and data. Because the web pages use a Python API as well, you can completely customize views with code you have already developed. E.g., you can automate plots and display summaries in your browser. If you want to, you can also make your web app public (with different layers of accessibility) and share results with others.
See also the Documentation for more detailed usage instructions.
How to install it?
EspressoDB can be installed via pip:
pip install [--user] espressodb
Run the Tests
Since EspressoDB is about creating projects, the tests are implemented for the example project. To run the tests, clone this repo, install the dependencies:
pip install .
pip install -r requirements-dev.txt
pip install -r example/my_project/requirements.txt
and run pytest
(or the regular test) in example/my_project
:
cd example/my_project
pytest [--cov=espressodb]
What's the story behind it?
EspressoDB was developed when we created LatteDB -- a database for organizing Lattice Quantum Chromodynamics research. We intended to create a database for several purposes, e.g. to optimize the scheduling of architecture-dependent many-node jobs and to help in the eventual analysis process. For this reason, we started to abstract our thinking of how to organize physics objects.
It was the goal to have easily shareable and completely reproducible snapshots of our workflow while being flexible and not restricting ourselves too much -- in the end science is full of surprises. The challenges we encountered were:
- How can we program a table structure which can be easily extended in the future?
- How do we write a database such that users not familiar with the database concept can start using this tool with minimal effort?
The core module of LatteDB, EspressoDB, is trying to address those challenges.
Who is responsible for it?
Comparison to related technologies
- SQLAlchemy - SQLAlchemy is a minimal low-level Python-SQL interface. While it also provides an ORM (Data Mapper implementation), setting up projects, establishing access to the database and migrating changes are not automated and thus interfacing to an existing project is less beginner-friendly than, e.g., interfacing with an existing Django project.
- Django - Django is the parent of EspressoDB. It uses an active record implementation (direct correspondence between table rows and Python objects). While Django is intended to serve as a web framework, EspressoDB reinterprets and expands Django to be directly used in computational projects. To do so, EspressoDB streamlines the project creation, automates the setup components and provides additional cross-checks needed for multi-user scenarios.
Contributing
Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here.
License
BSD 3-Clause License. See also the LICENSE file.
Project details
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 espressodb-1.2.1.tar.gz
.
File metadata
- Download URL: espressodb-1.2.1.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26869e70b58058e57189d84ae64d77fa303582357071a111e9d98f0fb5835595 |
|
MD5 | 9f9330f6c53453ac1ea0cccecf18b193 |
|
BLAKE2b-256 | 9a0cdb090d55427748b7ddc77c4d4000091f333ff931ca93731088bf0bd0a872 |
File details
Details for the file espressodb-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: espressodb-1.2.1-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f52cfbc6506095303a1f8ec2f4d8fe3aa6eb261f03ab86982554ad0439a78a |
|
MD5 | ea60e494fe69f523bb9d365493c7aff9 |
|
BLAKE2b-256 | 12143cf4f913f7c5a81294f6393a29cc2fde6fcada50129c19b4232dd4fb8aab |