Skip to main content

Generate unique identifiers only using emojis

Project description

IDoji

Lint Unittests codecov

pypi python license Code style: black Imports: isort

What if you could combine the magical fun of emojis and the unique uniqueness power of UUIDs.

What if you had a format to label objects, so powerful and elegant, that you enjoy sending those over your favorite messenger.

What if you had a small python package, providing you all of that and much more.

Welcome to IDoji.

Installation

Installation can be done via pip

pip3 install idoji

Usage

IDoji can be used as a superior alternative to UUIDs. Common functionality provided by UUIDs can be found in IDojis, as well as facilities to mix both types or convert between them.

Instantiate them

It is possible to instantiate a completely random IDoji as well as using values of the type str, int or even UUID.

>>> from idoji import IDoji
>>> idoj = IDoji()
>>> print(idoj)
๐ŸฆŸ๐Ÿฆ„๐Ÿ˜—๐Ÿ˜…-๐Ÿฅฝ๐Ÿฆ„-๐Ÿ™Œ๐Ÿฆฉ-๐Ÿฅณ๐Ÿฅฑ-๐ŸงŠ๐Ÿฅ–-๐Ÿคญ๐Ÿฆ๐Ÿฆฒ๐Ÿ˜’

It is also possible to use existing UUIDs in several forms.

>>> from uuid import uuid4
>>> uuidval = uuid4()
>>> print(uuidval)
e4f4d80c-01f4-4504-b18b-6061bb619aa3
>>> idoj_from_uuid = IDoji(uuidval)
>>> print(idoj_from_uuid)
๐Ÿฆณ๐Ÿงƒ๐Ÿฆง๐Ÿ˜Œ-๐Ÿ˜๐Ÿงƒ-๐Ÿ™…๐Ÿ˜„-๐Ÿฆ€๐Ÿฅ™-๐Ÿคœ๐Ÿค-๐ŸฆŠ๐Ÿค๐Ÿฅจ๐Ÿฅฑ
>>> repr(idoj_from_uuid)
"IDoji('e4f4d80c-01f4-4504-b18b-6061bb619aa3')"
>>> idoj_from_uuid_str = IDoji("e4f4d80c-01f4-4504-b18b-6061bb619aa3")
>>> print(idoj_from_uuid_str)
๐Ÿฆณ๐Ÿงƒ๐Ÿฆง๐Ÿ˜Œ-๐Ÿ˜๐Ÿงƒ-๐Ÿ™…๐Ÿ˜„-๐Ÿฆ€๐Ÿฅ™-๐Ÿคœ๐Ÿค-๐ŸฆŠ๐Ÿค๐Ÿฅจ๐Ÿฅฑ

And of course, if you get an IDoji string from somewhere, you can use that to instantiate an object as well.

>>> idoj = IDoji("๐Ÿฆณ๐Ÿงƒ๐Ÿฆง๐Ÿ˜Œ-๐Ÿ˜๐Ÿงƒ-๐Ÿ™…๐Ÿ˜„-๐Ÿฆ€๐Ÿฅ™-๐Ÿคœ๐Ÿค-๐ŸฆŠ๐Ÿค๐Ÿฅจ๐Ÿฅฑ")
>>> print(idoj)
๐Ÿฆณ๐Ÿงƒ๐Ÿฆง๐Ÿ˜Œ-๐Ÿ˜๐Ÿงƒ-๐Ÿ™…๐Ÿ˜„-๐Ÿฆ€๐Ÿฅ™-๐Ÿคœ๐Ÿค-๐ŸฆŠ๐Ÿค๐Ÿฅจ๐Ÿฅฑ
>>> repr(idoj)
"IDoji('e4f4d80c-01f4-4504-b18b-6061bb619aa3')"

Compare them

IDojis can be compared against each other as well as UUIDs.

Comparison against IDoji objects as well as their string representation is available.

>>> idoj = IDoji()
>>> idoj_same = IDoji(idoj.uuid)
>>> idoj_diff = IDoji()
>>> print("{} -- {} -- {}".format(idoj, idoj_same, idoj_diff))
๐Ÿคช๐Ÿฆž๐Ÿคณ๐Ÿฅ”-๐Ÿฆ๐ŸฅŽ-๐Ÿ™„๐Ÿฆฃ-๐ŸฆŒ๐Ÿ˜ถ-๐Ÿ˜จ๐Ÿ˜ฏ-๐Ÿฆน๐Ÿฆฃ๐Ÿ˜„๐Ÿฅž -- ๐Ÿคช๐Ÿฆž๐Ÿคณ๐Ÿฅ”-๐Ÿฆ๐ŸฅŽ-๐Ÿ™„๐Ÿฆฃ-๐ŸฆŒ๐Ÿ˜ถ-๐Ÿ˜จ๐Ÿ˜ฏ-๐Ÿฆน๐Ÿฆฃ๐Ÿ˜„๐Ÿฅž -- ๐Ÿฆช๐Ÿคœ๐Ÿฆ’๐Ÿฆต-๐Ÿค๐Ÿงƒ-๐Ÿ™‹๐Ÿฅ“-๐ŸฅŸ๐Ÿฅง-๐Ÿฆ๐Ÿฆน-๐Ÿฅช๐Ÿ˜Ž๐Ÿงก๐Ÿฆ—
>>> idoj == idoj_same
True
>>> idoj == idoj_diff
False
>>> idoj == "๐Ÿคช๐Ÿฆž๐Ÿคณ๐Ÿฅ”-๐Ÿฆ๐ŸฅŽ-๐Ÿ™„๐Ÿฆฃ-๐ŸฆŒ๐Ÿ˜ถ-๐Ÿ˜จ๐Ÿ˜ฏ-๐Ÿฆน๐Ÿฆฃ๐Ÿ˜„๐Ÿฅž"
True
>>> idoj == "๐Ÿฆช๐Ÿคœ๐Ÿฆ’๐Ÿฆต-๐Ÿค๐Ÿงƒ-๐Ÿ™‹๐Ÿฅ“-๐ŸฅŸ๐Ÿฅง-๐Ÿฆ๐Ÿฆน-๐Ÿฅช๐Ÿ˜Ž๐Ÿงก๐Ÿฆ—"
False

Also comparison against UUIDs and their string representation is possible as well.

>>> uuidval = uuid4()
>>> print(uuidval)
627adf41-739a-4b5a-b727-d8add4124884
>>> idoj_from_uuid = IDoji(uuidval)
>>> idoj_from_uuid == uuidval
True
>>> idoj_from_uuid == "627adf41-739a-4b5a-b727-d8add4124884"
True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

idoji-1.0.0-py-none-any.whl (17.4 kB view hashes)

Uploaded

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