Metadata-Version: 2.1
Name: pysource-codegen
Version: 0.4.0
Summary: 
Author: Your Name
Author-email: you@example.com
Requires-Python: >=3.7,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: astunparse (>=1.6.3,<2.0.0) ; python_version < "3.9"
Requires-Dist: typed-ast (>=1.5.5,<2.0.0)
Requires-Dist: typing-extensions (>=4.7.1,<5.0.0)
Description-Content-Type: text/markdown

[![pypi version](https://img.shields.io/pypi/v/pysource-codegen.svg)](https://pypi.org/project/pysource-codegen/)
![Python Versions](https://img.shields.io/pypi/pyversions/pysource-codegen)
![PyPI - Downloads](https://img.shields.io/pypi/dw/pysource-codegen)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/15r10nk)](https://github.com/sponsors/15r10nk)

# 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:
``` bash
pip install pysource-codegen
```

## Usage:

The tool can be used over the CLI:

``` bash
pysource-codegen --seed 42
```

or as a library:

``` python
from pysource_codegen import generate

seed = 42
print(generate(seed))
```

You might find [pysource-minimize](https://github.com/15r10nk/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:

* https://github.com/psf/black/issues/3676
* https://github.com/psf/black/issues/3678
* https://github.com/psf/black/issues/3677

## Todo:

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

