Metadata-Version: 2.4
Name: countryiso
Version: 0.1.0
Summary: A country code library with Chinese names based on ISO 3166
Author-email: Hans <onebear599@gmail.com>
License: MIT
Keywords: country,iso,china,mapping,geo
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Provides-Extra: dev
Requires-Dist: pandas; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

🔘 [English](README.md) | 🔘 [中文](README.zh-CN.md)

# Background
In daily work, we often need to convert data exported from databases into business-friendly data for business teams.
Backend data usually only contains country codes, while business users prefer to see country names.

# Introduction
A Python library for ISO 3166 country code lookup with Chinese names, supporting CRUD operations.

## Features
- ISO 3166-1 standard country codes
- Chinese country names
- Full CRUD support
- Lookup by alpha2, alpha3, numeric code, or Chinese name
- Lightweight, no external dependencies

## Installation
```bash
pip install countryiso
```

## Usage
### Look up
```py
import countryiso

 Look up country
country = countryiso.countries.get(alpha2="CN")
print(country.chinese_name)    # 中国
print(country.alpha3)          # CHN
print(country.numeric)         # 156
print(country.name)            # China
print(country.official_name)   # People's Republic of China
print(country.flag)            # 🇨🇳
```

## CRUD Example
```py

from countryiso import Country

# Add
new_country = Country(
    alpha_2="XX",
    alpha_3="XXX",
    name="Test Country",
    chinese_name="测试国家",
    numeric="999",
    flag="🇽🇽"
)
countryiso.countries.add(new_country)

# Update
updated = countryiso.countries.update(new_country, chinese_name="测试国")

# Remove
countryiso.countries.remove(updated)

```
