Changelog
This changelog is generated automatically from GitHub Releases.
v0.5.7
2026-06-17 · GitHub
[0.5.7] - 2026-06-17
Added
guess_extension(content_type, with_dot=True)— reverse lookup from a MIME type to its canonical file extension (e.g.application/pdf→.pdf), the inverse of get_content_type(). Case-insensitive, and MIME parameters on aContent-Typeheader are ignored (text/html; charset=utf-8→.html). Common non-canonical / legacy spellings also resolve (e.g.text/json→.json,image/jpg→.jpg,application/x-zip-compressed→.zip). Unknown types returnNone. (#9)guess_all_extensions(content_type, with_dot=True)— returns every known extension for a MIME type, canonical first (e.g.image/jpeg→['.jpg', '.jpeg', '.jpe']); unknown types return[]. Same case-insensitivity, parameter-stripping, and alias handling as guess_extension(). (#9)- Files:
content_types/__init__.py,tests/test_content_types.py,README.md,great-docs.yml,docs/
Changed
- get_content_type() now distinguishes an omitted
fallbackfrom an explicitfallback=None. Passingfallback=NonereturnsNonefor unknown extensions (handy when you want to branch on a miss rather than receive a placeholder type), while omittingfallbackis unchanged and still returnsapplication/octet-stream(ortext/plainwithtreat_as_binary=False) — so existing callers are unaffected. The default keyword switched fromNoneto a private sentinel to tell the two cases apart, and the return type widened toOptional[str]. (#8) - Files:
content_types/__init__.py,tests/test_content_types.py,README.md
v0.4.0
2026-06-11 · GitHub
[0.4.0] - 2026-06-10
Added
fallbackparameter on get_content_type() to override the default MIME type returned for unknown extensions — pass any string and it will be returned in place ofapplication/octet-stream/text/plain(#8)- URL support: get_content_type() now handles query strings and URL fragments
- MIME types for
.sas(text/x-sas) and.sql(application/sql) extensions (#5) - Comprehensive test suite (35 tests) covering integration, spot tests, and negative conditions
- Documentation site built with Great Docs and published at https://mkennedy.codes/docs/content-types/ — auto-generated API reference plus a README-driven landing page. Built locally with
scripts/build_docs.pyand served from the committeddocs/folder (scripts/serve_docs.pypreviews it under the production subpath). - Files:
content_types/__init__.py,tests/test_content_types.py,tests/__init__.py,pytest.ini,great-docs.yml,scripts/build_docs.py,scripts/serve_docs.py,pyproject.toml,docs/
Changed
- get_content_type() now raises
TypeError(instead of a bareException) when called withNone. The message is unchanged, so existingexcept Exceptionhandlers keep working. - Modernized type hints (
dict[str, str],Optional[str]) and rewrote the get_content_type() /cli()docstrings in Google style (Args/Returns/Raises) for a cleaner generated API reference. .yaml,.yml, and.kubeconfignow map toapplication/yaml(RFC 9512, registered 2024) instead of the legacytext/yaml. The content_types.yaml shortcut constant updates to match.- Added the
Typing :: Typedtrove classifier to advertise the existing PEP 561py.typedmarker on PyPI; added a test asserting the marker ships with the package. - Dynamic version metadata: package now pulls
__version__from distribution metadata. - The sdist now contains only the package, change log, readme, and license — previously it bundled every git-tracked file (the built
docs/site,tests/,scripts/, editor config, etc.). Wheels were already minimal. ([tool.hatch.build.targets.sdist]inpyproject.toml) - Files:
content_types/__init__.py,pyproject.toml,README.md,tests/test_content_types.py
Fixed
.ass(Advanced SubStation Alpha subtitles) now maps totext/x-ssa— matching its sibling.ssa— instead of the incorrectaudio/aac..rst(reStructuredText, value unchanged attext/x-rst) moved out of the audio block into the documentation block.- Docstring example for
get_content_type("script.js")now shows'text/javascript'(the actual return value) instead of the outdated'application/javascript' - Files:
content_types/__init__.py
v0.3.0
2025-10-01 · GitHub
Added
- 137 new file extensions across 17 categories, expanding format recognition capabilities
- Comprehensive support for data-science MIME types (e.g.,
application/vnd.pandas,application/x-ipynb+json) - Project now supports 360+ file formats
- Warp Project Summary / Index document for contributors and users
- Files:
content_types/__init__.py,WARP.md
Changed
- Implemented alphabetical sorting of output listings for better navigation
- Enhanced README to highlight 360+ supported file formats
- Improved docstrings throughout codebase for clarity
- Files:
content_types/__init__.py,README.md
Fixed
- Corrected CLI help text instructions for clearer usage guidance
- Adjusted code indentation for better visual consistency
- Files:
content_types/__init__.py
v0.2.3
2025-02-01 · GitHub
- Changes .js back to text/javascript
- Adds a few new types
- Adds comparison to builtin mimetypes
v0.2.2
2025-01-31 · GitHub
Added py.typed file to suppress mypy typing warnings. Thanks @sanders41 Available on PyPI now.
v0.2.1
2025-01-31 · GitHub
Adds many more file extensions as known types.
v0.2.0
2025-01-31 · GitHub
Initial public release.