-
-
Notifications
You must be signed in to change notification settings - Fork 15
Add 'Rule' to unasync for per-directory config #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really solid work, thanks! I've left a few comments but nothing is blocking so feel free to merge this as-is.
src/unasync/__init__.py
Outdated
|
||
|
||
def customize_build_py(rename_dir_from_to=("_async", "_sync")): | ||
def customize_build_py(rules=(_DEFAULT_RULE,)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not specific to this PR, but I'm not too happy that we have both build_py
and customize_build_py
. I think we can transform customize_build_py
into build_py.__call__
, and possibly only expose build_py
and Rule
as part of our API. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I can make that change in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm so build_py
is a class so we can't use __call__
unfortunately. Maybe we can use cmdclass_build_py(rules=[])
and make the build_py
class a part of the private interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also document the changes and update the usage example in README.md
Updated this PR per comments, thanks all! Would love another review. :) |
Thanks! Unfortunately the build breaks because of the virtualenv mess |
@pquentin Is there an issue somewhere I can track? There's multiple things blocked on that. :/ |
@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 |
Cycling, hopefully the Travis issue is now fixed. |
Thank you @sethmlarson! |
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
.