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.7.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

picodoc-0.1.7-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: picodoc-0.1.7.tar.gz
  • Upload date:
  • Size: 17.7 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.7.tar.gz
Algorithm Hash digest
SHA256 e7aaef5cb5f66665590638412ee3581abecd80691756303fc041d4e04a051e05
MD5 0748ba29fb4efd7aaaafa087a3417536
BLAKE2b-256 36df52674ac04655226ac554d8a6ae845accf6558f19fbe4a0b388c1e0893af7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: picodoc-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 19.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 17b276353a8049d4bbb07d570c6c0dfe7a53333a2762b4848315ff82b8fbc7e7
MD5 25b2eaecc979cc12bb1f4dedec7e6586
BLAKE2b-256 881db2990f3d8bb46dbb7425506315b71c467b446567a625076285c9d00fc305

See more details on using hashes here.

Supported by

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