random-shapes
Generate random shapes with ease.
This library is heavily inspired by this stackoverflow answer
Installation
You can install random-shapes via pip:
pip install random-shapes
However, uv is recommended for installing python packages:
uv add random-shapes
Usage
Install the optional library matplotlib for visualization:
pip install random-shapes[viz]
# or
uv add random-shapes --extra viz
With random-shapes it is easy to generate a random shape (bezier.CurvedPolygon):
from random_shapes import Shape
shp = Shape.random(n=10, r=0.05, edgy=0.2)
# Shape.curve is a bezier.CurvedPolygon, since Shape is a just wrapper
shp.curve.plot(pts_per_edge=10)
This shape can then be turned into a binary image:
import matplotlib.pyplot as plt
binary_image = shp.rasterize(h=512, w=512)
plt.imshow(binary_image, cmap="gray")
Metadata
Release files for random-shapes 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| random_shapes-0.1.0.tar.gz | 580.9 kB | Without provenance | Details for random_shapes-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| random_shapes-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for random_shapes-0.1.0-py3-none-any.whl |
Total release size: 598.6 kB
Release files / random_shapes-0.1.0.tar.gz
| Download URL | random_shapes-0.1.0.tar.gz |
|---|---|
| Size | 580.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2379efbebafd78ea7b7b33f9ed29234465d1644c5d6c7a68de77e5661bc6d65
|
|
BLAKE2b-256 checksum How to use checksums |
d34e24f65bebff236236718f28140596ebaa65e7efce556fa847191ba8155ba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.24
|
Release files / random_shapes-0.1.0-py3-none-any.whl
| Download URL | random_shapes-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2956680b1dc8430b203adea5baff8fc46a37d61f80bf69b8d359353a43320ef4
|
|
BLAKE2b-256 checksum How to use checksums |
87f02877d069ad4d77cb0ba340bc44b759889328aff9591fb1c875a893ef927f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.24
|
Security for random-shapes 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.