Library for simulating dice, dice rolls, and stats on dice.
Project description
About
die is a dice library, for RPG and Board Game games, tools, whatever.
Emphasizes flexibility over speed.
Installing
via pip:
pip install die
via uv:
uv add die
Using
import die d6 = die.Standard(6) d6.roll() # -> single roll, e.g. 4 d6 + 3 # -> roll + 3 roll = die.Roll((die.Standard(6), die.Standard(6))) roll.roll() # -> sum of both dice
See examples/demo.py for a fuller walkthrough.
Testing
Requires uv.
uv sync uv run pytest uv run ruff check . uv run ruff format --check .
Unittests run against Python 3.11, 3.12, 3.13 via GitHub Actions.
History
- 1.0.0
Modernized packaging: src-layout, pyproject.toml/hatchling, uv, MIT license, GitHub Actions CI. No API changes.
- 0.4.0
Backwards incompatible. Operators, coercions, comparisons roll die, str() no longer does)
- 0.3.0
Merged rolls() into roll(), renamed tuple_* to, added die.items property. str() rolls die,
- 0.2.0
Updated to modern style, pep8, tests, docs, travis-ci, more unittests. Py3.x support.
- 0.1.0
Initial release.
Project details
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 die-1.0.0.tar.gz.
File metadata
- Download URL: die-1.0.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d131f66ce038e49c2b5dc438ecc1729cafa1160ec27d933bac7f90d37e38f031
|
|
| MD5 |
94220f82132ea112d1432e71970a3067
|
|
| BLAKE2b-256 |
53a9be426ca9c34c3be0e9b5a8dee150e313619551ed0ed83c7ff41a00471e35
|
File details
Details for the file die-1.0.0-py3-none-any.whl.
File metadata
- Download URL: die-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e805f66c737bc1ffb792bf35f29b6a8d3c439075492ae240b17e0142836d380
|
|
| MD5 |
d26ea11116d25b79291e3f7e63931f6d
|
|
| BLAKE2b-256 |
3602bc1ac99100e73e4d1721342c16d4ea87e85be88c7772e8721e5ad8f49b83
|