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
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file computer_languages-1.0.4.tar.gz.
File metadata
- Download URL: computer_languages-1.0.4.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbf9b058d98371c3cb73682ec16c9de5df65479d822954c5722b328a6cd72c10
|
|
| MD5 |
c174666d5d4d2539f15e948a52b875ad
|
|
| BLAKE2b-256 |
34a34f09ed97b509ace63ac5cc870e2f1be0a52ce007d58a615de0a1ba83fbb8
|
File details
Details for the file computer_languages-1.0.4-py2.py3-none-any.whl.
File metadata
- Download URL: computer_languages-1.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
925f91fee13a68587624e45c21ebc58d128ca94bd86e2f81b32f289d02c3a143
|
|
| MD5 |
7fd2e9c00d6d10351cb0e3cc519be0fa
|
|
| BLAKE2b-256 |
afde09b9cea602186a9c61690ecb2c15ae50535bf7602349de1b2dc13fade8d5
|