Skip to main content

No project description provided

Project description

pypi version Python Versions PyPI - Downloads GitHub Sponsors

Introduction

pysource_codegen is able to generate random python code which can be compiled. The compiled code should no be executed.

This is still a very early version, but it does its job. It is general useful to test tools like formatters, linters or anything which operates on python code.

Install:

pip install pysource-codegen

Usage:

The tool can be used over the CLI:

pysource-codegen --seed 42

or as a library:

from pysource_codegen import generate

seed = 42
print(generate(seed))

You might find pysource-minimize also useful to reduce the generated code which triggers your bug down to a minimal code snipped, which can be used to fix the issue.

Bugs found in other projects:

Todo:

  • refactor the existing code
  • use probabilities for the ast-nodes from existing python code (use markov chains)
  • support older python versions
  • allow to customize the probabilities to generate code to test specific language features

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

pysource_codegen-0.4.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

pysource_codegen-0.4.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file pysource_codegen-0.4.1.tar.gz.

File metadata

  • Download URL: pysource_codegen-0.4.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.0 Linux/5.10.0-25-amd64

File hashes

Hashes for pysource_codegen-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0dbd666d87c1ccd377cfd5a6f66ead24f5da97f78f3ba1c6a899cde3533c25d1
MD5 4b0bdffed49dc4dc363c20baced47b18
BLAKE2b-256 42347877418b43dd7fc73fe4b25a85e591bec0f74defd583afed8d6f9bcda666

See more details on using hashes here.

File details

Details for the file pysource_codegen-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: pysource_codegen-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.0 Linux/5.10.0-25-amd64

File hashes

Hashes for pysource_codegen-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa8e53c8886d09f002ad73119b0001e3227f437af8ffd3e7c8b42c41223a2a4
MD5 dd07ee90cee622cb70759004438203c6
BLAKE2b-256 e77eab0512cb884294678abf1a367cb32d0ba707b349ec26c7f0a7bcaa666db1

See more details on using hashes here.

Supported by

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