Skip to main content

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.5 to 38.5
  • Longitude: 63.5 to 99.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

Metadata

Release files for digipin2 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digipin2 0.1.0
File Size Uploaded Provenance Actions
digipin2-0.1.0.tar.gz 4.0 kB Without provenance Details for digipin2-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for digipin2 0.1.0
File Interpreter ABI Platform Actions
digipin2-0.1.0-py3-none-any.whl Python 3 none any Details for digipin2-0.1.0-py3-none-any.whl

Total release size: 9.2 kB

Release files / digipin2-0.1.0.tar.gz

Download URL digipin2-0.1.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
40ecca0581f9adcc755772c80ee06950cf37629c862e65fc7e829985dce5d74f
BLAKE2b-256 checksum
How to use checksums
3e23e86e56116ef0e8625526b84736fd6a105705a7369aa961149774a2b08736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / digipin2-0.1.0-py3-none-any.whl

Download URL digipin2-0.1.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98be797f7979f7beb4a1a80ffd439141d52dfff181a9ae4c0aa864163273c7db
BLAKE2b-256 checksum
How to use checksums
bd6c2ea3336c3a121cfc841af74b9478185259e24b49bd25b4de6598f229bf4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for digipin2 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page