Skip to main content

dungy

A small, dependency-free dungeon generator written in Python.

DungeonGenerator builds a rectangular level of non-overlapping rooms connected by corridors, then paints walls around the floor tiles and renders the result as ASCII text.

Requirements

  • CPython 3.8 or newer, or PyPy 3.8 or newer.
  • The package is pure Python and has no runtime dependencies.

The vendored dungeon.py is a CC0 implementation by James Spencer; keep its license header intact. The machine-readable citation lives in references.bib and is shipped with the package distribution.

Setup

This project uses uv.

uv sync            # create the venv and install the package + dev tools

Without uv:

python -m venv .venv
. .venv/bin/activate
pip install -e .

Usage

Run the bundled demo, which prints the room/corridor lists and the level map:

uv run python src/dungy/dungeon.py

Use it as a library:

from dungy.dungeon import DungeonGenerator

gen = DungeonGenerator(width=64, height=64, max_rooms=15)
gen.generate()
for row in gen.render():
    print(row)

Output is nondeterministic by default; pass a seeded random.Random to the constructor for reproducible levels (DungeonGenerator(rng=random.Random(0))).

Development

uv run ruff check .     # lint
uv run ruff format .    # format
uv run mypy src         # type-check against Python 3.8
uv run pytest           # unit tests
uv run mkdocs serve     # preview docs at http://127.0.0.1:8000

Build the static documentation site with uv run mkdocs build (output in site/).

Testing on PyPy 3.8

uv venv --python pypy@3.8 .venv-pypy
uv pip install --python .venv-pypy/bin/python -e . pytest
.venv-pypy/bin/python -m pytest

References

The level-generation algorithm in src/dungy/dungeon.py is adapted from James Spencer's CC0-licensed dungeon generator:

James Spencer, "A simple dungeon generator for Python 2 or 3", RogueBasin, 2017-09-02. https://www.roguebasin.com/index.php/A_Simple_Dungeon_Generator_for_Python_2_or_3

The BibTeX entry is in references.bib at the repository root; the package ships it in the distribution.

License

The dungeon generator is released under CC0. See the header in src/dungy/dungeon.py.

Metadata

Release files for dungy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dungy 0.1.0
File Size Uploaded Provenance Actions
dungy-0.1.0.tar.gz 11.3 kB With provenance Details for dungy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dungy 0.1.0
File Interpreter ABI Platform Actions
dungy-0.1.0-py3-none-any.whl Python 3 none any Details for dungy-0.1.0-py3-none-any.whl

Total release size: 20.4 kB

Release files / dungy-0.1.0.tar.gz

Download URL dungy-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
32fbdc890f3e795e2cf60a83c21a24b50d956e7b87c7397b1fb4ea7a60845d05
BLAKE2b-256 checksum
How to use checksums
6190cedb461f95e7bf5f049d7d0aa28d5f8724a61d718aed0760ba136d8b6ce5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release files / dungy-0.1.0-py3-none-any.whl

Download URL dungy-0.1.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93264c56d6be17567be6d07e5021255a2f880175b87e0f5abd43e5f010f80247
BLAKE2b-256 checksum
How to use checksums
dbd76cd70ec4d3ed0442424d8c0d4ec6ee1e5a45cb5e096c073bbd7d47625e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Security for dungy 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dungy-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page