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

asyncio stubs are missing Python 3.7 and 3.8 methods #2313

Closed
24 of 35 tasks
hynek opened this issue Jul 6, 2018 · 13 comments · Fixed by #3399
Closed
24 of 35 tasks

asyncio stubs are missing Python 3.7 and 3.8 methods #2313

hynek opened this issue Jul 6, 2018 · 13 comments · Fixed by #3399
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module

Comments

@hynek
Copy link
Member

hynek commented Jul 6, 2018

I’ve tried to migrate a code base to 3.7 and noticed that the asyncio stubs need some love.

The ones I’ve noticed are:

  • asyncio.create_task()
  • asyncio.run()
  • asyncio.current_task()
  • asyncio.all_tasks()
  • asyncio.get_running_loop()
  • loop.start_tls()
  • loop.sock_sendfile()
  • loop.sendfile()
  • loop.sock_recv_into()
  • BufferedProtocol
  • StreamWriter.wait_closed()
  • Task.get_loop() (comment by @srittau: not in documentation or implementation)
  • Future.get_loop()
  • Server.get_loop()
  • start_serving argument for
    • loop.create_server(start_serving)
    • loop.create_unix_server(start_serving)
  • Server.start_serving()
  • Server.serve_forever()
  • Server.is_serving()
  • ssl_handshake_timeout argument for
    • asyncio.open_connection()
    • asyncio.start_server()
    • loop.create_connection()
    • loop.create_server()
    • loop.create_accepted_socket()
  • Handle.cancelled()
  • ReadTransport.is_reading()
  • “Loop methods which accept socket paths now support passing path-like objects. ” – that sounds like changes throughout the module?

But I suspect that everything new in 3.7 isn’t covered at all ATM.

Ref: https://docs.python.org/3/whatsnew/3.7.html#asyncio

Added by @srittau via the report by @Mulugruntz:

  • asyncio.BaseEventLoop
  • asyncio.WindowsProactorEventLoopPolicy
  • asyncio.windows_events

Added by @srittau via the report by @brianjyoung:

  • loop.create_task() now accepts a name
  • loop.create_connection() supports happy_eyeballs_delay and interleave
    New Task methods:
  • get_coro()
  • get_name()
  • set_name()
@gvanrossum
Copy link
Member

Thanks -- we're dependent on contributors for noticing these things (a systematic search would get unwieldy). Would you mind submitting a PR?

@hynek
Copy link
Member Author

hynek commented Jul 7, 2018

I have tried but I cannot run mypy_selftest.py ATM:

  1. subprocess.run(['python2.7', '-m', 'pip', 'install', '--user', 'typing'], check=True)
    fails on modern pips (Could not find an activated virtualenv (required).).
  2. After commenting out that line I ran into Pinned lxml doesn’t build on Python 3.7 / macOS mypy#5329

It would be good if typeshed found a way to use tox for these tests? Trying to install something into my global Python installation (even if it’s just --user) is kinda rude. :)

I’ll revisit once I can run the tests.

@JelleZijlstra
Copy link
Member

I suppose we wrote selftest.py mostly for use in Travis; it's fine to not use it for local development.

@hynek
Copy link
Member Author

hynek commented Jul 11, 2018

I’ve updated the bug with a list of things I found now; since this is massive, it will take more than one PR to fix and I’m not taking any ownership in it. I’ll try to fix the top-level functions ASAP.

@gvanrossum
Copy link
Member

Thanks! Quite a list.

@srittau srittau added the stubs: incomplete Annotations or sub-modules missing from an existing package or module label Nov 19, 2018
@Mulugruntz
Copy link

Mulugruntz commented Feb 13, 2019

Hi,

I'm reporting here that some more are missing.
I first (wrongly) posted that issue there https://bugs.python.org/issue35987#msg335444 then was redirected here.

I've also opened a ticket there python/mypy#6383

@CraftSpider
Copy link
Contributor

CraftSpider commented Oct 18, 2019

I think everything in this is completed except for possibly:

  • ssl_handshake_timeout argument for
    • asyncio.open_connection()
    • asyncio.start_server()
  • “Loop methods which accept socket paths now support passing path-like objects. ” – that sounds like changes throughout the module?

@brianjyoung
Copy link
Contributor

I know the title says "Python 3.7" but now that we're in the future it feels like this might be an appropriate place to bring up the new 3.8 functionality:

  • loop.create_task() now accepts a name
  • loop.create_connection() supports happy_eyeballs_delay and interleave
  • New Task methods:
    • get_coro()
    • get_name()
    • set_name()

@srittau
Copy link
Collaborator

srittau commented Oct 22, 2019

All of these are missing from the release notes. 😕

@gvanrossum
Copy link
Member

Can you report that in bugs.python.org?

@srittau
Copy link
Collaborator

srittau commented Oct 23, 2019

Already reported in issue38460.

@srittau srittau changed the title asyncio stubs are missing Python 3.7 methods asyncio stubs are missing Python 3.7 and 3.8 methods Oct 23, 2019
@srittau
Copy link
Collaborator

srittau commented Oct 23, 2019

I have updated the original list and will start working on a patch now.

@hynek
Copy link
Member Author

hynek commented Oct 30, 2019

NICE! Thanks for picking up my slack!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants