Skip to main content

A lightweight database utility package

Project description

MineDB

PyPI: https://pypi.org/project/minedb/

MineDB is a lightweight Python library that provides local persistent storage for Python applications. It allows you to store data on disk, retrieve it later, and work with it safely without using an external database.

MineDB is designed to be simple, predictable, and safe. It focuses on local storage use cases such as application state, configuration data, and small datasets that need to persist between program runs.


What MineDB does

MineDB provides:

  • Persistent local storage
  • Structured data storage with schemas
  • Type validation
  • Encrypted storage on disk
  • Safe modification and removal of stored data

MineDB does NOT aim to replace full database systems. It is intended for lightweight, local use cases.


Installation

Install MineDB using pip:

pip install minedb


Basic Usage

Create a MineDB instance:

from MineDB import MineDB

db = MineDB()

Create a database and a collection with a defined structure:

db.createDB("app") db.createCollection( "app", "settings", theme="text", notifications="bool" )

Store data:

db.load(theme="dark", notifications=True)

Modify stored data:

db.modify("theme", "dark", "notifications", False)

Remove stored data:

db.remove("theme", "dark")

Save data to disk:

db.save()


How MineDB works

  • Data is stored locally on disk
  • Data is encrypted before being written to disk
  • Each collection has a fixed structure (schema)
  • All fields in a collection always stay aligned
  • Invalid data types raise errors immediately
  • Partial writes and silent corruption are prevented

MineDB prioritizes correctness and safety over convenience.


Schema and Data Types

Supported data types:

  • text
  • int
  • float
  • bool
  • chr

MineDB enforces data types strictly. Attempting to store an invalid type will raise an error.


Schema Changes

You can safely change the structure of a collection:

Add a new field:

db.alterAddField("app", "settings", "font_size", "int")

Remove a field:

db.alterDropField("app", "settings", "font_size")

Change a field type (with safe conversion):

db.alterFieldType("app", "settings", "notifications", "int")


Encryption

MineDB encrypts all stored data using cryptography. The encryption key is generated automatically on first use and reused for future sessions.

Encryption is intended to protect local data from casual inspection. It is not designed for high-threat security environments.


Error Handling

MineDB raises errors when invalid operations are performed. Examples include:

  • Using invalid data types
  • Accessing missing fields or collections
  • Attempting unsafe schema changes

Errors are raised explicitly to prevent silent failures.


Testing

MineDB is fully tested using pytest. Tests cover:

  • Schema integrity
  • Data insertion and removal
  • Type validation
  • Index alignment
  • Safe schema modification

Requirements

  • Python 3.9 or higher
  • cryptography

License

MineDB is released under the MIT License. See the LICENSE file for details.


Author

Harsh Singh Sikarwar


Disclaimer

MineDB is intended for lightweight local storage use cases. It is not designed to replace full database systems or distributed storage solutions.

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

minedb-1.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

minedb-1.0.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file minedb-1.0.3.tar.gz.

File metadata

  • Download URL: minedb-1.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minedb-1.0.3.tar.gz
Algorithm Hash digest
SHA256 31a515064a1a238626b70c890be051eb7ecec3c9e63edef0034415bf032e4258
MD5 77f248f0cef66889b3ccb6c9164a882c
BLAKE2b-256 f779ec73cd4df524ee7d492deaa5bd18e40ff97ef580c0581ed5e0b6c47190ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for minedb-1.0.3.tar.gz:

Publisher: python-publish.yml on Harshsikarwar/MineDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file minedb-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: minedb-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minedb-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc213e3a34f001e237206c3d7c2dde460583a7296c92dccebba79285704300c3
MD5 1fb4ec3a7980a9c34b6ccb79c1828611
BLAKE2b-256 889aebf43e6237819699502414c335b7713fb2aa05483cfe09a7055f385af11a

See more details on using hashes here.

Provenance

The following attestation bundles were made for minedb-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on Harshsikarwar/MineDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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