Roll dice in your python programs
Why?
I wanted a better API to rolling dice using Python, and the usual random.randint is very good,
but doesn't really represent rolling dice quite the way I imagine it.
This was a good learning experiment, but I'm not expecting anyone to use it.
Who is this for?
People building RPGs, or games that would involve dice and who care about how their code looks like.
I may be biased, but I really believe that this library provides a much better interface than
pure random.randint.
How to install
$ pip install dragn
How to use
>> from dragn.dice import D4, D6, D8
>>> D6()
1
>>> f"You roll the die and the result is {D8()}"
'You roll the die and the result is 4'
>>> f"You roll 3 dice and you get {[D8() for _ in range(3)]}"
>>> 'You roll 3 dice and you get [3, 1, 8]'
>>> four_dice = D4 * 4
>>> f"You roll 4 dice and the results are {four_dice()}"
'You roll 4 dice and the results are (4, 3, 1, 2)'
>>> f"You roll two dice and the results are {two_dice()}"
'You roll two dice and the results are (3, 4)'
>>> dice_tower = (D6 * 2) + D4
>>> f"You roll two D6 and a D4 and check the results {dice_tower()}"
'You roll two D6 and a D4 and check the results (2, 2, 6)'
For more examples, check the tests
Metadata
Release files for dragn 0.4.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 |
|---|---|---|---|---|
| dragn-0.4.0.tar.gz | 4.7 kB | Without provenance | Details for dragn-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dragn-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for dragn-0.4.0-py3-none-any.whl |
Total release size: 10.4 kB
Release files / dragn-0.4.0.tar.gz
| Download URL | dragn-0.4.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d970ceb7e5363934a1cb7c963e518858527e38d2e1267f11269a5ff305a72d6b
|
|
BLAKE2b-256 checksum How to use checksums |
3e0d31ea6812695c6c81e7813da5c012f7a86b560aed990b16ba92169d1649db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.4
|
Release files / dragn-0.4.0-py3-none-any.whl
| Download URL | dragn-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcd2e0178179ded491fd2259b6e6692ca4b70ee492091cd674668806d4f65fce
|
|
BLAKE2b-256 checksum How to use checksums |
344517d0a3d2ff336de6ccc4b0a3f687bd0af7f9ca79942a163358d5bc808585
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.4
|
Security for dragn 0.4.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.