faust icon indicating copy to clipboard operation
faust copied to clipboard

Add support for python3.11

Open wbarnha opened this issue 3 years ago • 1 comments

Prepare for upcoming release of Python 3.11 on 10/24

wbarnha avatar Sep 21 '22 12:09 wbarnha

Codecov Report

Base: 93.97% // Head: 93.86% // Decreases project coverage by -0.10% :warning:

Coverage data is based on head (3447f53) compared to base (7bef2a2). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
- Coverage   93.97%   93.86%   -0.11%     
==========================================
  Files         102      102              
  Lines       11085    11085              
  Branches     1302     1516     +214     
==========================================
- Hits        10417    10405      -12     
- Misses        586      596      +10     
- Partials       82       84       +2     
Impacted Files Coverage Δ
faust/streams.py 88.01% <ø> (ø)
faust/transport/consumer.py 92.30% <100.00%> (-1.71%) :arrow_down:
faust/transport/drivers/aiokafka.py 73.49% <100.00%> (ø)
faust/transport/producer.py 89.16% <100.00%> (ø)
faust/__init__.py 96.07% <0.00%> (-3.93%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 21 '22 13:09 codecov-commenter

Apparently Python 3.11 has not been released yet, today.

wbarnha avatar Oct 24 '22 18:10 wbarnha

Run scripts/tests
+ [ -z true ]
+ pytest tests/unit tests/functional tests/integration tests/meticulous/ tests/regression
ImportError while loading conftest '/home/runner/work/faust/faust/tests/conftest.py'.
tests/conftest.py:12: in <module>
    from mode.utils.mocks import AsyncContextManagerMock, AsyncMock, MagicMock, Mock, patch
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/mode/utils/mocks.py:7: in <module>
    from asyncio import coroutine
E   ImportError: cannot import name 'coroutine' from 'asyncio' (/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/asyncio/__init__.py)

Looks like mode-streaming needs an update.

wbarnha avatar Oct 25 '22 17:10 wbarnha

The product of immediately testing this PR of Faust with an example:

[2022-11-23 00:50:29,094] [1] [ERROR] [^---Conductor]: Crashed reason=TypeError('An asyncio.Future, a coroutine or an awaitable is required') 
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 843, in _execute_task
    await task
  File "/usr/local/lib/python3.10/dist-packages/faust/transport/conductor.py", line 288, in _subscriber
    await self.app.agents.wait_until_agents_started()
  File "/usr/local/lib/python3.10/dist-packages/faust/agents/manager.py", line 80, in wait_until_agents_started
    await self.wait_for_stopped(self._agents_started)
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 704, in wait_for_stopped
    return (await self.wait(*coros, timeout=timeout)).stopped
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 711, in wait
    return await self._wait_one(coros[0], timeout=timeout)
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 779, in _wait_one
    results = await self.wait_first(coro, timeout=timeout)
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 740, in wait_first
    futures = {
  File "/usr/local/lib/python3.10/dist-packages/mode/services.py", line 741, in <dictcomp>
    coro: asyncio.ensure_future(
  File "/usr/lib/python3.10/asyncio/tasks.py", line 615, in ensure_future
    return _ensure_future(coro_or_future, loop=loop)
  File "/usr/lib/python3.10/asyncio/tasks.py", line 630, in _ensure_future
    raise TypeError('An asyncio.Future, a coroutine or an awaitable '
TypeError: An asyncio.Future, a coroutine or an awaitable is required

Ugh, there's still work left to be done.

wbarnha avatar Nov 23 '22 01:11 wbarnha

https://github.com/faust-streaming/mode/pull/30 fixed the previous issue! We're good to go!

Edit: I ran this branch and mode-streaming 0.3.1rc1 on my own code and it still seems there's some issues needing to be resolved? I can't tell, everything started working fine on its own after a bit.

wbarnha avatar Nov 23 '22 02:11 wbarnha

I got it working in Python 3.11 but a heads up:

/usr/local/lib/python3.11/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (1.26.13) or chardet (5.1.0dev0)/charset_normalizer (2.1.1) doesn't match a supported version!

wbarnha avatar Nov 24 '22 15:11 wbarnha