> programming-languages
File extensions for programming languages.
It's just a JSON file, so you can use it in any environment. Sourced from GitHub's Linguist project (defines all 500+ programming languages known to GitHub). Data is updated via script and released via new package version.
Installation
pip install programming-languages
Usage
import programming_languages
py_lang_data = programming_languages['Python']
print(py_lang_data['extensions']) # => ['.cgi', '.fcgi', '.gyp', ...]
Note: Most type checkers will falsely warn programming_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 language from an extension:
def get_lang(file_ext):
for lang, data in programming_languages.items():
if file_ext in data['extensions']:
return lang
print(get_lang('.al')) # => AL
Get language from a file path:
def get_lang_from_path(filepath):
from pathlib import Path
file_ext = Path(filepath).suffix
for lang, data in programming_languages.items():
if file_ext in data['extensions']:
return lang
print(get_lang_from_path('main.rs')) # => Rust
print(get_lang_from_path('script.kt')) # => Kotlin
print(get_lang_from_path('data.avsc')) # => None (use data-languages pkg)
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.
Metadata
Release files for programming-languages 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| programming_languages-2.0.3.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| programming_languages-2.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 24.8 kB
Release files / programming_languages-2.0.3.tar.gz
| Download URL | programming_languages-2.0.3.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2a88b3936b86cc31c2697b636af1a5462565d5a35543f9d220fd5b714898d66
|
|
BLAKE2b-256 checksum How to use checksums |
1e7e60f89668a890aaad41b3c7c23fafdb5ef23cda26d891871706646b26c092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / programming_languages-2.0.3-py2.py3-none-any.whl
| Download URL | programming_languages-2.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7c07b7fb310e2282035c87efa5ac6b2dd9423d36e9ba9663611bb1e7a52e2d2e
|
|
BLAKE2b-256 checksum How to use checksums |
d9755f1d77fa929a2c41bf2808c1b4a1f79e5829d14c4c0cf7f711e7c9e01aae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|