Skip to content

Widen trace_request_ctx type#9398

Merged
Dreamsorcerer merged 4 commits intoaio-libs:masterfrom
layday:chore-widen-trace-request-ctx
Oct 3, 2024
Merged

Widen trace_request_ctx type#9398
Dreamsorcerer merged 4 commits intoaio-libs:masterfrom
layday:chore-widen-trace-request-ctx

Conversation

@layday
Copy link
Copy Markdown
Contributor

@layday layday commented Oct 3, 2024

What do these changes do?

Widen the type of the trace_request_ctx parameter of ClientSession.request and friends.

Are there changes in behavior for the user?

No.

Is it a substantial burden for the maintainers to support this?

No.

Related issue number

Fixes #9397.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

@layday layday requested a review from asvetlov as a code owner October 3, 2024 10:42
@layday layday requested a review from webknjaz as a code owner October 3, 2024 10:44
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 3, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.57%. Comparing base (25b67b6) to head (e4ab73d).
Report is 713 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9398   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files         107      107           
  Lines       35037    35037           
  Branches     4150     4150           
=======================================
  Hits        34536    34536           
  Misses        334      334           
  Partials      167      167           
Flag Coverage Δ
CI-GHA 98.45% <100.00%> (ø)
OS-Linux 98.11% <100.00%> (ø)
OS-Windows 96.53% <ø> (ø)
OS-macOS 97.80% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.67% <100.00%> (ø)
Py-3.10.15 97.60% <100.00%> (ø)
Py-3.11.10 97.67% <100.00%> (ø)
Py-3.11.9 97.74% <100.00%> (-0.02%) ⬇️
Py-3.12.6 98.16% <100.00%> (ø)
Py-3.13.0-rc.3 98.15% <100.00%> (ø)
Py-3.9.13 97.56% <100.00%> (-0.01%) ⬇️
Py-3.9.20 97.50% <100.00%> (ø)
Py-pypy7.3.16 97.12% <100.00%> (ø)
VM-macos 97.80% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.11% <100.00%> (ø)
VM-windows 96.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@Dreamsorcerer Dreamsorcerer left a comment

Choose a reason for hiding this comment

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

Yeah, I was probably a little strict in this one, based on the limited uses in the tests. It's just a shame that you then don't get any type checking on your code, but probably a little complex to figure out something more accurate.

@layday
Copy link
Copy Markdown
Contributor Author

layday commented Oct 3, 2024

There's bound to be a way to explicitly declare the type of trace_request_ctx on the ClientSession using type var defaults but that's probably an exercise for another day 😛

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@Dreamsorcerer
Copy link
Copy Markdown
Member

There's bound to be a way to explicitly declare the type of trace_request_ctx on the ClientSession using type var defaults but that's probably an exercise for another day 😛

I think I briefly looked at it when making these changes originally. I don't think the current API has a way to be able to connect that up, so it'd need some refactoring in future if someone wanted to figure that out. aiohttp-security has a similar issue, where the main API is separate from the class which defines the types, so there's no way to pass types through..

@Dreamsorcerer Dreamsorcerer merged commit 3f43bd1 into aio-libs:master Oct 3, 2024
@patchback
Copy link
Copy Markdown
Contributor

patchback bot commented Oct 3, 2024

Backport to 3.10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.10/3f43bd1b7d2b2630c2567d3620eaf886ad9e5184/pr-9398

Backported as #9403

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 3, 2024
(cherry picked from commit 3f43bd1)
@patchback
Copy link
Copy Markdown
Contributor

patchback bot commented Oct 3, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/3f43bd1b7d2b2630c2567d3620eaf886ad9e5184/pr-9398

Backported as #9404

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 3, 2024
(cherry picked from commit 3f43bd1)
Dreamsorcerer pushed a commit that referenced this pull request Oct 3, 2024
)

**This is a backport of PR #9398 as merged into master
(3f43bd1).**
Dreamsorcerer pushed a commit that referenced this pull request Oct 3, 2024
)

**This is a backport of PR #9398 as merged into master
(3f43bd1).**

Co-authored-by: layday <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trace_request_ctx type is too restrictive

3 participants