python-trio / unasync

The async transformation code.
Other
89 stars 13 forks source link

Imports from _async module doesn't get converted to imports from _sync #79

Open anand2312 opened 11 months ago

anand2312 commented 11 months ago

Imports from the _async module seem to be unaffected:

from library._async.module import AsyncFoo

gets converted to

from library._async.module import SyncFoo

Expected result:

from library._sync.module import SyncFoo

Currently working around it by exporting both the classes from a common place, but it'd be nice to have this work.

robsdedude commented 9 months ago

You can find examples of using the additional_replacements parameter of Rule to add custom replacements.

https://unasync.readthedocs.io/en/latest/#usage-outside-of-setuptools

This should allow you to achieve what you're after.