Skip to main content

A database application to manage lab resources.

Project description

Python Pytest

Labbase2

Labbase2 is a database application written in Python using the Flask web framework. It is designed to help manage lab resources in a centralized and efficient way.

This project is a complete rewrite of the original Labbase and includes major improvements in usability, code quality, and maintainability.


🚀 Installation

Install the labbase2 package directly from GitHub:

pip install labbase2@git+https://github.com/RSchleutker/labbase2.git

Labbase2 is an installable Flask application. After installation, you can create a dedicated folder for your app instance. The folder typically contains:

project_folder/
├── upload/           # Folder for uploaded files
├── labbase2.db       # SQLite database (created on first run)
├── log.log           # Log file (created on first run)
└── main.py           # Script to start the app

⚙️ Configuration

At the very least, a secret ky should be configured, either through a config file or via the config_dict argument of create_app.

🧪 Example main.py

Here's a minimal setup to launch the app with Flask's built-in development server:

main.py

import logging

from labbase2 import create_app
from pathlib import Path
from logging.config import dictConfig


if __name__ == "__main__":

    dictConfig(
        {
            "version": 1,
            "formatters": {
                "default": {
                    "()": "labbase2.logging.RequestFormatter",
                    "format": "[%(asctime)s] %(levelname)-7s in %(module)-10s: [%(user)s] %(message)s",
                }
            },
            "handlers": {
                "wsgi": {
                    "class": "logging.StreamHandler",
                    "stream": "ext://flask.logging.wsgi_errors_stream",
                    "formatter": "default",
                },
                "file": {
                    "class": "logging.FileHandler",
                    "level": "DEBUG",
                    "filename": Path("instance", "log.log"),
                    "mode": "w",
                    "formatter": "default",
                },
            },
            "root": {"level": "DEBUG", "handlers": ["wsgi", "file"]},
        }
    )

    # Prevent 'werkzeug' from logging every single request.
    logger_werkz = logging.getLogger("werkzeug")
    logger_werkz.level = logging.ERROR

    # Configure the app.
    app = create_app(config_dict={"SECRET_KEY": "645588a195c5bbd"})

    app.run()

Start the app by running:

python main.py

The database (labbase2.db) and log file (log.log) will be created automatically on first run.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Third-Party Libraries

This project uses the following third-party libraries:

The above libraries are included locally in this repository or via CDNs. If included locally, their original license files are included in the respective folders.

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

labbase2-0.1.0.tar.gz (306.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

labbase2-0.1.0-py3-none-any.whl (388.5 kB view details)

Uploaded Python 3

File details

Details for the file labbase2-0.1.0.tar.gz.

File metadata

  • Download URL: labbase2-0.1.0.tar.gz
  • Upload date:
  • Size: 306.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for labbase2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 deea26cdc96a0ced29191ca3ca69c24cc33255cdea49774f51a9192d0eba4c53
MD5 7aa1144caa9e77e730062bba54b6f341
BLAKE2b-256 e226f6d607bba31a0e0458b1c6945e6fd219907eb5078d3a2b489a17153adf44

See more details on using hashes here.

File details

Details for the file labbase2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: labbase2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 388.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for labbase2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a592b877e35b61283e3ca1d2c276edcd5c6e1474047da0d6495958c122e89cd
MD5 8530eb8a4ef2b975771aca94b74db8f7
BLAKE2b-256 16830329b004e6c5fc0de684d7a04a93211fde341ace0cf22d24886195bc6d51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page