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

Uploaded Source

Built Distribution

pysource_codegen-0.3.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pysource_codegen-0.3.0.tar.gz
Algorithm Hash digest
SHA256 69c2bca0416fdbb6b8e9b4e96bbf8ac11e37637f9f6a240bb563edc057ff7174
MD5 c6300dded790be53c7ab5471c82be746
BLAKE2b-256 1033f59dec5e0d97c8259bf43a4caef984fb59f8fc0ebbd10ba93c0b60af7214

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pysource_codegen-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 434e77b81f570954958564d552ffedf7a0ce76bed2c3ca9beb260027a3b5f1ee
MD5 06ce51671761a212f8e38891aa89f4b6
BLAKE2b-256 a620ac0f51f33d19f9160dcb4722fbe7bf32315ec0bb1705031cceefa29f9a40

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