Skip to main content

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

Project description

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

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

heroes-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heroes-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file heroes-0.1.0.tar.gz.

File metadata

  • Download URL: heroes-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for heroes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6ecaf10dc65f7aa0261a9221472a7342307d4cf24e1f48c9804f9429c502a0e
MD5 db67db9d332dc31758a5a473cdbbd3d0
BLAKE2b-256 edb6e46fd8cc7c885d6440f03405e3b74b1440e9de499001d0a60871861144c4

See more details on using hashes here.

File details

Details for the file heroes-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: heroes-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for heroes-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1174c7669117d27c220db6ba3b6f362a9737668d4717b30e8eca8c552041206
MD5 56a16e3d6824b7b5bc722849f8a85a43
BLAKE2b-256 908ac4510205b28192ed3607563c2840479a773e435ce66084ab6761655b8c02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page