skillfed

countryinfo

A Python module for returning data about countries, ISO info, and states/provinces within them.

countryinfo v1.0.1 614.7K downloads/30d#5,746 on PyPI161
Permissive license MIT Active released

What it is and what it does

Countryinfo is a lightweight, zero-dependency library that wraps a curated dataset of country metadata and exposes it through a simple object-oriented API. You instantiate a CountryInfo object with a country name, ISO code (alpha-2, alpha-3, or numeric), or alternate spelling, then call methods to retrieve specific attributes: capital, population, area, currencies, languages, calling codes, borders, timezones, GeoJSON geometry, and more. The library also supports reverse queries (all countries, filtered searches) and optional extras for fuzzy matching and Pydantic model integration.

It is designed for applications that need reliable, structured access to country reference data without external API calls or heavy dependencies. Common use cases include form validation, geographic filtering, localization, and data enrichment pipelines. The API is straightforward and the install footprint is minimal, making it suitable for both CLI tools and embedded library use.

Use it for:

  • Validate and normalize country input in web forms or APIs by accepting multiple identifier formats (names, codes, spellings).
  • Build geographic filters or dashboards that need to display country metadata like capital, population, or official languages.
  • Enrich datasets with country-level attributes (currencies, timezones, calling codes) during ETL or data processing workflows.
  • Generate GeoJSON boundaries for mapping applications or spatial analysis without external geospatial libraries.
  • Implement country-aware features such as timezone detection, language selection, or regional grouping in multi-region applications.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Countryinfo provides a Python interface to query comprehensive geographic and administrative data for any country, including ISO codes, capitals, currencies, languages, borders, and GeoJSON boundaries.

Yes. Countryinfo is a stable, well-maintained library with zero dependencies, permissive licensing, and no known vulnerabilities. It fills a genuine need for reliable country metadata lookup. Install it if you need to work with country codes, geographic data, or reference information in a Python application.

Install

countryinfo on PyPI

pip

pip install countryinfo

uv

uv add countryinfo

poetry

poetry add countryinfo

Installing countryinfo

Before you install

Low install friction with no runtime dependencies. Active maintenance since 2018, last commit 2026-06-21, and supports current Python versions (3.11–3.14). No known vulnerabilities.

License in practice

MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install countryinfo

from countryinfo import CountryInfo

country = CountryInfo("Singapore")
print(country.capital())      # Singapore
print(country.iso(2))         # SG
print(country.currencies())   # ['SGD']

Verify before relying

  • Whether the bundled country dataset is kept current with official ISO and geographic standards
  • Performance characteristics when querying large numbers of countries or calling methods repeatedly

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 160 days since the last release
Last repo commit
First released
Downloads 614,728/month — #5,746 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: countryinfo-1.0.1-py3-none-any.whl

Keywords: countryinfo, country, iso, geography

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: GISTopic :: Software Development :: Libraries

Tags

country data lookup libraryISO country codesgeographic country informationcapital cities and currenciescountry borders and neighborscountry language and timezone dataGeoJSON country boundaries
country-dataiso-codesgeographic-reference

More Libraries packages