Python packaging of the India Post DIGIPIN reference algorithm.
Project description
digipin2
digipin2 is an independent Python package for encoding and decoding DIGIPIN values using the open-source reference algorithm published by India Post.
This repository is a Python packaging and distribution project. It is not the official India Post repository and does not represent India Post. The upstream reference implementation is available at:
What it provides
- Python library API for encoding and decoding
- Command-line interface for quick use from the terminal
- A packaged distribution that can be published to PyPI
Installation
pip install digipin2
Library usage
from digipin2 import decode, encode
code = encode(21.034792, 79.029753)
print(code)
latitude, longitude = decode(code)
print(latitude, longitude)
Expected output:
3PT-9CP-86JL
21.034777 79.029741
CLI usage
Encode coordinates:
digipin2 encode --lat 21.034792 --lon 79.029753
Decode a DIGIPIN:
digipin2 decode 3PT-9CP-86JL
API
encode(latitude, longitude) -> str
Encodes a latitude/longitude pair into a formatted DIGIPIN string.
decode(digipin) -> tuple[float, float]
Decodes a DIGIPIN into the center point of its resolved grid cell.
Coordinate bounds
The reference implementation only accepts coordinates inside these bounds:
- Latitude:
2.5to38.5 - Longitude:
63.5to99.5
Attribution
This package is based on the DIGIPIN reference algorithm published by India Post. It is maintained separately as a Python distribution so the algorithm can be installed with pip.
Development
python -m venv .venv
.venv\Scripts\activate
pip install -e .[test]
pytest
python -m build
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file digipin2-0.1.0.tar.gz.
File metadata
- Download URL: digipin2-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ecca0581f9adcc755772c80ee06950cf37629c862e65fc7e829985dce5d74f
|
|
| MD5 |
eec2ae013f93900bd49438c7b30e113a
|
|
| BLAKE2b-256 |
3e23e86e56116ef0e8625526b84736fd6a105705a7369aa961149774a2b08736
|
File details
Details for the file digipin2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: digipin2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98be797f7979f7beb4a1a80ffd439141d52dfff181a9ae4c0aa864163273c7db
|
|
| MD5 |
b4b7489208089db9fd2424f4645d2a61
|
|
| BLAKE2b-256 |
bd6c2ea3336c3a121cfc841af74b9478185259e24b49bd25b4de6598f229bf4d
|