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

Uploaded Source

Built Distribution

pysource_codegen-0.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pysource_codegen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 667f5e85f7fb9a10f3fe8853995bec907eeca89b775ccdc25747bec90d43d2ad
MD5 84abffdbd74a2dde730559fb046871c9
BLAKE2b-256 5ded62f78a58e729dcd532841899b2a80605fc30c348e896da26fa3da3c2e070

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pysource_codegen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c79e3d9b4fd40dad482787cff03c54217b8c76eb21910f046380c0978d944b65
MD5 01db4fc48587f5764bf5cf462b2f4882
BLAKE2b-256 6adee0fd7c3efe4e68d7d0365477d30d2c8c3e73972b093e034d9178c3a3a0d9

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