Skip to main content

A library to name and identify things

Project description

Roke

Roke is a tool and a library to create identifiers. The goal is that these identifiers should be:

  • More or less unique.
  • Easy to read, so you can read it to someone else over a phone, for example.
  • Configurable: not a single pattern in how they look
  • Customizable: it should be easy to do things like "make it work in spanish"

To do this, inspired by a talk about Magic Wormhole ... I did pretty much the same thing they did.

Command Line Tool

By default, Roke will give you identifiers made out of two nouns and a small number. Like this:

$ roke
19-hassock-disregard

You can tell roke to print more than one identifier, so you can choose a nice one.

$ roke --count 5
9-vibrissae-truth
4-bathrobe-somewhere
10-dysfunction-overview
19-aardvark-viola
5-mutt-pamphlet

You can change the pattern of the identifiers:

$ roke --count 5 --pattern '{noun}+{noun}'
plate+pasture
pickle+syrup
colloquy+bracelet
prisoner+businessman
membrane+approach

Roke comes with two basic dictionaries:

You can add more dictionaries by putting files with the ".txt" extension and one word per line in any of the following places:

~/.local/roke
.roke

Python Library

You can use Roke inside your own projects by using it as a library. This example shows how:

>>> import roke
>>> roke.load_dicts()
>>> roke.gen_identifier('{noun}-{smallnum}')
'village-18'

That's all there is to it.

Technical Notes

So, how unique are the identifiers?

If you use the default pattern {smallnum}-{noun}-{noun} there are only 925 072 020 possible identifiers. So: NOT VERY UNIQUE.

Do not use this as a password or a secret! ... at least not using that pattern.

They should be unique enough for situations where you just need something to be "unique for a while" in a certain environment. Like, container names, or maybe your children.

Mandatory XKCD:

XKCD

Full Comic

Why the name?

Roke is the name of an island in Earthsea. To know more about Roke and names, just read the Earthsea books by Ursula K LeGuin, they are awesome.

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

roke-0.1.3.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

roke-0.1.3-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file roke-0.1.3.tar.gz.

File metadata

  • Download URL: roke-0.1.3.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.2.1-arch1-1

File hashes

Hashes for roke-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ff9b605e61ded31fa5a6aa497378b3878e055b9538eaf7081815cf960c309a3d
MD5 982faab4139d0cf2f473ca6c7f319647
BLAKE2b-256 25475e1a9801b70fa58648c6989bc3c3794902db4638ccf52dc1b1c4fb0f5738

See more details on using hashes here.

File details

Details for the file roke-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: roke-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.2.1-arch1-1

File hashes

Hashes for roke-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 700b0bc3a68e3a793332d488ecae1c1fced4fd1714757d7c5f5a0ddbd637e13e
MD5 85387524e317c2e5b17ded25cc900f80
BLAKE2b-256 436f22f513ba45c46936fce0d58b313646c2ebddee3f2b6c485a57561cb1039d

See more details on using hashes here.

Supported by

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