Skip to main content

File extensions for computer languages.

Project description

⊕ 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

List all extensions for a language:

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

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

Get language from an extension:

def get_lang(file_ext):
    for lang, data in computer_languages.items():
        if file_ext in data['extensions']:
            return lang

print(get_lang('.rs')) # => 'Rust'

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 / Back to top ↑

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

computer_languages-1.0.2.tar.gz (18.3 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.0.2-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: computer_languages-1.0.2.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for computer_languages-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b09836bb08dfe2d4f357c5b0a6ab38f39c9db4058b7ec3dac243c286ead4b7b5
MD5 624bea142d10c28bf62026de45531007
BLAKE2b-256 479568591b9f4f1983cf85ca855a640bf697e6ece5756219ac3d5c707203853a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for computer_languages-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6e9fb2378d0db08494aaa3ff17e02136254fa71e39d7a15959f94af17b7afe24
MD5 86ffb747db8c94a6e2a60e87e2362e2b
BLAKE2b-256 dcca555729dd873a7eddee9b868d58bebc3b210483451ddda81bb12e4e5074f4

See more details on using hashes here.

Supported by

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