A simple and intuitive Python package for generating unique IDs.
Project description
simpleUID (unique ID) for Python
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.
Installation
Install using PIP
pip install simpleUID
Note the pip
refers to the Python 3 package manager. In environment where Python 2 is also available the correct command may be pip3
.
Usage
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 will will take the arguments length
and prefix
, existing functions are:
Function | Args(with default) | Returns |
---|---|---|
string | length=6, prefix | 6 character long string |
integer | length=6, prefix | 6 character long integer |
password | length=8, prefix | 10 character alphanumeric password with at least one lowercase character, at least one uppercase character, and at least three digits |
database | cursor:dictionairy, method="string", length=6, prefix | 6 character long string excl. prefix |
Keep in mind that the prefix for the integer
function should be of type int
.
Cursor
Currently only the mysql-connector cursor object has been tested to work with this package. 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:
cursor = {
"cursor": cursor, ## Currently only tested with MYSQL
"table": "table_name",
"column": "column_name"
}
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for simpleUID-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89bd55ed2c0b0d8816ace4a8e127f0622fc5bf85f8b423fa1d4c81b863cf65f8 |
|
MD5 | 07b20b6dee8ccdd3c159c9d7c1fd42e6 |
|
BLAKE2b-256 | 21e42f56f6cc9c8734453d746c0f32b8a6cbf56f647cd551e09a82246f99f1cb |