Skip to content

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented May 2, 2020

It allows to run unasync on multiple files using multiples rules if needed, without being tied to setuptools.

@sethmlarson Now that you taught me that using Rule.unasync_files directly made sense, I'm not sure if this is such a good idea. Right now, I have a proof-of-concept that works in hip using this API:

import unasync unasync.unasync_files( [ "test/with_dummyserver/sync/__init__.py", "test/with_dummyserver/async/test_poolmanager.py", ], rules=[ unasync.Rule( "test/with_dummyserver/async", "test/with_dummyserver/sync", replacements={ "AsyncPoolManager": "PoolManager", "test_all_backends": "test_sync_backend", }, ) ], ) 

Since I have only a single rule, I guess I could use Rule.unasync_file and loop over files. This pull request feels more general, and since I already had the code, I submitted it. Please tell me what you think.

It allows to run unasync on multiple files using multiples rules if needed, without being tied to setuptools.
@pquentin pquentin requested a review from sethmlarson May 2, 2020 17:14
@codecov
Copy link

codecov bot commented May 2, 2020

Codecov Report

Merging #58 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@ Coverage Diff @@ ## master #58 +/- ## ========================================== + Coverage 97.60% 97.63% +0.03%  ========================================== Files 2 2 Lines 125 127 +2 Branches 31 31 ========================================== + Hits 122 124 +2  Misses 1 1 Partials 2 2 
Impacted Files Coverage Δ
src/unasync/__init__.py 97.61% <100.00%> (+0.03%) ⬆️
Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this makes more sense than running Rule.unasync_files() because it's symmetrical with the build_cmdclass() interface.

Maybe we can transition the Rule interface to be private with this PR :)

@pquentin
Copy link
Member Author

pquentin commented May 2, 2020

Maybe we can transition the Rule interface to be private with this PR :)

Will open another PR for that + switch back to additional_replacements, then we can cut a release.

@pquentin pquentin merged commit 3ee4a8a into python-trio:master May 2, 2020
@pquentin pquentin deleted the unasync-files branch May 2, 2020 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants