Skip to main content

heroes

Random superhero names -- a tiny, dependency-free Python package.

A Python take on the JS superheroes package, with a smaller curated dataset that mixes classic comic names with original, slightly silly ones (Captain Spreadsheet, Doctor Latency, The Linter, ...).

Install

pip install heroes

Usage

import heroes

heroes.gen()
# => 'Hooded'

heroes.genarr(3)
# => ['Askew-Tronics', 'Decepticon', 'Leopardon']

API

heroes.gen() -> str

Returns one random hero name from the bundled dataset.

heroes.genarr(n: int) -> list[str]

Returns a list of n unique random hero names (no duplicates).

Raises ValueError when n is negative or larger than the dataset (len(heroes._data.HEROES)).

Determinism

The library uses the module-level random module, so you can seed it for reproducible output:

import random, heroes
random.seed(42)
heroes.gen()

License

MIT

Release files for heroes 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 heroes 0.1.0
File Size Uploaded
heroes-0.1.0.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 11.2 kB

Release files / heroes-0.1.0.tar.gz

Download URL heroes-0.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c6ecaf10dc65f7aa0261a9221472a7342307d4cf24e1f48c9804f9429c502a0e
BLAKE2b-256 checksum
How to use checksums
edb6e46fd8cc7c885d6440f03405e3b74b1440e9de499001d0a60871861144c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

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

Download URL heroes-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1174c7669117d27c220db6ba3b6f362a9737668d4717b30e8eca8c552041206
BLAKE2b-256 checksum
How to use checksums
908ac4510205b28192ed3607563c2840479a773e435ce66084ab6761655b8c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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