Metadata-Version: 2.4
Name: digipinpy
Version: 1.4.2
Summary: Official Python implementation of DIGIPIN - India's national geocoding standard by Department of Posts
Author-email: SAMARTHA H V <samarthsmg14@gmail.com>
Maintainer-email: MR SHIVAKUMAR <hmrshivu@gmail.com>
License: MIT License
        
        Copyright (c) 2025 SAMARTHA H V
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/DEADSERPENT/digipinpy
Project-URL: Documentation, https://github.com/DEADSERPENT/digipinpy/blob/main/docs/index.md
Project-URL: Repository, https://github.com/DEADSERPENT/digipinpy
Project-URL: Issue Tracker, https://github.com/DEADSERPENT/digipinpy/issues
Project-URL: Source Code, https://github.com/DEADSERPENT/digipinpy
Project-URL: Changelog, https://github.com/DEADSERPENT/digipinpy/blob/main/CHANGELOG.md
Project-URL: Bug Reports, https://github.com/DEADSERPENT/digipinpy/issues/new?template=bug_report.md
Project-URL: Feature Requests, https://github.com/DEADSERPENT/digipinpy/issues/new?template=feature_request.md
Keywords: digipin,geocoding,geolocation,india,gis,addressing,postal,location,coordinates,government,department-of-posts
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: flake8>=5.0; extra == "dev"
Requires-Dist: mypy>=0.990; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov>=4.0; extra == "test"
Provides-Extra: pandas
Requires-Dist: pandas>=1.3.0; extra == "pandas"
Requires-Dist: numpy>=1.21.0; extra == "pandas"
Provides-Extra: django
Requires-Dist: django>=3.2; extra == "django"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.68.0; extra == "fastapi"
Requires-Dist: pydantic>=1.8.0; extra == "fastapi"
Requires-Dist: uvicorn>=0.15.0; extra == "fastapi"
Provides-Extra: geo
Requires-Dist: shapely>=2.0.0; extra == "geo"
Dynamic: license-file

<div align="center">

# 🇮🇳 DIGIPIN-Py

**Official Python implementation of India's national geocoding standard**

