Skip to main content

💻 computer-languages

File extensions for computer languages.

It's just a JSON file, so you can use it in any environment. Sourced from GitHub's Linguist project (defines all 700+ languages known to GitHub). Data is updated via script and released via new package version.

Installation

pip install computer-languages

Usage

import computer_languages

py_lang_data = computer_languages['Python']

print(py_lang_data['type']) # => programming
print(py_lang_data['extensions']) # => ['.cgi', '.fcgi', '.gyp', ...]

Note: Most type checkers will falsely warn computer_languages is not subscriptable because they are incapable of analyzing runtime behavior (where the module is replaced w/ a dictionary for cleaner, direct access). You can safely suppress such warnings using # type: ignore.


Examples

Get extension(s) for a language:

js_exts = computer_languages['JavaScript']['extensions']

print(js_exts) # => ['._js', '.bones', '.cjs', '.es', ...]

Get language(s) from an extension:

def get_lang(file_ext):
    lang_matches = [
        lang for lang, data in computer_languages.items()
            if file_ext in data['extensions']
    ]
    return lang_matches[0] if len(lang_matches) == 1 else lang_matches

print(get_lang('.rs')) # => ['RenderScript', 'Rust', 'XML']

Filter by language type:

markup_langs = [
    lang for lang, data in computer_languages.items()
        if data['type'] == 'markup'
]

print(markup_langs) # => ['Antlers', 'API Blueprint', 'Astro', 'BibTeX', ...]
print(f'{len(markup_langs)} markup languages') # -> 69 markup languages

MIT License

Copyright © 2026 Adam Lui


Related

</> markup-languages - File extensions for markup languages.
## prose-languages - File extensions for prose languages.
{ } data-languages - File extensions for data languages.
#! programming-languages - File extensions for programming languages.

More Python utilities / Discuss / Report bug / Report vulnerability / Back to top ↑

Download files

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

Source Distribution

computer_languages-1.1.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

computer_languages-1.1.0-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file computer_languages-1.1.0.tar.gz.

File metadata

  • Download URL: computer_languages-1.1.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for computer_languages-1.1.0.tar.gz
Algorithm Hash digest
SHA256 783bc643e91c085c069a9ddf7fef12f120d2e7f7d8832d14cf104a63ebf8de8a
MD5 4b74520f30f39ace11a9b587d50aaf8c
BLAKE2b-256 4b1759b1614cfcb007016e9d9c2218f2addb35b3387849071961ed292a0caf28

See more details on using hashes here.

Provenance

The following attestation bundles were made for computer_languages-1.1.0.tar.gz:

Publisher: publish-to-pypi-on-new-tag.yml on adamlui/python-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file computer_languages-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for computer_languages-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 847a0212a08edcb3c4584562d297971fffff7581517668418f3307b1d8c6e32a
MD5 b5ec9abea9ff315475bc8856d1d64afb
BLAKE2b-256 1bf31a21b2aeaa45d70def6b8208c3cd263d6808a9a04e1db0594b38b98d3b93

See more details on using hashes here.

Provenance

The following attestation bundles were made for computer_languages-1.1.0-py2.py3-none-any.whl:

Publisher: publish-to-pypi-on-new-tag.yml on adamlui/python-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page