Skip to main content

Python library for ISO 639 standard

Project description


master development downloads/month latest version gh forks gh stars


GNU Affero General Public License version 3 (AGPLv3)


  • ISO 639-1
  • ISO 639-2
  • ISO 639-3
  • ISO 639-5

Breaking changes

  • 0.4.4: retired has been changed to { ‘code’: (datetime, [_Language, …], ‘description’) }.
  • 0.4.0: alpha3 has been renamed to part3. languages.alpha3 might be used as an aggregation of all ‘three letter codes’ in the future.


This library is aimed to be fully compatible with pycountry.languages v1.11 and before. In v1.12 they broke their own API and this library will not support the new API.

It provides the following attribute abstractions:

  • terminology -> part2t
  • bibliographic -> part2b
  • alpha2 -> part1

If you have no intentions on using pycountry.languages or want/need to keep compatibility then please use the partX attributes for brevity and clarity.


As taken from pycountry.languages v1.11 documentation, with modifications and further additions.

>>> from iso639 import languages
>>> from pprint import pprint

>>> len(languages)

>>> type(list(languages)[0])
<class 'iso639.iso639._Language'>

# Compatibility
>>> aragonese = languages.get(alpha2='an')
>>> aragonese.alpha2
>>> aragonese.bibliographic
>>> aragonese.terminology

>>> bengali = languages.get(alpha2='bn')

# We *do not* deviate from the standard
>>> try:
...     bengali.common_name
... except AttributeError as e:
...     print(e)
'_Language' object has no attribute 'common_name'

# New API
>>> aragonese = languages.get(part1='an')
>>> aragonese.part1
>>> aragonese.part2b
>>> aragonese.part2t
>>> aragonese.part3
>>> aragonese.inverted
>>> pprint(vars(aragonese))
{'inverted': 'Aragonese',
 'macro': '',
 'name': 'Aragonese',
 'names': [],
 'part1': 'an',
 'part2b': 'arg',
 'part2t': 'arg',
 'part3': 'arg',
 'part5': ''}
 >>> sanapana = languages.get(retired='sap')
 >>> [type(elem).__name__ for elem in sanapana]
 ['datetime', 'list', 'str']
 >>> [lang.part3 for lang in sanapana[1]]
 ['spn', 'aqt']

Contains external data

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iso-639-0.4.5.tar.gz (167.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page