Opened 5 years ago

Last modified 5 years ago

#94 new enhancement

asyncio

Reported by: ftputiluser Owned by: schwa
Priority: major Milestone:
Component: Library Version:
Keywords: Cc: requiredfield256@…

Description

Dear Stefan, I'm looking for an asyncio-friendly FTP client and have yet to find one. Any interest in doing an ftputil implementation using asyncio? Thanks for your consideration and best wishes.

Change History (4)

comment:1 Changed 5 years ago by ftputiluser

Cc: requiredfield256@… added

comment:2 Changed 5 years ago by schwa

Thanks for your friendly request. :-)

I think asyncio compatibility would be a good feature to have. There's definitely interest on my side.

On the other hand, ftputil uses ftplib.FTP (or compatible APIs) under the hood, and those are synchronous. I guess there are still ways to make this work somehow, maybe by using threads.

To tell if or how I could do it I'd need to look more into asyncio, which I'm planning to do anyway, not only for ftputil.

Is your question "just" out of interest or do you have a concrete use case in mind? How important is the feature for you right now and in the near future?

How much experience do you have with asyncio? Would you mind discussing a design with me if I come up with one? Did you even already look at the ftputil code and have ideas?

comment:3 Changed 5 years ago by ftputiluser

Thanks for the quick and attentive reply, Stefan. My use case turned out to be very simple, and was satisfied by a few basic calls to ftplib directly, so I didn't end up needing ftputil after all.

I ended up using loop.run_in_executor (as recommended by the docs) to handle the blocking ftplib calls in my non-blocking code. However, much like the 3rd-party aiohttp fills the need for an asyncio-based http library, a 3rd-party "aioftp" library should exist to fill the need for an asyncio-based ftp library, but unfortunately none yet exists. If you or anyone else in the ftputil community is interested in implementing one, I bet it'd be a valuable contribution.

In case you're interested, http://asyncio.org might provide some more useful resources.

Thanks again!

comment:4 Changed 5 years ago by schwa

Thanks a lot for the links. Especially http://asyncio.org seems to be useful to learn a lot. :-)

Note: See TracTickets for help on using tickets.