AlphaNumeric unique consecutive code generator.
Project description
This module generates unique consecutive alphanumeric codes of specified size. A comment can be associated with a code on request.
Requirements
python >= 2.7
SQLAchemy
Package depencies are included in alphanum_code package and will be automatically installed. For more details, see requirements.txt.
Install
Install from PyPI:
pip install alphanum_code
Install from source:
`bash git clone https://github.com/ylaizet/alphanum_code cd alphanum_code pip install -e . `
Usage
>>> from alphanum_code import AlphaNumCodeManager >>> dbname = "sqlite:///test_alphanum.sqlite" >>> manager = AlphaNumCodeManager(dbname) >>> first_code = manager.next_code("with comment") >>> print("my first code:", first_code)
Notes
Alphanumeric order is digits then letters : 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.
Letters in the alphanumeric code are UPPERCASE.
Tips
At manager instanciation, you can set:
code_size to specify the lenght of the code you want to generate each time
init_code to specify the starting point for code generation
Test
Install Pytest
pip install pytest
Run test from base directory
python -m pytest tests/
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 alphanum_code-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce3fa4cfe36a6da6e494dd5b36d02334628b02ab6c4651e0b4b146ece2062cc0 |
|
MD5 | d94b286e361b90c67bb3f02da32800a0 |
|
BLAKE2b-256 | 83fb02938f6a69b8582d524aed85a37ddc0448d4415e3346d5cf1d37385a71d2 |