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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file alphanum_code-0.1.1.tar.gz.

File metadata

  • Download URL: alphanum_code-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for alphanum_code-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76ff578b3de3a7eee7f4ca2fe10b734be9348e9edfbd739fe680168e79794826
MD5 f336decdfe44f32f78e638754c592432
BLAKE2b-256 200b395cd7b1285a8b7858f5b2b81fceded2e4d40dd3f6b08d918aa218950505

See more details on using hashes here.

File details

Details for the file alphanum_code-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: alphanum_code-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for alphanum_code-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3fa4cfe36a6da6e494dd5b36d02334628b02ab6c4651e0b4b146ece2062cc0
MD5 d94b286e361b90c67bb3f02da32800a0
BLAKE2b-256 83fb02938f6a69b8582d524aed85a37ddc0448d4415e3346d5cf1d37385a71d2

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