Skip to main content

Python Codes for DnD 5e

Project description

DnD4py - A collection of codes for D&D 5th Edition


DnD4py can be installed through pip via

pip install DnD4py

It can also be installeded by running

make install

from inside the respository.


DnD4py contains a number of miscelanious codes for use with D&D 5th edition. They include:


Simulate a complex roll of many dice and modifiers Gives result, individual rolls, the mean of the distribution and the percentile of that roll relative to the distribution.


$ roll 3d8 + 1d6 + 10

returns a roll similar to:

Total:   25
= 12      + 3   + 10
[7 2 3] + [3] + 10
Mean: 27.0
Percentile: 28.9%


Lookup D&D terms on Roll20.

Currently supported: spells, items, and monsters


$ lookup5e potion of healing


Potion Of Healing

Item Type: Adventuring Gear
Subtype: Potion
Weight: 0.5

You regain 2d4 + 2 hit points when you drink this potion.  The potion's red
liquid glimmers when agitated.

You can shorten the lookup time if you know what category your search falls under:

$ lookup5e --monster goblin

is also identical to

$ monster5e goblin

with both returning:


HP: 7 (2d6)
AC: 15 (Leather Armor, Shield)
Speed: 30 ft.
Challenge Rating: 1/4

8 (-1)	14 (+2)	10 (+0)	10 (+0)	8 (-1)	8 (-1)

Type: humanoid (goblinoid)
Size: Small
Alignment: Neutral Evil
Senses: Darkvision 60 Ft.
Skills: Stealth +6
Languages: Common, Goblin

Nimble Escape: The goblin can take the Disengage or Hide action as a
bonus action on each of its turns.

Scimitar: Melee Weapon Attack: +4
to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.

Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2)
piercing damage.

You can also try:

$ spell5e fireball


$ item5e deck of many things

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

DnD4py-1.0.5.tar.gz (5.5 kB view hashes)

Uploaded source

Built Distribution

DnD4py-1.0.5-py3-none-any.whl (6.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page