[![PyPI version](https://img.shields.io/pypi/v/digipinpy.svg?color=blue)](https://pypi.org/project/digipinpy/)
[![Python Version](https://img.shields.io/pypi/pyversions/digipinpy.svg)](https://pypi.org/project/digipinpy/)
[![License](https://img.shields.io/pypi/l/digipinpy.svg)](https://github.com/DEADSERPENT/digipinpy/blob/main/LICENSE)
[![Tests](https://github.com/DEADSERPENT/digipinpy/workflows/Tests/badge.svg)](https://github.com/DEADSERPENT/digipinpy/actions)
[![codecov](https://codecov.io/github/DEADSERPENT/digipinpy/graph/badge.svg?token=G8NZBWAWPY)](https://codecov.io/github/DEADSERPENT/digipinpy)
[![Downloads](https://static.pepy.tech/badge/digipinpy)](https://pepy.tech/project/digipinpy)

[Documentation](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/index.md) •
[API Reference](https://github.com/DEADSERPENT/digipinpy/blob/main/DOCUMENTATION.md) •
[Getting Started](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/getting-started.md) •
[Contributing](CONTRIBUTING.md) •
[Changelog](CHANGELOG.md)

</div>

---

## What is DIGIPIN?

**DIGIPIN** (Digital Postal Index Number) is India's national geocoding system developed by the **Department of Posts, Ministry of Communications, Government of India**. It divides the entire country into a hierarchical grid, assigning a unique code to every ~4m × 4m location.

**digipinpy** is a high-performance, zero-dependency Python library implementing the official specification with 100% compliance.

### Key Features

- 🎯 **Pinpoint Accuracy** - ~3.8m precision at level 10
- 🗺️ **Hierarchical Grid** - Variable precision from 1000km down to 4m
- 📦 **Zero Dependencies** - Pure Python core, optional framework integrations
- ⚡ **High Performance** - ~50,000 encodes/second
- 🔌 **Framework Ready** - Native Pandas, Django, FastAPI & geospatial support

---

## Installation

```bash
pip install digipinpy
```

**Optional integrations:**

```bash
pip install digipinpy[pandas]    # Data science with Pandas
pip install digipinpy[django]    # Django database field
pip install digipinpy[fastapi]   # FastAPI microservices
pip install digipinpy[geo]       # Geospatial polyfill
```

---

## Quick Start

### Basic Usage

```python
from digipin import encode, decode

# Encode coordinates to DIGIPIN
code = encode(28.622788, 77.213033)  # Dak Bhawan, New Delhi
print(code)  # '39J49LL8T4'

# Decode back to coordinates
lat, lon = decode('39J49LL8T4')
print(f"{lat:.6f}, {lon:.6f}")  # 28.622788, 77.213033
```

### Variable Precision

```python
# Encode with different precision levels
code_full = encode(28.622788, 77.213033, precision=10)  # ~3.8m
code_city = encode(28.622788, 77.213033, precision=5)   # ~1km
code_region = encode(28.622788, 77.213033, precision=3) # ~16km
```

### Proximity Search

```python
from digipin import get_neighbors, get_disk

# Get 8 immediate neighbors
neighbors = get_neighbors('39J49LL8T4')

# Get all cells within radius 3
search_area = get_disk('39J49LL8T4', radius=3)
```

---

## Documentation

### 📚 User Guides
- [Getting Started](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/getting-started.md) - Installation and first steps
- [API Reference](https://github.com/DEADSERPENT/digipinpy/blob/main/DOCUMENTATION.md) - Complete function reference
- [Use Cases](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/use-cases.md) - Real-world examples

### 🔌 Integrations
- [Pandas Integration](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/integrations-pandas.md) - DataFrame operations
- [Django Integration](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/integrations-django.md) - Database field with validation
- [FastAPI Integration](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/integrations-fastapi.md) - REST API microservices
- [Geospatial Polyfill](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/geospatial-polyfill.md) - Polygon-to-codes conversion

### 🛠️ Development
- [Contributing Guide](CONTRIBUTING.md) - How to contribute
- [Changelog](CHANGELOG.md) - Version history
- [Technical Specification](https://github.com/DEADSERPENT/digipinpy/blob/main/docs/technical_spec.md) - Official DIGIPIN spec

---

## Features at a Glance

| Feature | Description |
|---------|-------------|
| **Encoding/Decoding** | Coordinates ↔ DIGIPIN codes |
| **Validation** | Check code validity with `is_valid()` |
| **Batch Operations** | Process arrays efficiently |
| **Proximity Search** | Find neighbors, rings, disks |
| **Hierarchical Ops** | Parent/child relationships |
| **Pandas Integration** | `.digipin` accessor for DataFrames |
| **Django Integration** | `DigipinField()` with auto-validation |
| **FastAPI Integration** | Pre-built REST API router |
| **Geospatial Polyfill** | Convert polygons to code sets |

---

## Project Status

- ✅ **Production Ready** - Version 1.4.2
- ✅ **100% Spec Compliant** - Official DoP specification
- ✅ **163 Tests Passing** - Comprehensive test coverage
- ✅ **Type Hints** - Full type annotation support
- ✅ **Multi-Platform** - Windows, macOS, Linux
- ✅ **Python 3.8-3.13** - Wide version support

---

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

**Quick setup:**

```bash
git clone https://github.com/DEADSERPENT/digipinpy.git
cd digipinpy
pip install -e ".[dev]"
pytest tests/ -v
```

---

## License

MIT License - see [LICENSE](LICENSE) file for details.

---

## Authors & Acknowledgments

**Lead Developer:** SAMARTHA H V
**Maintainer:** MR SHIVAKUMAR

📧 Contact: samarthsmg14@gmail.com, hmrshivu@gmail.com

This implementation is based on the official DIGIPIN specification published by the **Department of Posts, Ministry of Communications, Government of India** (March 2025).

---

## Links

- **PyPI:** https://pypi.org/project/digipinpy/
- **GitHub:** https://github.com/DEADSERPENT/digipinpy
- **Issue Tracker:** https://github.com/DEADSERPENT/digipinpy/issues
- **Discussions:** https://github.com/DEADSERPENT/digipinpy/discussions

---

<div align="center">

**Government of India | Department of Posts | National Addressing Initiative**

</div>
