How can one fully replace distutils, which is deprecated in 3.10?

Yes setuptools can fully replace distutils for everything distutils.core.setup maps to setuptools.setup distutils.core.Extension maps to setuptools.Extension setuptools is not part of the standard library (hence its absence from the doc) but it is part of the standard python.org distribution. some distributions choose to separate setuptools and pip from the default python package because they don’t … Read more

Is there a way to kill uvicorn cleanly?

That’s because you’re running uvicorn as your only server. uvicorn is not a process manager and, as so, it does not manage its workers life cycle. That’s why they recommend running uvicorn using gunicorn+UvicornWorker for production. That said, you can kill the spawned workers and trigger it’s shutdown using the script below: $ kill $(pgrep … Read more

“async with” in Python 3.4

Just don’t use the result of session.get() as a context manager; use it as a coroutine directly instead. The request context manager that session.get() produces would normally release the request on exit, but so does using response.text(), so you could ignore that here: @asyncio.coroutine def fetch(session, url): with aiohttp.Timeout(10): response = yield from session.get(url) return … Read more

What are the differences between mysql-connector-python, mysql-connector-python-rf and mysql-connector-repackaged?

The main differences between them are: mysql-connector-repackaged: is old, do not use it mysql-connector-python 2.0.4: is the original uploaded by MySQL. But it has the problem that does not works with Django >= 1.8. MySQL did not upload yet their stable version 2.1.3 to this repo. mysql-connector-python-rf 2.1.3: is the solution to all your problems … Read more

When is a function in a standard library module called a built-in function?

There are two meanings of “built-in” here, although they both mean “part of the interpreter”. The library reference uses it to indicate that a function is available without an import (it is “not part of a module”, although see builtins). The interpreter itself uses it to indicate that a function is implemented natively rather than … Read more