Skip to main content

Markdown as plain-text data storage

Project description

markstore

Markdown as plain-text data storage

But Why?

Why use this when there are numerous alternatives for data storage and serialization?
Check if your use-case meets the following criteria:

  1. Primarily human readable (not necessarily, writable) plain-text, especially for non-programmers
  2. Easy consumption by version control
  3. Easy export, or a desire to prevent vendor lock-in to your application

What this is

A simple, json-like interface to serialize basic objects to and from a markdown file.

What this isn't

  • A generic markdown processing/generator tool
  • A configuration language

It is a non-goal of this library to be tolerant of human error. The intended use case is machine-to-machine serialization and the occasional export to a human.

Example

To File

import markstore

# Serialize
myObject = {
    "myKey": "myData"
}

with open("out.md", mode='wb') as f:
    markstore.dump(myObject, f)

# Deserialize
with open("out.md", mode='rb') as f:
    myObject = markstore.load(f)

To String

import markstore

# Serialize
myObject = {
    "myKey": "myData"
}

myStr = markstore.dumps(myObject)

# Deserialize
myObject = markstore.loads(myStr)

Markdown Object Specification

Lists

["one", "two", "three", ["four", "five"], "six"]

Translates to

- one
- two
- three
- - four
  - five
- six

Dicts

{
    "key1": "data1",
    "key2": "data2",
    "key3": { 
        "subkey1": "subdata1",
        "subkey2": "subdata2"
        }
}

Translates to

# key1
data1
# key2
data2
# key3
## subkey1
subdata1
## subkey2
subdata2

Combinations

{
    "Key1":
    "My Data",
    "Data": [{
        "Subkey1": "Subdata1"
    }, {
        "Subkey2": {
            "Subkey2.1": "Subdata2.1",
            "Subkey2.2": "Subdata2.2"
        }
    }],
    "Key2":
    "Other data"
}
# Key1
My Data
# Data
- ## Subkey1
  Subdata1
- ## Subkey2
  ### Subkey2.1
  Subdata2.1
  ### Subkey2.2
  Subdata2.2
# Key2
Other data

Inner dictionary keys are always prefixed by an increasing number of #, even if the key is within a list

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

markstore-1.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

markstore-1.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file markstore-1.1.0.tar.gz.

File metadata

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

File hashes

Hashes for markstore-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8b835dbd58f2aac29c7a1ac3f9c376ea97e90ec182716a81d2b37e22d44aa281
MD5 c3fdc29caa1916c15c4d65fadb4b9296
BLAKE2b-256 314632a0086a1f7652f71268de5f08ad418de6a1aeff24076e8ebd108af659a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for markstore-1.1.0.tar.gz:

Publisher: dist.yaml on alagyn/markstore

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

File details

Details for the file markstore-1.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for markstore-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ced172641b7a389c7e5a9c4f01a1c2e4e613843cbceae0cdaaee0d083c8ce67
MD5 0655c270725d1bd5ca437a72ae2e191b
BLAKE2b-256 70c96ea2985539d01d268921199eaeba56c0f743368468ad0d322d6129af0d47

See more details on using hashes here.

Provenance

The following attestation bundles were made for markstore-1.1.0-py3-none-any.whl:

Publisher: dist.yaml on alagyn/markstore

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