Skip to main content
https://github.com/petrnymsa/jdog/workflows/build-test/badge.svg https://readthedocs.org/projects/jdog/badge/?version=latest

Just another Data Offline Generator (JDOG) 🐶

🗎 Full documentation.

  • JDOG is Python library which helps generate sample data for your projects.

  • JDOG can be run also as CLI tool.

  • For generating sample data, the data scheme is provided

  • The scheme is in JSON format

Scheme

  • Scheme is provided in JSON format with special placeholders.

  • In the output placeholders are replaced with some generated data.

Any valid JSON is valid scheme.

How to use it?

Prepare scheme

{
  "{{range(people,4)}}": {
    "name": "{{name}}",
    "age": "{{age}}",
    "address": {
      "city": "{{city}}"
    },
    "car": "{{option(mustang,{{empty}})}}"
  }
}
from jdog import Jdog

def main():
    jdog = Jdog()
    scheme = ... # your loaded scheme

    # parse scheme
    jdog.parse_scheme(scheme)

    # generate instance
    result = jdog.generate()

    print(result) # result is JSON

And the example result:

{
    "people": [
        {
            "name": "Brandi Young",
            "age": 39,
            "address": {
                "city": "Jamietown"
            },
            "car": "mustang"
        },
        {
            "name": "Michelle Best",
            "age": 70,
            "address": {
                "city": "Port Dustin"
            },
            "car": ""
        },
        {
            "name": "Donald Hernandez",
            "age": 79,
            "address": {
                "city": "East Julieshire"
            },
            "car": "mustang"
        },
        {
            "name": "Kaitlyn Cook",
            "age": 3,
            "address": {
                "city": "Rachelton"
            },
            "car": "mustang"
        }
    ]
}

CLI

Package can be used as cli tool.

Usage: jdog [OPTIONS] SCHEME

Accepts SCHEME and generates new data to stdin or to specified OUTPUT

Options:
  -p, --pretty           Output as pretty JSON.
  -s, --strict           Raise error when no matching placeholder is found.
  -l, --lang TEXT        Language to use.
  --lang-help            Displays available language codes and exit.
  -o, --output FILENAME  Output file where result is written.
  --help                 Show this message and exit.

By default, CLI tool does not save output to file, just print results to standard output.

👍 JDOG is using awesome package Faker which is used to generate random data.

CONTRIBUTING

LICENSE

Release files for jdog 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jdog 0.2.2
File Size Uploaded
jdog-0.2.2.tar.gz 10.6 kB Details

Release files / jdog-0.2.2.tar.gz

Download URL jdog-0.2.2.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
53171f4a8f36c876c9afcce4e46bdbccd1ba452bd78c84ea11fae0ac76b7d2a0
BLAKE2b-256 checksum
How to use checksums
ebd1ab33b2e397b79b9ad47408907c79a01be1691ccf7915eb3b9dee8b481fe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

Release history Release notifications | RSS feed

1.0.0

1 release file

This release

0.2.2 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page