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

gh-121658: Add MimeTypes.add_type docs #121665

Closed
wants to merge 2 commits into from
Closed

Conversation

stinovlas
Copy link
Contributor

@stinovlas stinovlas commented Jul 13, 2024

Closes #121658.

Add missing MimeTypes.add_type documentation.


📚 Documentation preview 📚: https://cpython-previews--121665.org.readthedocs.build/

@stinovlas stinovlas requested a review from a team as a code owner July 13, 2024 09:28
Copy link

cpython-cla-bot bot commented Jul 13, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link
Member

@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Eclips4 Eclips4 added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jul 13, 2024
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you include a versionadded note?

A

@bedevere-app
Copy link

bedevere-app bot commented Aug 14, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be put in the comfy chair!

@Eclips4
Copy link
Member

Eclips4 commented Aug 14, 2024

Please could you include a versionadded note?

A

This was added more than 22 years ago. Do you think it's still need a versionadded note?

@AA-Turner
Copy link
Member

AA-Turner commented Aug 14, 2024

Yes, because the documentation is new. The only other way to compare in documentation is to look at older versions (e.g. https://docs.python.org/3.10/), which don't list the method.

However, if the method was present when mimetypes was added to the stdlib, I probably wouldn't add a note.

A

@stinovlas
Copy link
Contributor Author

Yes, because the documentation is new. The only other way to compare in documentation is to look at older versions (e.g. https://docs.python.org/3.10/), which don't list the method.

However, if the method was present when mimetypes was added to the stdlib, I probably wouldn't add a note.

I digged in the git history and found out that the function has been added in Python 2.3, six years before Python 3.0 came out. Since we only feature documentation for Python 3 nowadays and this has been in Python 3 since the beginning, I don't thing that note is necessary.

But if you insist, I can add a note that this has been added in Python 2.3.

@AA-Turner
Copy link
Member

AA-Turner commented Aug 15, 2024

Since we only feature documentation for Python 3 nowadays and this has been in Python 3 since the beginning, I don't thing that note is necessary.

Python 3 is not divorced from 2; indeed elements of Python 0.9 survive to this day. Note that there are many .. version{added,changed}:: that have 2.x. The mimetypes module has documentation going back to Python 1.6.

I do think it is good practice to note, but we could add these version added/changed markers in a follow-up commit if need be.

A

@hugovk
Copy link
Member

hugovk commented Aug 15, 2024

Note that there are many .. version{added,changed}:: that have 2.x.

Hmm, I only find five: four of which are in "What's New in Python 2.7" (a historical release note), and the only one in the library was recently added in #109020 ;)

rg "version(added|changed):: 2"  Doc
Doc/whatsnew/2.7.rst
2374:  .. versionchanged:: 2.7.13
2589:.. versionadded:: 2.7.15
2779:.. versionadded:: 2.7.14
2792:.. versionchanged:: 2.7.14

Doc/library/calendar.rst
506:.. versionadded:: 2.5

There was some discussion last year about removing old ones: #108514

The current policy is that the Python x (3) manual should have a complete history of feature changes so that one can write and maintain code compatible with any minor x.y (3.y) version.

The discussion was about removing or hiding somewhere between 3.0 and 3.6, so I don't think we need to note additions/changes in 2.x.

@AA-Turner
Copy link
Member

My comeuppance for writing that on the train sans laptop, I suppose! In that case let's not add the note for now.

Personally I do think these notes are very useful, even when historical, as it means that you can have confidence that a function exists in all the versions of Python that you support without needing to double-check. But that can be a separate discussion.

A

@stinovlas
Copy link
Contributor Author

I added a note about this being added in Python 2.3. I guess it can't hurt.

@stinovlas
Copy link
Contributor Author

stinovlas commented Aug 22, 2024

After pushing a version note, it seems that there was some documentation added in #122301 (although quite different from this one), which is not linked in the original issue #121658. So, where do we go from here?

@hugovk
Copy link
Member

hugovk commented Nov 6, 2024

After pushing a version note, it seems that there was some documentation added in #122301 (although quite different from this one), which is not linked in the original issue #121658. So, where do we go from here?

The text already added in #122301 is more detailed, except the .. versionadded:: 2.3 bit which probably isn't very useful in 2024.

Let's close this PR, thank you anyway for your contribution!

@hugovk hugovk closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes docs Documentation in the Doc dir needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

MimeTypes.add_type() is missing from the docs
4 participants