Simple file-based database with user auth
Project description
PaperBase
PaperBase is a lightweight, file-based, plug-and-play database engine designed for quick data storage using native Python and optional C++ authentication handling.
It is perfect for small projects, prototyping, or when you need a no-server, local-first database structure.
🔧 Features
- File-system-based hierarchical database
- Insert, retrieve, edit, and delete key-value data
- User authentication using hashed passwords (with C++ auth handler)
- Easy project switching with
connect() - Modular access via
auth,config, andpdb
🚀 Installation
pip install paperbase
🧠 Usage
from paperbase import config
from paperbase import auth
from paperbase import pdb
# === CONFIG MODULE ===
# Create a new project (prints its UID)
config.createNewProject("TestProject")
# Optional: List all available projects
config.listProjects()
# Optional: Delete a project by name
# config.deleteProject("TestProject")
# Connect to a project by UID (from printed createNewProject())
config.connect("YOUR_KEY")
# === AUTH MODULE ===
# Create a new user
auth.createUser("Aritra@gmail.com", "password123")
# Sign in an existing user
auth.signInUser("Aritra@gmail.com", "password123")
# Delete a user
# auth.deleteUser("Aritra@gmail.com")
# === PDB MODULE (DATABASE) ===
# Create a new PaperBase called "Users"
pdb.newPaperBase("Users")
# Create subbases (e.g., per user/email)
pdb.newPaperSubBase("Users", "Aritra@gmail.com")
pdb.newPaperSubBase("Users", "Paper@gmail.com")
# Insert data into subbases
pdb.insertData("Users", subpath="Aritra@gmail.com", key="Name", value="Aritra")
pdb.insertData("Users", subpath="Paper@gmail.com", key="Name", value="Paper")
pdb.insertData("Users", subpath="Aritra@gmail.com", key="Role", value="Admin")
# Retrieve specific data
data = pdb.retrieveData("Users", "Name", subpath="Aritra@gmail.com")
print("Retrieved Name for Aritra:", data)
# Edit existing data
pdb.editData("Users", subpath="Aritra@gmail.com", key="Role", new_value="SuperAdmin")
# Retrieve again to verify edit
updated_role = pdb.retrieveData("Users", "Role", subpath="Aritra@gmail.com")
print("Updated Role for Aritra:", updated_role)
# Retrieve all subbases under "Users"
subbases = pdb.retrieveSubBases("Users")
print("All subbases under 'Users':", subbases)
# Retrieve all key-values in a subbase
all_data = pdb.retrieveSubBaseDatas("Users", "Aritra@gmail.com")
print("All data in Aritra's subbase:", all_data)
# Delete specific data field
pdb.deleteData("Users", subpath="Paper@gmail.com", key="Name")
# Delete a subbase
pdb.deletePaperSubBase("Users", "Paper@gmail.com")
# Delete entire PaperBase
# pdb.deletePaperBase("Users")
📃 License
This project is licensed under the MIT License.
LICENSE (MIT License)
MIT License
Copyright (c) 2025 YOUR_NAME
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paperbase-2.0.tar.gz.
File metadata
- Download URL: paperbase-2.0.tar.gz
- Upload date:
- Size: 104.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eaeac110cfdb1fe54e82e1666e9979eb0e0369fe6d72073a600aeb545c7a0f0
|
|
| MD5 |
2bab3fd7362cd30a1ebbc011878ea752
|
|
| BLAKE2b-256 |
a221c3696090a17b8517bd46eaa9fbefb6222e768d04ac11793ce60c29b9bcb5
|
File details
Details for the file paperbase-2.0-py3-none-any.whl.
File metadata
- Download URL: paperbase-2.0-py3-none-any.whl
- Upload date:
- Size: 104.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e765b324dd37dfb33b53d142ddc148af2c641d7c50533d3fb488edc3bf2aef2b
|
|
| MD5 |
f02cdb51666265463f9d36e9e0348f1f
|
|
| BLAKE2b-256 |
d24c5ea52ee75b06e80a7ddf5fc8a0aa9be73286e308bab905e3c4aaba495240
|