Registry / data / isocodes

isocodes

JSON →
library2025.8.25pypypi✓ verified 80d ago

isocodes provides lists of various ISO standards (e.g., country, language, language scripts, and currency names) in one place. Current version 2025.8.25, updated regularly with new releases.

pip install isocodes
INSTALL
IMPORT
SIG · ISOCODES
I
isocodes
datapythonv2025.8.25
Install
2.1s avg
Import
Disk
57MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2025.8.25 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 58.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.000s · 59MB
57MB installed
● package 57MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Countries
from isocodes import Countries
from isocodes import IsoCodes
Languages
from isocodes import Languages
from isocodes import IsoCodes
Currencies
from isocodes import Currencies
from isocodes import IsoCodes

Create an IsoCodes instance and iterate over countries to access attributes like name, alpha_2, and numeric.

from isocodes import IsoCodes codes = IsoCodes() for country in codes.countries: if country.name == 'United States': print('Alpha-2:', country.alpha_2, ', Numeric:', country.numeric)
Debug
Known issues
gotchaData fields (e.g., 'name', 'alpha_2') are stored as lists of objects, not dictionaries. Access via attribute (e.g., country.name) not via 'get'.
fix
Use dot notation: e.g., country.name, not country.get('name').
affects: all
deprecatedDirect import of JSON data paths is deprecated. Use IsoCodes class to access data programmatically.
fix
Use the IsoCodes class instead of accessing data files via pkg_resources or importlib_resources directly.
affects: >=2025
gotchaThe 'countries' attribute returns all countries including those that are not ISO 3166-1? Actually it's the full list; ensure you filter by 'alpha_2' if needed.
fix
Filter as needed: e.g., [c for c in codes.countries if c.alpha_2 == 'US'].
affects: all
Upgrade
Version history
2025.8.25latest on PyPI · released Aug 25, 2025
Audit
Dependencies
importlib-resourcesrequiredRequired for accessing JSON data files in Python 3.9+ (standard library since 3.9, but sometimes needed as backport).
Agent activity
6 hits · last 30 days
node
6
Resources
isocodes — pip install isocodes · libregistry