Skip to main content

A simple and intuitive Python package for generating unique IDs.

Project description

SimpleUID (unique ID) for Python

GitHub releases PyPI release License: MIT

A simple and intuitive Python package for generating unique IDs.

This package helps developers by bringing them some "quality of life" features. Stop rewriting the same piece of code in every project.

Table of Contents
  1. Installation
  2. Usage
  3. Support
  4. Maintainer
  5. Contibruting
  6. License

Installation

Install using PIP

pip install simpleUID

Note that pip refers to the Python 3 package manager. In an environment where Python 2 is also present the correct command may be pip3.

Usage

For a more detailed explaination, visit the documentation.

Import simpleUID:

import simpleUID

Create a random string:

simpleUID.string()

You can specify the string length and a prefix:

simpleUID.string(length=20, prefix='start')

All functions are:

Function Functionality
string Generates a random string.
integer Generates a random integer.
password Generates an alphanumeric password with at least one lowercase character, at least one uppercase character, and at least three digits.
bytes Generates a random byte string.
hex Generates a random byte string.
urlsafe Generates a random byte string.
var Generates a string based on an array of variables.
database Generates a random ID using the string or integer functions, then it checks it's uniqueness against database.

Keep in mind that the prefix for the integer function should be of type int.

Cursor

Currently only SQL cursor objects are supported. If you encounter issues with other cursor objects, please create an issue on GitHub. The cursor argument should be a dictionairy structured like the example below:

#### SQL example
cursor = {
    "cursor": cursor,
    "table": "table_name",
    "column": "column_name"
}

#### MongoDB example
cursor = {
    "cursor": mongo_client["db"],
    "column": "column_name",
    "type": "mongo"
}

Max Length

The default maximum length has been set to 1000. This is to prevent unnecessary use of hardware resources. If for some reason this should be ignored, set ignore_max_length to True.

Support

If you found a problem with the software, please create an issue on GitHub.

Maintainer

This project is maintained by Wibo Kuipers.

Contributing

Your contributions are highly appreciated. Please create a pull request on GitHub. Bigger changes need to be discussed with the development team via the issues section at GitHub first.

License

MIT LICENSE

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

simpleuid-1.1.3.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

simpleUID-1.1.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file simpleuid-1.1.3.tar.gz.

File metadata

  • Download URL: simpleuid-1.1.3.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for simpleuid-1.1.3.tar.gz
Algorithm Hash digest
SHA256 30ef2cafce0feaeddb23351e820b674ffad2f217f4d768d2a1d67c02a8a00831
MD5 83145636e7d8850883c7ced5d7df9eb2
BLAKE2b-256 9ef9c6812c3f34814c43ef3b83ea588104f2a84703772190cceb852c850ee8be

See more details on using hashes here.

File details

Details for the file simpleUID-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: simpleUID-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for simpleUID-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 46d9dce7a4f083708af2d59b33cc54aa3934e83d6605d25dd6a022563af6840c
MD5 2f4435d84ec0e1a2582420e3aa80d315
BLAKE2b-256 b90f4001c6542f79c0617ef1c4bf78e54c0a2f728a3cb3721f98acd4b41f454b

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