geotom / free.dm-Common

Core framework of free.dm
MIT License
1 stars 1 forks source link

Upgrade existing code to Python 3.7 #6

Open geotom opened 6 years ago

geotom commented 6 years ago

Tasks

Todo

geotom commented 6 years ago
geotom commented 6 years ago

More asyncio changes in 3.7 here! https://tryexceptpass.org/article/asyncio-in-37/

Of interest are the conextvars and asyncio.run()

Regarding asyncio.createask, it is better to revert to the old ensure_future for a specific loop, otherwise create_task takes a default one and not the one of the transport!

Also see Async Context Managers: Another quality-of-life improvement. We now have the asynccontextmanager() decorator for producing async context managers without the need for a class that implements aenter() or aexit(). This behaves exactly like the contextmanager() decorator that we use today for synchronous code. They also added a new AbstractAsyncContextManager and AsyncExitStack to complement their synchronous cousins.

Check the server state (aka isRunning?) We can now control when an asyncio.Server begins serving during creation with the start_serving keyword and the Server.start_serving() function. Plus we can also have Server.is_serving() to determine its state.

Loop methods which accept socket paths now support passing path-like objects.

geotom commented 6 years ago

Dataclasses can be combined with jsonschema via this module: https://pypi.org/project/dataclasses-jsonschema/