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

⬆Increase supported version of aiofiles to suppress warnings #2899

Merged
merged 5 commits into from
Oct 5, 2021

Conversation

SnkSynthesis
Copy link
Contributor

@SnkSynthesis SnkSynthesis commented Mar 5, 2021

With Python 3.8 the usage of this @asyncio.coroutine in aiofiles 0.5.0 raises warnings since the @asyncio.coroutine has been deprecated since Python 3.8. This PR suppresses those warnings by increasing the aiofiles version to 0.7.0.

The lines (aiofiles/os.py) of aiofiles in version 0.5.0 (Notice the @asyncio.coroutine):

def wrap(func):
    @asyncio.coroutine
    @wraps(func)
    def run(*args, loop=None, executor=None, **kwargs):

The lines (aiofiles/os.py) of aiofiles in version 0.7.0 (Notice the async def):

def wrap(func):
    @wraps(func)
    async def run(*args, loop=None, executor=None, **kwargs):

@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #2899 (f00a27e) into master (69784e5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2899   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          410       410           
  Lines        10281     10281           
=========================================
  Hits         10281     10281           

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 69784e5...f00a27e. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

📝 Docs preview for commit 6df49c9 at: https://6041a84dec518b4cc73f8876--fastapi.netlify.app

@Kludex Kludex mentioned this pull request Apr 12, 2021
@wavenator
Copy link

Is there a reason why this PR is not merged yet? If any more work is needed, I'd be happy to jump in.

@wavenator
Copy link

wavenator commented May 22, 2021

In the meantime version 0.7.0 has been released. I recommend upgrading again.

@SnkSynthesis
Copy link
Contributor Author

@wavenator The version of aiofiles has been increased to 0.7.0. Thank you for the recommendation.

@hongqn
Copy link

hongqn commented Sep 27, 2021

All reviewers have approved this pullreq. What's blocking the workflows?

@SnkSynthesis
Copy link
Contributor Author

@hongqn, A maintainer (@tiangolo) needs to approve workflows and/or merge the pull request.

@zevisert
Copy link

zevisert commented Sep 28, 2021

I came looking to open this PR today, good to see some activity. I can pitch some commentary on the changelog from aiofiles.

0.7.0 (2021-05-17)
''''''''''''''''''
- Added the ``aiofiles.tempfile`` module for async temporary files.     <https://github.com/Tinche/aiofiles/pull/56>
- Switched to Poetry and GitHub actions.
- Dropped 3.5 support.

0.6.0 (2020-10-27)
''''''''''''''''''
- `aiofiles` is now tested on ppc64le.
- Added `name` and `mode` properties to async file objects.             <https://github.com/Tinche/aiofiles/pull/82>
- Fixed a DeprecationWarning internally.                                <https://github.com/Tinche/aiofiles/pull/75>
- Python 3.9 support and tests.
  1. Although the changelog claims 0.6.0 is first to support python 3.9, 0.5.0 installs and functions just fine in 3.9. This is because aiofiles==0.5.0 used setuptools, but didn't specify python_requires.
  2. The DepreciationWarning is what we're after here.
  3. 0.7.0 drops python 3.5 support, but that's fine, we're >=3.6 here in FastAPI.
  4. The note about switching to poetry in 0.7.0 reflects the drop of python 3.5 correctly. https://github.com/Tinche/aiofiles/blob/469c1a8b94ccccf25516706c88dde2e69ea45f3c/pyproject.toml#L9-L11
  5. aiofiles has no dependencies in 0.5.0 or 0.6.0 or 0.7.0, so whatever version we choose here shouldn't conflict with any other packages.

@SnkSynthesis
Copy link
Contributor Author

Thanks @zevisert!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2021

📝 Docs preview for commit f00a27e at: https://615c178297b64adca31ade5b--fastapi.netlify.app

@tiangolo
Copy link
Member

tiangolo commented Oct 5, 2021

Thanks for your contribution @SnkSynthesis! 🍰

And thanks for the discussion everyone, in particular @zevisert for all the investigation and report. 🕵️

I updated the range required to also include 0.5.0 as it still works, there's no need to force everyone to upgrade to the most recent one (and to avoid any possible conflicts with other packages depending on aiofiles).

On the other hand, just as a note, I'll soon upgrade to the latest Starlette, based on anyio, which provides the same functionality, so aiofiles will no longer be needed. 🎉

I'm making a release with these changes first just in case that's useful in the transition for anyone.

This is included in FastAPI 0.68.3, just released. 🎉

@tiangolo tiangolo changed the title Increased aiofiles version to suppress warnings ⬆Increase supported version of aiofiles to suppress warnings Oct 5, 2021
@tiangolo tiangolo merged commit ba8c78d into fastapi:master Oct 5, 2021
@SnkSynthesis
Copy link
Contributor Author

Thanks @tiangolo 😄!

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.

None yet

10 participants