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 client Brotli support #5227

Merged
merged 8 commits into from Nov 23, 2020
Merged

Add client Brotli support #5227

merged 8 commits into from Nov 23, 2020

Conversation

derlih
Copy link
Contributor

@derlih derlih commented Nov 13, 2020

What do these changes do?

If brotlipy is installed, client will support this compression type

Are there changes in behavior for the user?

No

Related issue number

#5219

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_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 13, 2020
@CLAassistant
Copy link

CLAassistant commented Nov 13, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Nov 13, 2020

Codecov Report

Merging #5227 (58140ae) into master (a2fef0f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5227   +/-   ##
=======================================
  Coverage   97.54%   97.54%           
=======================================
  Files          43       43           
  Lines        8794     8797    +3     
  Branches     1413     1413           
=======================================
+ Hits         8578     8581    +3     
  Misses        101      101           
  Partials      115      115           
Flag Coverage Δ
unit 97.39% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
aiohttp/client_reqrep.py 97.39% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2fef0f...58140ae. Read the comment docs.

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

The PR looks good.

Please click on https://cla-assistant.io/aio-libs/aiohttp?pullRequest=5227 to sign CLA.
I've added it recently and checked -- the sign is pretty easy :)

@derlih
Copy link
Contributor Author

derlih commented Nov 13, 2020

@asvetlov
Is aiohttp somehow connected to SAP?

@asvetlov
Copy link
Member

Oops.
No, sure! Thanks for the note.
I've updated the CLA text to closely follow the Python CLA (https://www.python.org/psf/contrib/contrib-form/) but slightly adapted to the aio-libs project.
The CLA text is available here: https://gist.github.com/asvetlov/dbce6679052f5c89d3d13f501107c1d4

@derlih
Copy link
Contributor Author

derlih commented Nov 14, 2020

Signed.
Should the brotli runtime support be reflected in somewhere in docs?

@asvetlov
Copy link
Member

Should the brotli runtime support be reflected in somewhere in docs?

Sounds good.
Do you have an idea of what place the sentence should be pushed in?

@derlih
Copy link
Contributor Author

derlih commented Nov 14, 2020

What about the dependencies section?

aiohttp/docs/index.rst

Lines 146 to 170 in 021668a

Dependencies
============
- Python 3.6+
- *async_timeout*
- *attrs*
- *chardet*
- *multidict*
- *yarl*
- *Optional* :term:`cchardet` as faster replacement for
:term:`chardet`.
Install it explicitly via:
.. code-block:: bash
$ pip install cchardet
- *Optional* :term:`aiodns` for fast DNS resolving. The
library is highly recommended.
.. code-block:: bash
$ pip install aiodns

@asvetlov
Copy link
Member

ok

docs/glossary.rst Outdated Show resolved Hide resolved
@derlih derlih changed the title Add client Brotli support [WIP] Add client Brotli support Nov 14, 2020
@derlih derlih changed the title [WIP] Add client Brotli support Add client Brotli support Nov 14, 2020
Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

Ooops, the spell checker doesn't approve the docs changes: https://github.com/aio-libs/aiohttp/pull/5227/checks?check_run_id=1400046288

The most practical solution is extending https://github.com/aio-libs/aiohttp/blob/master/docs/spelling_wordlist.txt with words like brotli to teach the checker new facilities

@derlih
Copy link
Contributor Author

derlih commented Nov 15, 2020

I fixed the spellcheck.

@asvetlov
Copy link
Member

asvetlov commented Nov 15, 2020

The feature is backward compatible.
But it is still a new feature, there is no need to backport it to 3.7

@derlih
Copy link
Contributor Author

derlih commented Nov 16, 2020

The aiohttp user from #5219 wanted to use it. May be for 3.7.3?
I think this release will happen quite soon because the win32 wheels are currently missing.

@asvetlov
Copy link
Member

Sorry, I had no capacity to push it into 3.7.3.
Technically this is a new backward-compatible feature.
It means that it can be released as a part of 3.8.0 pretty soon.
I want to review recent reproducible bug reports (and fix them if possible) first to include fixes into 3.8

@asvetlov asvetlov merged commit 28ea32d into aio-libs:master Nov 23, 2020
@asvetlov
Copy link
Member

Thanks!

@github-actions
Copy link
Contributor

💔 Backport was not successful

The PR was attempted backported to the following branches:

  • ❌ 3.8: Commit could not be cherrypicked due to conflicts

@derlih derlih deleted the brotli branch November 23, 2020 08:40
commonism pushed a commit to commonism/aiohttp that referenced this pull request Apr 27, 2021
commonism pushed a commit to commonism/aiohttp that referenced this pull request Apr 27, 2021
@ddelange
Copy link
Contributor

ddelange commented Nov 24, 2022

hi 👋

it seems this patch didn't make it into 3.8.3, the Accept-Encoding header is still hard-coded.

could this patch be cherry-picked into 3.8.4?

@webknjaz webknjaz added backport-3.9 Trigger automatic backporting to the 3.9 release branch by Patchback robot and removed backport-3.8 labels Nov 24, 2022
@patchback
Copy link
Contributor

patchback bot commented Nov 24, 2022

Backport to 3.9: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 28ea32d on top of patchback/backports/3.9/28ea32d2282728a94af73c87efd6ab314c14320e/pr-5227

Backporting merged PR #5227 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.9/28ea32d2282728a94af73c87efd6ab314c14320e/pr-5227 upstream/3.9
  4. Now, cherry-pick PR Add client Brotli support #5227 contents into that branch:
    $ git cherry-pick -x 28ea32d2282728a94af73c87efd6ab314c14320e
    If it'll yell at you with something like fatal: Commit 28ea32d2282728a94af73c87efd6ab314c14320e is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x 28ea32d2282728a94af73c87efd6ab314c14320e
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Add client Brotli support #5227 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.9/28ea32d2282728a94af73c87efd6ab314c14320e/pr-5227
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

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

@webknjaz
Copy link
Member

You can try following bot instructions to submit a PR against 3.9.

ddelange pushed a commit to ddelange/aiohttp that referenced this pull request Nov 24, 2022
ddelange pushed a commit to ddelange/aiohttp that referenced this pull request Nov 24, 2022
(cherry picked from commit 28ea32d)
(cherry picked from commit fab2c62)
@ddelange
Copy link
Contributor

opened backport PRs against 3.9 (#7100) and 3.8 (#7101)

Dreamsorcerer pushed a commit that referenced this pull request Nov 24, 2022
(cherry picked from commit 28ea32d)

backport ref
#5227 (comment)

Co-authored-by: Dmitry Erlikh <derlih@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@ddelange
Copy link
Contributor

hi 👋 is there a rough ETA when 3.9 and/or 4.0 will be shipped?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.9 Trigger automatic backporting to the 3.9 release branch by Patchback robot 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.

None yet

5 participants