Recipes to generate random instances of various types, beyond the scope of random.
Project description
Random Recipes
Recipes to generate random instances of various types, beyond the scope of random.
Python's random implements generators for pseudo-random bytes, integers, and sequences. In random-recipes we collect additional functions to generate random instances of common types that may be useful.
Recipes
| Type | Function |
|---|---|
| bool | random_bool |
| bytes | random_bytes |
| decimal.Decimal | random_decimal |
| datetime.date | random_date |
| datetime.datetime | random_datetime |
| float | random_float |
| fractions.Fraction | random_fraction |
| str | random_str |
Installation
Install the library with pip from PyPi:
pip install random-recipes
Development
random-recipes is developed by @ipear3.
This is a low-commitment project for practicing Python packaging, but it does try to contribute something of value.
Suggestions, comments, and contributions are welcome.
This project draws inspiration from more-itertools, a well-designed, simple extension to a Python's itertools.
Packaging & Dependency Management
Get started with development by installing the project with dev and test dependency groups via Poetry: poetry install --with dev
Testing
Although tests are automatically run pre-commit, developers must agree to create robust tests.
Releases
Releases are triggered automatically by commits to branch main with a tag like *.*.*, thanks to the Release action.
The release action is defined in release.yml.
Tags
Commits are automatically tagged like *.*.* any time a new project version in pyproject.toml is committed, thanks to the git-tag pre-commit hook.
The tag pre-commit hook is defined in .pre-commit-config.yaml.
Standards
Project standards are enforced by pre-commit hooks and GitHub Actions.
| Standard | Script | Pre-commit Hook | GitHub Action |
|---|---|---|---|
| Source changes should bump the project version. | poetry version patch/minor/major |
||
README.md should display badges for tests, coverage. |
scripts/tests-and-coverage.sh |
||
| Code should be formatted by Black. | black . |
black | |
Source changes should pass pytest. |
pytest |
||
| Test coverage percentage should be 100%. | coverage |
||
pyproject.toml should be kept up to-date. |
poetry-check | ||
poetry.lock should be kept up-to-date. |
poetry-lock | ||
| Source changes should be tagged. | git tag $(poetry version --short) |
||
| Source changes should be released. | Release |
Project details
Release history Release notifications | RSS feed
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 random_recipes-0.0.5.tar.gz.
File metadata
- Download URL: random_recipes-0.0.5.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8947d79d113e3428c52265e1e3ecaa1b2f840288e3cd383509eb6d1eafc21f43
|
|
| MD5 |
817619111fe943c93f084cfe0d36b1e1
|
|
| BLAKE2b-256 |
3a36aaacabcbbf4b0543d5a0c20a16ded109dd2928bb3d22fbef602a9909156b
|
File details
Details for the file random_recipes-0.0.5-py3-none-any.whl.
File metadata
- Download URL: random_recipes-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b498c3d2e7ddff091fc2d46ddc2092172f5a538f0941fbf9692565ff061411e
|
|
| MD5 |
61d92bbbd98cb4f38bc2be5f5a9c4cd9
|
|
| BLAKE2b-256 |
e94c7ebde58cb3476a124bb76edc2d6fb5abb3df86f3446b77774977a510b986
|