A dice rolling parser with a surprising number of features.
Project description
Rolling Dice
A dice rolling library written in Python that uses lark to parse dice rolls with a surprising number of features!
- Online documentation: https://dice.jamesthebard.net
- Source repository: https://codeberg.org/JamesTheBard/dice-roller
Installation
From PyPI
Simply add the diceparse package as a dependency in your project.
From Git
Requirements
- Python version 3.11 or greater
- The
uvdependency manager to handle dependency installation and virtual environment creation
To get everything setup:
$ uv venv
$ uv sync
Usage
A quick example to get rolling:
from diceparser import DiceParser
dice = DiceParser()
result = dice.roll("1d8+3")
print(result)
[
{
"_roll": "1d8+3",
"_total": 4,
"unknown": 4
}
]
Documentation
You can view the documentation by either going to the online documentation or by cloning the repo and running it locally on your computer with the following commands. It will be accessible at http://127.0.0.1:8000.
$ uv sync --group docs
$ source .venv/bin/activate
$ mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in 0.14 seconds
INFO - [11:41:03] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO - [11:41:03] Serving on http://127.0.0.1:8000/
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 diceparse-1.0.8.tar.gz.
File metadata
- Download URL: diceparse-1.0.8.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b8ed278f0955bbac773903c5cb8b70866198bf08d5c72ad1e3a27349ac87c5f
|
|
| MD5 |
b01113fe41ec1694b7cf02b99b9e7e8b
|
|
| BLAKE2b-256 |
5a6d6289e7559e431f15c414e2e5c24177f293bfb021a1fe7b75e6969a2fed74
|
File details
Details for the file diceparse-1.0.8-py3-none-any.whl.
File metadata
- Download URL: diceparse-1.0.8-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ab52ca1b17bb4fcef72a85ab959c4694d640e0442ce6768b1c9d9b71bacfb9e
|
|
| MD5 |
fc07009f094416818dc835fe7d716898
|
|
| BLAKE2b-256 |
421deea7969b14ff728e543164f9bd13cacb91d18a6ef9b345c3685c4d2e01a9
|