Skip to main content

> prose-languages

File extensions for prose languages.

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

Installation

pip install prose-languages

Usage

import prose_languages

md_lang_data = prose_languages['Markdown']

print(md_lang_data['extensions']) # => ['.livemd', '.markdown', '.md', ...]

Note: Most type checkers will falsely warn prose_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 prose_languages.items():
        if file_ext in data['extensions']:
            return lang

print(get_lang('.gmi')) # => Gemini

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 prose_languages.items():
        if file_ext in data['extensions']:
            return lang

print(get_lang_from_path('document.adoc')) # => AsciiDoc
print(get_lang_from_path('README.md')) # => Markdown
print(get_lang_from_path('index.mdx')) # => None (use markup-languages pkg)

MIT License

Copyright © 2026 Adam Lui

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

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

Metadata

Release files for prose-languages 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prose-languages 1.0.3
File Size Uploaded
prose_languages-1.0.3.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prose-languages 1.0.3
File Interpreter ABI Platform
prose_languages-1.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.8 kB

Release files / prose_languages-1.0.3.tar.gz

Download URL prose_languages-1.0.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b9c40ea122701719bafce9a72201ed88908b9102f5731e63776a5ea24193e28
BLAKE2b-256 checksum
How to use checksums
af261c84d0833c873073bad56590126da3803e726e3da957dac7984f38a941b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / prose_languages-1.0.3-py2.py3-none-any.whl

Download URL prose_languages-1.0.3-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
617f6707dae611b7035db523abb8e8862b7e41233d5e0026717605bfb17b998f
BLAKE2b-256 checksum
How to use checksums
101c002cfadfab402459bba9d384b1c0c7665681b95dcebf8a490cde9dd97a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page