Skip to main content

b64uuid


pytest


A small library and tool to encode/decode a python UUID object to/from a 22 characters shorter URL safe base64 string.

We can use it to make UUID string a little shorter.

Installation

  • Install from PyPI:

    pip install b64uuid
    
  • Install from source :

    Clone or download whole project, enter the project's root directory, then

    pip install -e .
    

    or

    python setup.py install
    

Check https://packaging.python.org/tutorials/installing-packages/ for more details.

Command Line Usage

  • Make a random short ID

    $ b64uuid
    bxntPh4PSA6-OMDfBXMLhQ
    
  • Short ID from UUID

    $ b64uuid -u 2863a16d-b6ae-45a2-9d74-98d20377d56a
    KGOhbbauRaKddJjSA3fVag
    
  • Short ID to UUID

    $ b64uuid -s KGOhbbauRaKddJjSA3fVag
    2863a16d-b6ae-45a2-9d74-98d20377d56a
    

Library Usage

  • Shorten UUID string

    >>> from uuid import uuid1
    >>> from b64uuid import B64UUID
    >>>
    >>> uid = uuid1()
    >>> str(uid)
    'cb6e319c-d793-11ea-9619-1cb72cde3f7f'
    >>> bid = B64UUID(uid)
    >>> str(bid)
    'y24xnNeTEeqWGRy3LN4_fw'
    
  • Generate a new short ID

    >>> from b64uuid import B64UUID
    >>>
    >>> B64UUID().string
    'Ft018l4aTwalxqDHMQoqTQ'
    
  • Restore UUID from short ID

    >>> from uuid import uuid1
    >>> from b64uuid import B64UUID
    >>>
    >>> uid = uuid1()
    >>> uid.hex
    '95327416d79411ea96191cb72cde3f7f'
    >>> short_id = B64UUID(uid).string
    >>> short_id
    'lTJ0FteUEeqWGRy3LN4_fw'
    >>> B64UUID(short_id).uuid.hex
    '95327416d79411ea96191cb72cde3f7f
    



CONTRIBUTING

(TODO: ...)


Changelog

v0.1

  • Date: 2020-08-06

AUTHORS

Metadata

Release files for b64uuid 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for b64uuid 0.1
File Size Uploaded Provenance
b64uuid-0.1.tar.gz 25.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 41.7 kB

Release files / b64uuid-0.1.tar.gz

Download URL b64uuid-0.1.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0f44ddfb3224b9e857320ffde2a47be10d39739f89fcae9cf945a5ec9ffa8acc
BLAKE2b-256 checksum
How to use checksums
8c089180a9b8fdbab11e9528e008132cdb7becaed2bd7d5d01493baecbe707ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / b64uuid-0.1-py3-none-any.whl

Download URL b64uuid-0.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c382a10f739c4eef396c5f16f834e4134905785ed58b55726b64ffe0084a8cb0
BLAKE2b-256 checksum
How to use checksums
5afa1bfa8187ce7d519462a3853e2453d37ca6ced50e668e996b1aebc2e8e5f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for b64uuid 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

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