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

Fix cgi and importlib_resources deprecations #185

Merged
merged 5 commits into from
Jul 12, 2022

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Jul 8, 2022

gidgethub/sansio.py:8: 10 warnings
  /private/tmp/gidgethub/gidgethub/sansio.py:8: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi

Fix using email module as suggested at https://peps.python.org/pep-0594/#cgi


tests/test_abc.py: 10 warnings
  /private/tmp/gidgethub/tests/test_abc.py:705: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    payload = importlib_resources.read_binary(graphql_samples, payload_filename)

tests/test_apps.py::TestGitHubAppUtils::test_get_jwt
  /private/tmp/gidgethub/tests/test_apps.py:24: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    private_key = importlib_resources.read_binary(rsa_key_samples, "test_rsa_key")

tests/test_apps.py::TestGitHubAppUtils::test_get_installation_access_token
  /private/tmp/gidgethub/tests/test_apps.py:41: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    private_key = importlib_resources.read_binary(rsa_key_samples, "test_rsa_key")

Fix using files() API as suggested at https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2022

Codecov Report

Merging #185 (24ab9d4) into main (8c60e56) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #185   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          461       463    +2     
  Branches       102       108    +6     
=========================================
+ Hits           461       463    +2     
Impacted Files Coverage Δ
gidgethub/sansio.py 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Collaborator

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

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

Looks like mypy doesn't like the typing of the change.

@hugovk
Copy link
Contributor Author

hugovk commented Jul 9, 2022

How's this?

@hugovk hugovk requested a review from brettcannon July 9, 2022 13:57
@brettcannon brettcannon merged commit 89ade88 into gidgethub:main Jul 12, 2022
@brettcannon
Copy link
Collaborator

Thanks!

