Skip to main content

Uniquely generated string identifiers

Project description

This package generates unique string identifiers.

from ustrid import ustrid

unique_string_id = ustrid()

Under the hood:

import uuid
import threading


def ustrid():
    """Generate a unique string identifier (thread-safe)"""
    return Ustrid.run()


class Ustrid:

    """Private class to generate unique string identifiers (thread-safe)"""
    _lock = threading.Lock()
    _count = 0

    @classmethod
    def run(cls):
        """Generate a unique string identifier (thread-safe)"""
        with cls._lock:
            cls._count += 1
            return "{}-{}".format(cls._count, uuid.uuid4())

Installation:

pip install ustrid

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

ustrid-0.0.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

ustrid-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file ustrid-0.0.3.tar.gz.

File metadata

  • Download URL: ustrid-0.0.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.5.2

File hashes

Hashes for ustrid-0.0.3.tar.gz
Algorithm Hash digest
SHA256 efa96dbccb424dd274a7bafe65afe00032410b73d9435de4bddd45ec61e65998
MD5 e8b571eda5965bebc427765330df1989
BLAKE2b-256 6435e7296039dec4eb83bdb4ad9bb8f42d2bc8b9d7b12281a61741b912b2961d

See more details on using hashes here.

File details

Details for the file ustrid-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ustrid-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.5.2

File hashes

Hashes for ustrid-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0f150479f55fcefc04a330ad1cc3325e338fc13aebf3c1df4cf4bc84e08b7cac
MD5 aafe9bf30db5f333674019c32e0e5abd
BLAKE2b-256 da7430ead78cc67bf8ea46190a18e9d9c8a988c948edfe59a6b5bb39982c6bbb

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