cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-93343: Expand warning filter examples

Open daniel-shimon opened this issue 2 years ago • 10 comments

Add examples of warning filters and the difference between programatic and environmental filters.

  • Issue: gh-93343

:books: Documentation preview :books:: https://cpython-previews--106618.org.readthedocs.build/

daniel-shimon avatar Jul 11 '23 08:07 daniel-shimon

All commit authors signed the Contributor License Agreement.
CLA signed

ghost avatar Jul 11 '23 08:07 ghost

Hi @ezio-melotti, thanks for the fast review! I moved the examples to a separate section and elaborated a bit on the explanations.

Where/when can I uses regexes vs plain text? This applies to both different types of filters (filterwarnings()/-W/PYTHONWARNINGS) and different fields within a filter (message/package/module). How to match part of a message with the different types of filters (beginning of the message vs substring).

I've linked to the warning filter definitions since I think they explain this concisely and don't think we need to add another section repeating the same info. What do you think?

daniel-shimon avatar Jul 12 '23 14:07 daniel-shimon

FYI, @daniel-shimon: please don't force push; it does not play well with the GitHub UI, and especially not with review remarks and CI. You can use git pull --no-ff main instead. See also https://devguide.python.org/getting-started/pull-request-lifecycle/

erlend-aasland avatar Jul 12 '23 20:07 erlend-aasland

Oh, it seems like none of the example code in Doc/library/warnings.rst is checked by doctest :( That is unfortunate! I don't remember the doctest specifics, but if it is possible, please make is so that at least the added examples are run through doctest. If not, adding doctests to this .rst file is out of scope for this PR, but it should be done.

erlend-aasland avatar Jul 12 '23 20:07 erlend-aasland

@erlend-aasland so actually this was because I amended the commit, cause I thought it was weird to have "pr fixes" in the main Python repo after accepting the pr. So should I add new commits and squash before merge? What is the practice here?

daniel-shimon avatar Jul 12 '23 23:07 daniel-shimon

So should I add new commits and squash before merge? What is the practice here?

You don't need squash, core devs will add squash commit message for you after this PR is accepted. Just remember not to modify commits that has been pushed to fork after creating the PR, everything else is OK :)

CharlieZhao95 avatar Jul 13 '23 07:07 CharlieZhao95

So should I add new commits and squash before merge? What is the practice here?

I provided a link to the Life of a Pull Request page in the devguide in my previous comment. The practice is described there:

The commits will be squashed when the pull request is merged.

IOW, you don't need to squash or rebase; a core dev will squash and write the final commit message when landing the PR.

erlend-aasland avatar Jul 13 '23 08:07 erlend-aasland

Ok I see and understand that now, thanks guys 🙌

daniel-shimon avatar Jul 14 '23 10:07 daniel-shimon

Ok I see and understand that now, thanks guys 🙌

np, and thanks for improving the docs! I recommend spending some hours with the devguide; there's a lot of useful information there :) Also, if you find sections in the devguide that are hard to grasp, or just worded badly, don't hesitate to open an issue over at the devguide repo; fixing devguide bugs is one of the most important things we can do :)

erlend-aasland avatar Jul 14 '23 11:07 erlend-aasland

Hello from +1 year! Where are we up to on this PR? It looks like there's still some suggestions for @daniel-shimon to address, would you like update the PR? Thanks!

hugovk avatar Jul 14 '24 08:07 hugovk

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.

bedevere-app[bot] avatar Oct 24 '24 17:10 bedevere-app[bot]

another half year has passed :) I don't know how long it should take after adding pending label, but I suggest waiting the last 2 weeks (another attempt @daniel-shimon)

donbarbos avatar Apr 29 '25 21:04 donbarbos

Hi! Wow somehow I've missed the emails about this PR and was sure it was long forgotten 😅 I'll address the comments in the upcoming days, thanks for the ping!

daniel-shimon avatar Apr 30 '25 14:04 daniel-shimon

Hi @erlend-aasland , I added clarifications regarding escaping and regexes. Could you take a look? Thanks!

daniel-shimon avatar May 07 '25 08:05 daniel-shimon