@hugovk hugovk deleted the fix-deprecations branch July 12, 2022 22:33
github-actions bot pushed a commit to aio-libs/aiohttp that referenced this pull request Aug 22, 2024
Bumps [gidgethub](https://github.com/brettcannon/gidgethub) from 5.0.1
to 5.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/brettcannon/gidgethub/releases">gidgethub's
releases</a>.</em></p>
<blockquote>
<h2>5.3.0</h2>
<ul>
<li>
<p>Add support passing <code>extra_headers</code> when making requests
[PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/192">#192</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/192">brettcannon/gidgethub#192</a>)</p>
</li>
<li>
<p>Add a getstatus() method for APIs that do not return content.
[PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/194">#194</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/194">brettcannon/gidgethub#194</a>)</p>
</li>
</ul>
<h2>5.2.1</h2>
<ul>
<li>
<p>Fix cgi and importlib_resources deprecations.
[PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/185">#185</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/185">brettcannon/gidgethub#185</a>)</p>
</li>
<li>
<p>Add support for Python 3.11 and drop EOL Python 3.6
[PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/184">#184</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/184">brettcannon/gidgethub#184</a>)</p>
</li>
</ul>
<h2>5.2.0</h2>
<ul>
<li>Make the minimum version of PyJWT be v2.4.0.</li>
</ul>
<h2>5.1.0</h2>
<ul>
<li>
<p>Use <code>X-Hub-Signature-256</code> header for webhook validation
when available.
([PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/160">#160</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/160">brettcannon/gidgethub#160</a>)).</p>
</li>
<li>
<p>The documentation is now built using Sphinx v&gt;= 4.0.0.
([Issue <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/143">#143</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/143">brettcannon/gidgethub#143</a>))</p>
</li>
<li>
<p><code>gidgethub.abc.GitHubAPI.getiter</code> now accepts
<code>iterable_key</code> parameter
in order to support the Checks API.
([Issue <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/164">#164</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/164">brettcannon/gidgethub#164</a>))</p>
</li>
<li>
<p>Accept HTTP 202 ACCEPTED as successful.
([PR <a
href="https://redirect.github.com/brettcannon/gidgethub/issues/174">#174</a>](<a
href="https://redirect.github.com/brettcannon/gidgethub/pull/174">brettcannon/gidgethub#174</a>))</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/gidgethub/gidgethub/blob/main/docs/changelog.rst">gidgethub's
changelog</a>.</em></p>
<blockquote>
<h2>5.3.0</h2>
<ul>
<li>
<p>Add support passing <code>extra_headers</code> when making requests
(<code>PR [#192](gidgethub/gidgethub#192)
&lt;https://github.com/brettcannon/gidgethub/pull/192&gt;</code>_)</p>
</li>
<li>
<p>Add a getstatus() method for APIs that do not return content.
(<code>PR [#194](gidgethub/gidgethub#194)
&lt;https://github.com/brettcannon/gidgethub/pull/194&gt;</code>_)</p>
</li>
</ul>
<h2>5.2.1</h2>
<ul>
<li>
<p>Fix cgi and importlib_resources deprecations.
(<code>PR [#185](gidgethub/gidgethub#185)
&lt;https://github.com/brettcannon/gidgethub/pull/185&gt;</code>_)</p>
</li>
<li>
<p>Add support for Python 3.11 and drop EOL Python 3.6
(<code>PR [#184](gidgethub/gidgethub#184)
&lt;https://github.com/brettcannon/gidgethub/pull/184&gt;</code>_)</p>
</li>
</ul>
<h2>5.2.0</h2>
<ul>
<li>Make the minimum version of PyJWT be v2.4.0.</li>
</ul>
<h2>5.1.0</h2>
<ul>
<li>
<p>Use <code>X-Hub-Signature-256</code> header for webhook validation
when available.
(<code>PR [#160](gidgethub/gidgethub#160)
&lt;https://github.com/brettcannon/gidgethub/pull/160&gt;</code>_).</p>
</li>
<li>
<p>The documentation is now built using Sphinx v&gt;= 4.0.0.
(<code>Issue [#143](gidgethub/gidgethub#143)
&lt;https://github.com/brettcannon/gidgethub/issues/143&gt;</code>_)</p>
</li>
<li>
<p>:meth:<code>gidgethub.abc.GitHubAPI.getiter</code> now accepts
<code>iterable_key</code> parameter
in order to support the Checks API.
(<code>Issue [#164](gidgethub/gidgethub#164)
&lt;https://github.com/brettcannon/gidgethub/issues/164&gt;</code>_)</p>
</li>
<li>
<p>Accept HTTP 202 ACCEPTED as successful.
(<code>PR [#174](gidgethub/gidgethub#174)
&lt;https://github.com/brettcannon/gidgethub/pull/174&gt;</code>_)</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/dbcdf4bd32de86288495dbbd8c1682399ba53ad1"><code>dbcdf4b</code></a>
Fix the rst markup on the Changelog. (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/197">#197</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/b9fe3c69030e0960d4ba2dcc1efb921e240c7504"><code>b9fe3c6</code></a>
Add <code>extra_headers</code> option to <code>get</code> methods (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/192">#192</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/901f0578c00919cdb8c0b120b6d9d9f35eda620e"><code>901f057</code></a>
Add a getstatus() method to gidgethub.abc (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/194">#194</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/20e861254150b16bfd2fbe26b012cb6736430faf"><code>20e8612</code></a>
Update the intersphinx mapping to 1.0-style (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/195">#195</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/e1f7baed601914139fc5179fcb8faea210bbf543"><code>e1f7bae</code></a>
Fix lint issues (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/191">#191</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/b3ae8d16426355f660a2fc2aadeb4d8e61478add"><code>b3ae8d1</code></a>
Replace use of <code>requests</code> in examples with <code>httpx</code>
(<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/190">#190</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/4fe3c04d7c550a5b33fbf00e154810042f7d3edb"><code>4fe3c04</code></a>
Release 5.2.1 (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/186">#186</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/89ade8859539212e0663e91f0777ad8a39ecf323"><code>89ade88</code></a>
Fix cgi and importlib_resources deprecations (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/185">#185</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/64888cbe83e3f11af3c6f25294adff26dc2f557a"><code>64888cb</code></a>
Add support for Python 3.11 and drop EOL Python 3.6 (<a
href="https://redirect.github.com/brettcannon/gidgethub/issues/184">#184</a>)</li>
<li><a
href="https://github.com/gidgethub/gidgethub/commit/8c60e56029b7e10b7be9879e64dfbf97bbeda2b8"><code>8c60e56</code></a>
Add variable mapping to fix 'Session tests-3.10-dev skipped: Python
interpret...</li>
<li>Additional commits viewable in <a
href="https://github.com/brettcannon/gidgethub/compare/5.0.1...v5.3.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=gidgethub&package-manager=pip&previous-version=5.0.1&new-version=5.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants