Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.66k stars 150 forks source link

Project restructurisation #137

Closed stankudrow closed 2 years ago

stankudrow commented 2 years ago

Changes:

  1. The wrap function is renamed to asyncify and moved to aiofiles/base.py file.
  2. The isasync function is added to identify async objects -> may be useful in asyncify and if isasync(foo), then return foo - no need to run in executor an already asynchronous object - tested;
  3. get_event_loop is replaced with get_running_loop + contextvars are packed into asyncified functions.

In short, more "devops", less new functionality added. Tested in all environments except Python3.6 and PyPy3.

ToDo:

Tinche commented 2 years ago

Hi!

I would love some help maintaining this project, so a lot of these changes would be very welcome. A few points though:

These choices are better than the alternatives, and consistent with every other project of mine.

The rest all look good!

stankudrow commented 2 years ago

All right, so be src layout (src/aiofiles/* or src**?), black linter will be back. The main question is can we drop out the support for Python3.6? Its lifetime ended at the end of last year - Stop using Python3.6. That means we don't need py3.6 environment in tox.ini and CI/CD pipelines anymore. Sounds good?

Tinche commented 2 years ago

The code should be in src/aiofiles/*. Here's a good article: https://hynek.me/articles/testing-packaging/

And yeah, let's drop 3.6. Users on that version can use the old versions.

Thanks!

stankudrow commented 2 years ago

All right. The src layout is restored, black is back and no conflicts with flake8 for now, tox works fine so far. I think this project needs documentation - sphinx or any other tool (e. g. mkdocs) can help out, I shall find a solution. If there is no other suggestions, a new PR may be ready this Sunday.