Skip to main content

A small document database

Project description

PicoDoc 📝

This is a document database module made for small-scale applications. Please don't use this module if your data is very important. It is not tested very extensively.

This project is on pypi and on github.

Installation

The project is up on pypi (PYthon Package Index). So installing can be done using pip.

Unix & Mac os X:

pip3 install picodoc

Windows:

pip install picodoc

⚠ Notice

The objects are not really dicts and lists. So they do not support all functions of those objects.

List supports:

  • append
  • remove
  • iterating over values
  • item assignment using index
    • del list[idx]
    • value = list[idx]
    • list[idx] = new_value

Dict supports:

  • iterating over keys
  • item assignment using key
    • del list[key]
    • value = list[key]
    • list[key] = new_value

Usage

Using the library should be very straight forward. Open a database with the picodoc.open_db function and use it as if it were a dict.

To get started import the module

import picodoc

Then open the database. (The extension doesn't really matter, but I would suggest using something lile '.db' or '.picodoc')

db = picodoc.open_db('database.picodoc')

Now just treat the db as af it were a basic (see notice) dictionary.

db['users'] = {}
db['users']['donkere.v'] = {
    'name':  'Donkere Vader',
    'descprition': 'Cool dude 😎',
}

There are two ways of printing a document.

Either print it as a dict:

print(db['users']['donkere.v'])

>>>
<Document donkere.v>
{
    'name':  'Donkere Vader',
    'descprition': 'Cool dude 😎',
}

Or print it as an object:

# this will print it as if it were a document
# <Document {document key}>
print(db['users']['donkere.v'].object_repr())

>>>
<Document donkere.v>

Tip

Use the rich module for beautiful output in the console.

Testing

Testing is done via the runtests file.

To run all the tests simply do:

python3 runtests

(If you are on windows use python in stead of python3)

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

picodoc-0.1.5.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

picodoc-0.1.5-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file picodoc-0.1.5.tar.gz.

File metadata

  • Download URL: picodoc-0.1.5.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for picodoc-0.1.5.tar.gz
Algorithm Hash digest
SHA256 473100157b19af78f089f31f54f90e3c16a11d35d0858ac526d9dd6e93d32d9b
MD5 815ef8d02043f5a7542b859c63d10e70
BLAKE2b-256 5a78ce91df6355bd71b01134ada1c0f59daa1cde7b224519d2133d82e15b3f72

See more details on using hashes here.

File details

Details for the file picodoc-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: picodoc-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for picodoc-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cd6e0d9331bbd50e6f73371191b953fff3f86bb17b4a6c15a5ad97df5b3f46b4
MD5 57a58d001701b484578931b4dd9158cd
BLAKE2b-256 2ba031a6df79fe16d03cd35affbab295c066f5da500fdb66a6c073d1be6a4f33

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