Labels
pendingThe issue will be closed if no feedback is providedstdlibPython modules in the Lib dirtype-featureA feature request or enhancement

Comments

@RokeJulianLockhart

Documentation

The current (unregistered) IANA Media Type types for Python (text\/x-python.*):

  1. ``text/x-python`` instead of ``text/plain``.

    1

  2. <Extension Id="py" ContentType="text/x-python">

    2

  3. '.pyc' : 'application/x-python-code',
    '.pyo' : 'application/x-python-code',

    3

...appear to be incorrect, per current guidance, for RFC 6838 states that the x- prefix has been deprecated in favour of the x. tree: 4

The unregistered tree includes media types intended exclusively for use in private environments and only with the active agreement of the parties exchanging them. It uses the x. tree prefix. Examples are application/x.foo, video/x.bar. Media types in this tree cannot be registered.

This type was originally defined in RFC 1590 (published in September 1993) using the x- or X- prefix. RFC 2048 (published in November 1996) introduced the x. prefix, but discouraged use of the unregistered tree, as new personal and vendor trees with relaxed registration requirements are now available. The current RFC 6838 (published in January 2013) maintains the same recommendation, but subtypes prefixed with x- or X- are no longer considered to be members of this tree.

Media types that have been widely deployed (with a subtype prefixed with x- or X-) without being registered, should be, if possible, re-registered with a proper prefixed subtype.

Footnotes

  1. 49d72365cd2d6c09a154a9a061efef4130e2c758/Misc/NEWS.d/3.10.0a1.rst?plain=1#L3030C1-L3030C44

  2. 49d72365cd2d6c09a154a9a061efef4130e2c758/Tools/msi/launcher/launcher_reg.wxs#L9C32-L9C67

  3. 49d72365cd2d6c09a154a9a061efef4130e2c758/Lib/mimetypes.py#L540C9-L541C48

  4. en.wikipedia.org/w/index.php?title=Media_type&oldid=1292890008#Unregistered_tree 5

  5. serialseb..com/issues/24#issue-3136552984

@RokeJulianLockhartRokeJulianLockhart added the docsDocumentation in the Doc dirlabel Jun 11, 2025
@github-project-automation-project-automation bot moved this to Todo in docs issues Jun 11, 2025
@picnixz

I don't think we should change mimetypes.py. Even if it's deprecated, it's still common practice and I think "practicality beats purity" here.

Now, using x. means that we're using the "unregistered tree" and it's still discouraged:

RFC 2048 (published in November 1996) introduced the x. prefix, but discouraged use of the unregistered tree, as new personal and vendor trees with relaxed registration requirements are now available. The current RFC 6838 (published in January 2013) maintains the same recommendation

I would be for the status quo in this case. Strictly speaking, we can use x-* Mime types even though they don't belong to the unrgistered tree. Note that there are some x-* in the official Media Types (look for /x- in https://www.iana.org/assignments/media-types/media-types.xhtml).

@picnixzpicnixz added type-featureA feature request or enhancementstdlibPython modules in the Lib dirpendingThe issue will be closed if no feedback is providedand removed docsDocumentation in the Doc dirtopic-email labels Jun 13, 2025
@picnixzpicnixz changed the title The Python IANA Media Types require modifications to adhere to recent RFCs. Align .py[co] IANA Media Types with RFC6838 Jun 13, 2025
@picnixzpicnixz removed this from docs issues Jun 13, 2025
Sign up for free to join this conversation on . Already have an account? Sign in to comment
pendingThe issue will be closed if no feedback is providedstdlibPython modules in the Lib dirtype-featureA feature request or enhancement
None yet

No branches or pull requests