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 tagged like *.*.*
are the trigger of releases.
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
Hashes for random_recipes-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ad65fe16144f1a7a2ba0aabce10a620a979c6ad62f6ae19a8ea7b3886091265 |
|
MD5 | ce75282d4f8a5f2638bff926d2fcdb4a |
|
BLAKE2b-256 | 2f60ba954a5b920fb17ce62d280afc747d93d18d3f88bff23a6a3a56b52ecfa1 |