Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alphanum_code-0.1.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

alphanum_code-0.1.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

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