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 object types, collection types, and file types that may be useful.
Recipes
Objects
Object 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 |
int | random_int |
str | random_str |
Collections
Collection Type | Function |
---|---|
dict | random_dict |
collections.abc.Iterable[dict] | random_dicts |
Files
File Extension | Function |
---|---|
.csv | random_csv |
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
Formatting
We use Black to format our Python code. We enforce black through a pre-commit hook defined in .pre-commit-config.yaml.
Testing
We use pytest for testing, and our tests are located in /tests.
We run our tests during the pre-push hook, pytest
.
We use coverage for test coverage, and we assert our test coverage is 95%.
Test coverage is checked during the pre-push hook, coverage
.
Documentation
We use genbadge to generate our tests
and coverage
badges.
Badges are generated during the pre-push hooks genbdage-tests
and genbadge-coverage
.
Releases, Tagging, and Versioning
Releases are automatically versioned by the poetry project's version in pyproject.toml
.
Developers are responsible for incrementing the project version manually when they modify source code.
If they forget, the pre-push hook, poetry-auto-semver
will increment the patch version by 1.
To create a release on GitHub and PyPi, push a commit to the main
branch that affects any of the paths:
random_recipes/**
pyproject.toml
poetry.lock
The release action will automatically:
- Install the project
- Test the project
- Assert test coverage is 95%
- Build the project for distribution
- Create a GitHub release
- Autogenerate release notes
- Upload distribution files
- Publish the project to PyPi
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
File details
Details for the file random_recipes-0.1.0.tar.gz
.
File metadata
- Download URL: random_recipes-0.1.0.tar.gz
- Upload date:
- Size: 5.2 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 | 0c4c75d1fe7bdbc39d12b1a79b6d5966791242fcd02cbc888f1078b9dd4eacee |
|
MD5 | c275e7c0c3f2e0d98460c4f7ed817204 |
|
BLAKE2b-256 | 4440dba76ec7ff7844f8c43d0404bc318d952d464579212f8c27a77670dc60b0 |
File details
Details for the file random_recipes-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: random_recipes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 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 | 5a784b2ee8dea922d9f5d0347a8485bf18807d0dae294e15a255103eb96a49ef |
|
MD5 | 263cf9eb0a22d9afe6a6663b2f0e5a59 |
|
BLAKE2b-256 | 2343679b166688a1343276e2d03286adf5bdc062a2928748a68fa9193302bd61 |