How to move a library to async? /u/JanEric1 Python Education

We have a library utilizing a bunch of api calls. It is written fully with synchronous code. However, the base library that it is build on and does most of its calls through also offers the same apis in async.

Basically, we use a Client class from that library to make our calls, but it also offers an AsyncClient that we could use.

However, this would not only mean manually moving every class and function call to async, changing every instantiation of Client tp AsyncCLient or

with AsyncClient as client: ... 

but also mean a lot of code duplication as we want to still offer the old synchronous interface as well.

What are the best techniques to handle this? Are the static tools that can do such a migration, could one write one based on some generic framework, what other things (pitfalls?) would I have to keep in mind here?

submitted by /u/JanEric1
[link] [comments]

​r/learnpython We have a library utilizing a bunch of api calls. It is written fully with synchronous code. However, the base library that it is build on and does most of its calls through also offers the same apis in async. Basically, we use a Client class from that library to make our calls, but it also offers an AsyncClient that we could use. However, this would not only mean manually moving every class and function call to async, changing every instantiation of Client tp AsyncCLient or with AsyncClient as client: … but also mean a lot of code duplication as we want to still offer the old synchronous interface as well. What are the best techniques to handle this? Are the static tools that can do such a migration, could one write one based on some generic framework, what other things (pitfalls?) would I have to keep in mind here? submitted by /u/JanEric1 [link] [comments] 

We have a library utilizing a bunch of api calls. It is written fully with synchronous code. However, the base library that it is build on and does most of its calls through also offers the same apis in async.

Basically, we use a Client class from that library to make our calls, but it also offers an AsyncClient that we could use.

However, this would not only mean manually moving every class and function call to async, changing every instantiation of Client tp AsyncCLient or

with AsyncClient as client: ... 

but also mean a lot of code duplication as we want to still offer the old synchronous interface as well.

What are the best techniques to handle this? Are the static tools that can do such a migration, could one write one based on some generic framework, what other things (pitfalls?) would I have to keep in mind here?

submitted by /u/JanEric1
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *