Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add application/yaml to mimetypes #132054

Open
Kristinita opened this issue Apr 3, 2025 · 1 comment
Open

Add application/yaml to mimetypes #132054

Kristinita opened this issue Apr 3, 2025 · 1 comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Kristinita
Copy link

Kristinita commented Apr 3, 2025

1. Summary

It would be nice if Python will associate popular configuration extensions .yaml and .yml with the application/yaml media type.

2. Behavior

2.1. Current

>>> import mimetypes
>>> mimetypes.guess_file_type("KiraGoddess.yaml")
(None, None)
>>> mimetypes.guess_file_type("KiraGoddess.yml")
(None, None)

2.2. Desired

>>> import mimetypes
>>> mimetypes.guess_file_type("KiraGoddess.yaml")
('application/yaml', None)
>>> mimetypes.guess_file_type("KiraGoddess.yml")
('application/yaml', None)

3. Specifications

Comments in the mimetypes Python module:

cpython/Lib/mimetypes.py

Lines 447 to 449 in ef17252

# Before adding new types, make sure they are either registered with IANA,
# at http://www.iana.org/assignments/media-types
# or extensions, i.e. using the x- prefix

RFC 9512 Abstract:

This document registers the application/yaml media type and the +yaml structured syntax suffix with IANA.

RFC 9512 “Filename Extension” section:

The "yaml" filename extension is the preferred one; it is the most popular and widely used on the web. The "yml" filename extension is still used. The simultaneous usage of two filename extensions in the same context might cause interoperability issues (e.g., when both a "config.yaml" and a "config.yml" are present).

IANA specification for application/yaml.

4. Has this already been discussed elsewhere?

Issue authors in this issue tracker write:

This is a minor feature, which does not need previous discussion elsewhere

Thanks.

Linked PRs

@StanFromIreland
Copy link
Contributor

Just a little tip: If you use the "Feature or Enhancement Proposal" template it will prepopulate the headings and the "Has this been discussed previously" options.

@hugovk hugovk added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Apr 3, 2025
@picnixz picnixz changed the title feature_request(mimetypes): support “application/yaml” media type Add application/yaml to mimetypes Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants