python / cpython

The Python programming language
https://www.python.org
Other
62.7k stars 30.06k forks source link

Add .rst to mimetypes #101137

Open tucked opened 1 year ago

tucked commented 1 year ago
>>> import mimetypes
>>> mimetypes.guess_type("README.rst", strict=False)
(None, None)

In the python:3.11 Docker image, we get a vanity type:

>>> mimetypes.guess_type("README.rst", strict=False)
('text/prs.fallenstein.rst', None)

I think most people would expect text/x-rst. Even better would be to get it registered!

Linked PRs

sobolevn commented 1 year ago

Related: https://github.com/python/cpython/pull/17995

jaraco commented 5 months ago

Given that this type is explicit in packaging specifications, it would be valuable for Python to support inferring it from an extension and avoid hacks like these.

sobolevn commented 5 months ago

I am on it :)