A framework for creating generative art with Python
Project description
gen-art-framework
A Python framework for generating art from parameterised scripts. Define parameter distributions in YAML, and the framework samples from them to create unique variations of your artwork.
Installation
pip install gen-art-framework
Or with uv:
uv add gen-art-framework
Quick Start
Create a script with a YAML parameter block in its docstring:
"""
parameters:
- name: seed
distribution: constant
value: 42
- name: width
distribution: constant
value: 800
- name: height
distribution: constant
value: 600
- name: num_circles
distribution: randint
low: 20
high: 50
- name: colour
distribution: choice
values: ["#e94560", "#f39c12", "#00b894"]
"""
from PIL import Image, ImageDraw
import random
random.seed(seed)
img = Image.new("RGB", (width, height), "#1a1a2e")
draw = ImageDraw.Draw(img)
for _ in range(num_circles):
x = random.randint(0, width)
y = random.randint(0, height)
r = random.randint(10, 50)
draw.ellipse([x - r, y - r, x + r, y + r], fill=colour)
img
Generate images using the CLI:
# Generate a single image
gen-art sample my_script.py
# Generate 10 variations
gen-art sample my_script.py --count 10
# Specify output directory and seed for reproducibility
gen-art sample my_script.py -n 5 -o ./output -s 42
Output files are named {script_name}_{index}_{seed}.png.
Contributing
Development Workflow
- Create a PR with your changes
- CI will run tests, linting, and formatting checks
- Once approved and merged to main, your changes are in the codebase
- When ready to release, create and push a version tag:
git tag v0.1.3 # Use semantic versioning: vMAJOR.MINOR.PATCH git push origin v0.1.3
- The tag push automatically triggers a build and publishes to PyPI
Version numbering:
patch(v0.1.1 → v0.1.2) for bug fixesminor(v0.1.1 → v0.2.0) for new featuresmajor(v0.1.1 → v1.0.0) for breaking changes
CI checks:
- Tests must pass
- No linting errors
- Code must be properly formatted
Run checks locally:
just test- run testsjust lint- check lintingjust fmt- format codejust check- format and lint together
Documentation
- CLI Usage - Command-line interface reference
- Writing Scripts - How to write parameterised art scripts
- Distributions - Available parameter distributions
- Python API - Programmatic usage
- Examples - Walkthrough of example scripts
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gen_art_framework-0.3.0.tar.gz.
File metadata
- Download URL: gen_art_framework-0.3.0.tar.gz
- Upload date:
- Size: 67.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f88f84ed29130b15eee17711f4579b8df0d607745c9f460c37ee956f84b46502
|
|
| MD5 |
8a74748e66830a85af6cf50f30e0c444
|
|
| BLAKE2b-256 |
1fc6b613c43e883e2582ae0042f9adad5de149bf48852b52a83b9d15f5dec2aa
|
Provenance
The following attestation bundles were made for gen_art_framework-0.3.0.tar.gz:
Publisher:
publish.yml on josh-gree/gen-art-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gen_art_framework-0.3.0.tar.gz -
Subject digest:
f88f84ed29130b15eee17711f4579b8df0d607745c9f460c37ee956f84b46502 - Sigstore transparency entry: 782406505
- Sigstore integration time:
-
Permalink:
josh-gree/gen-art-framework@8803e7fec5af7bba3a7fa2400ffae0ca30149462 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/josh-gree
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8803e7fec5af7bba3a7fa2400ffae0ca30149462 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gen_art_framework-0.3.0-py3-none-any.whl.
File metadata
- Download URL: gen_art_framework-0.3.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59d1a585da7fccf2fc3963b00d14d2ba3ac936ee97a3e410087d6bafc703e3cb
|
|
| MD5 |
ca683275ecfead768a981ce261735e74
|
|
| BLAKE2b-256 |
aecce65e353e6362c001d63a6044e05846a4e0060823b86af1b4d1f04a79af0d
|
Provenance
The following attestation bundles were made for gen_art_framework-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on josh-gree/gen-art-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gen_art_framework-0.3.0-py3-none-any.whl -
Subject digest:
59d1a585da7fccf2fc3963b00d14d2ba3ac936ee97a3e410087d6bafc703e3cb - Sigstore transparency entry: 782406508
- Sigstore integration time:
-
Permalink:
josh-gree/gen-art-framework@8803e7fec5af7bba3a7fa2400ffae0ca30149462 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/josh-gree
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8803e7fec5af7bba3a7fa2400ffae0ca30149462 -
Trigger Event:
push
-
Statement type: