Skip to main content

PGen provides generating of data and tests with given format (numbers, string, graphs, etc). PGEN IS STILL IN ACTIVE DEVELOPMENT AND CONTAINS BUGS. If you find a bug please file a report in the issues section.

Features:

  • Input format is JSON-text or object

  • Unlimited depth of data

  • Pure python without dependencies

  • Basic types generation (int, double, string)

  • Generation of complex types (graph, tree, container)

Installation:

pip install PGen

Documentation:

Basic types:

  • int

  • double

  • string

Complex types:

  • pair

  • container

  • array

  • tree

  • graph

Will be extended soon…

Examples:

Typical usage often looks like this:

#!/usr/bin/env python

from pgen.generator import Generator

data_description = {
    'seed': 42,
    'count': 3,
    'format': {
        'name': 'N',
        'type': 'int',
        'from': 10,
        'to': 100
    },
    'output': {
        'type': 'file',
        'format': 'tests/{0:03d}.dat',
        'start_index': 3
    }
}

generator = Generator(data_description)
generator.write()

Using variable name:

#!/usr/bin/env python

from pgen.generator import Generator

data_description = {
    'seed': 42,
    'count': 3,
    'format': {
        'type': 'container',
        'elements': [
            {'name': 'n', 'type': 'int', 'from': 3, 'to': 15},
            {
                'type': 'array', 'length': 'n', 'subelement': {
                    'type': 'int',
                    'from': 0,
                    'to': 1
                }
            }
        ]
    },
    'output': {
        'type': 'file',
        'format': 'tests/y_{0:03d}.dat',
        'start_index': 3
    }
}

generator = Generator(data_description)
generator.write()

String patterns:

#!/usr/bin/env python

from pgen.generator import Generator

data_description = {
    'seed': 42,
    'count': 3,
    'format': {
        'type': 'string',
        'length': 32,
        'patterns': ['A-B', 'a-b']
    },
    'output': {
        'type': 'file',
        'format': 'test/{0:03d}_out.dat',
        'start_index': 3
    }
}

generator = Generator(data_description)
generator.write()

Metadata

Release files for PGen 0.2.1

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

Source distribution (sdist)

Source distribution for PGen 0.2.1
File Size Uploaded Provenance
PGen-0.2.1.zip 18.6 kB Without provenance Details

Release files / PGen-0.2.1.zip

Download URL PGen-0.2.1.zip
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f71b6a0f6c51c518e6ce2295f19b82f9687bfceb6f9f9be4376203ee4afdf90c
BLAKE2b-256 checksum
How to use checksums
3c683cd7faa8bc9b060eea452c5d6f27919dfb664cc4d1259998718a2360e05c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for PGen 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

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