Metadata-Version: 2.4
Name: afrogeo
Version: 0.1.0
Summary: Offline-first African location verification for Python.
Author: 404Codes
License: MIT License
        
        Copyright (c) 2026 404 Codes
        
        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.
        
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Dynamic: license-file

# Afrogeo

Offline-first African location verification for Python.

Validate country, state, city, and district (LGA) without an internet connection.

## Installation

```bash
pip install afrogeo
```

## Usage

Afrogeo provides a simple `verify` function that takes a dictionary and returns a `Result` object.

### Basic Example

```python
from afrogeo import verify

data = {
    "country": "Nigeria",
    "state": "Lagos",
    "lga": "Agege"
}

result = verify(data)

if result.valid:
    print(f"Validated: {result.normalized['state']} - {result.normalized['lga']}")
else:
    print(f"Errors: {result.errors}")
```

### Full Validation (including City)

```python
data = {
    "country": "NG",        # Supports codes or full names
    "state": "LA",          # Supports state codes
    "lga": "Agege",
    "city": "Agege"         # Optional
}

result = verify(data)
```

## Features

- **Offline-First**: Uses local JSON data for instant verification.
- **Data Normalization**: Automatically converts codes to full names and vice-versa.
- **Case Insensitive**: Accepts "LAGOS", "lagos", or "Lagos".
- **Dynamic Loading**: Loads only the data for the country you are verifying.

## API Reference

### `verify(user_input: dict) -> Result`

The `user_input` dictionary accepts:
- `country` (Required): Full name or ISO code.
- `state` (Required): Full name or code.
- `lga` (Required): Local Government Area name.
- `city` (Optional): City name.

Returns a `Result` object with:
- `valid`: Boolean.
- `errors`: List of strings (empty if valid).
- `normalized`: Dictionary of standard location names and codes.

## Contributing

Data is stored in `afrogeo/data/`. To add a new country, create a `<country_code>.json` file following the existing structure.
