Skip to main content

Python Pytest pylint pylint pylint

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 PyPI:

pip install labbase2

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.

Metadata

Release files for labbase2 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labbase2 0.3.1
File Size Uploaded
labbase2-0.3.1.tar.gz 372.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for labbase2 0.3.1
File Interpreter ABI Platform
labbase2-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 772.8 kB

Release files / labbase2-0.3.1.tar.gz

Download URL labbase2-0.3.1.tar.gz
Size 372.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dfa0d4d1c968aa145eb7d95c1ee55238d80bf4eb0602593f2171e07ac1c5d1fe
BLAKE2b-256 checksum
How to use checksums
e0e3878aa435928f1e9be76f6c3c010f24830d1b71601118e4fe3e383c6f12ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.33.1

Release files / labbase2-0.3.1-py3-none-any.whl

Download URL labbase2-0.3.1-py3-none-any.whl
Size 400.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4092de7be732548d1bb4407fdb1fe092a8162300f56f241999ba622b012dd3a4
BLAKE2b-256 checksum
How to use checksums
387c9c8d70341c7dfb12df858ddf936c2ab4535686afbbe138d38e9981fef704
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.33.1

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page