Pre-release
This release is a pre-release and may not be stable for production use.
noid Python Package
Installation
Install from PyPI with
pip install noid
or from source with
pip install git+git@github.com:paulkorir/noid.git # SSH
pip install git+https://github.com/paulkorir/noid.git # HTTPS
CLI Usage
Generating a noid
Use the noid command with no arguments:
noid
There are various options available using -h/--help:
noid -h
usage: noid [-h] [-c CONFIG_FILE] [-v] [-s SCHEME] [-N NAA] [-t TEMPLATE] [-n INDEX] [--verbose] [noid]
generate nice and opaque identifiers (noids)
positional arguments:
noid a noid
optional arguments:
-h, --help show this help message and exit
-c CONFIG_FILE, --config-file CONFIG_FILE
path to a config file with a noid section
-v, --validate validate the given noid [default: False]
-s SCHEME, --scheme SCHEME
the noid scheme [default: 'ark:/']
-N NAA, --naa NAA the name assigning authority (NAA) number [default: ]
-t TEMPLATE, --template TEMPLATE
the template by which to generate noids [default: 'zeeddk']
-n INDEX, --index INDEX
a number for which to generate a valid noid [default: random positive integer]
--verbose turn on verbose text [default: False]
Validating a noid
Validate a noid using the -v/--validate flag and pass a noid.
noid -v $(noid) # self-validation
Options
Specify the NAA
Use the -N/--naa option.
noid --naa 1234
Specify the scheme
Use the -s/--scheme option.
noid --scheme darpa::
Specify a template
Use the -t/--template option.
noid -t zeeddeedeedk
Compute a noid for a value
Use the -n/--index option.
noid -n 42
API Usage
You can also use this package's API in your code.
import random
from noid import mint, validate, calculate_check_digit, generate_noid
# with default arguments
noid = mint()
# arguments: template, n, scheme, naa
noid = mint(template='zeedeeedk', n=37, scheme='https://', naa='802938')
# validating a noid
validate(noid) # True/False
# calculate the check digit
calculate_check_digit(noid)
# low-level generate a noid from a mask and number; no check digit is appended
noid = generate_noid('eeddeed', random.randint(100, 1000))
Testing
pip install -r requirements.txt
tox
Authors
- Paul K. Korir - EMBL-EBI (current implementation)
- Original source code was by:
See also the list of contributors who participated in this project.
Thanks
This tool was heavily influenced from noid-mint
Release files for noid 1.0.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| noid-1.0.0a3.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| noid-1.0.0a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / noid-1.0.0a3.tar.gz
| Download URL | noid-1.0.0a3.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a1e0868ec11f1bb888106d55166677060bceee3e792aeeef0f4cb5e23aadc3b
|
|
BLAKE2b-256 checksum How to use checksums |
408bd3e54fb9ca06c4acd395281b3266f4f6c2e8f05e29d6840f69951d21c3cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0
|
Release files / noid-1.0.0a3-py3-none-any.whl
| Download URL | noid-1.0.0a3-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a9ef26c3aa8a069def6a718892c4ab8d13a27cff0eedf59924fa38efda03ef1
|
|
BLAKE2b-256 checksum How to use checksums |
10bf7507b124e8fa850abe449770c6c716ecd6f01c31e6382a1236ebbe410a79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0
|