python-trio / unasync

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

Add 'Rule' to unasync for per-directory config #55

Closed sethmlarson closed 4 years ago

sethmlarson commented 4 years ago

This PR adds a new feature called Rule to unasync which allows configuring unasync to act differently in different directories. The rule with the most specific match to a given path applies, allowing for additional replacements that only affect certain sub-directories.

I maintained the current API with unasync_X() functions deriving from a "default" rule of _async -> _sync.

codecov[bot] commented 4 years ago

Codecov Report

Merging #55 into master will increase coverage by 0.63%. The diff coverage is 100%.

@@            Coverage Diff            @@
##           master     #55      +/-   ##
=========================================
+ Coverage   96.96%   97.6%   +0.63%     
=========================================
  Files           4       4              
  Lines         198     250      +52     
  Branches       46      62      +16     
=========================================
+ Hits          192     244      +52     
  Misses          2       2              
  Partials        4       4
Impacted Files Coverage Δ
src/unasync/__init__.py 97.58% <100%> (+0.64%) :arrow_up:
unasync/__init__.py 97.58% <0%> (+0.64%) :arrow_up:
sethmlarson commented 4 years ago

Updated this PR per comments, thanks all! Would love another review. :)

pquentin commented 4 years ago

Thanks! Unfortunately the build breaks because of the virtualenv mess

sethmlarson commented 4 years ago

@pquentin Is there an issue somewhere I can track? There's multiple things blocked on that. :/

pquentin commented 4 years ago

@sethmlarson Yes that's https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180

Feel free to allow failures in the 3.8-dev build for now if that can unblock you

pquentin commented 4 years ago

Cycling, hopefully the Travis issue is now fixed.

pquentin commented 4 years ago

Thank you @sethmlarson!