Skip to content

Commit e0d7bfd

Browse files
committed
update contributing guide
1 parent d126199 commit e0d7bfd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@ you are attempting to validate new spec tests in PyMongo.
246246

247247
Follow the [Python Driver Release Process Wiki](https://wiki.corp.mongodb.com/display/DRIVERS/Python+Driver+Release+Process).
248248

249+
## Asyncio considerations
250+
251+
PyMongo adds asyncio capability by modifying the source files in `*/asynchronous` to `*/synchronous` using
252+
[unasync](https://github.com/python-trio/unasync/) and some custom transforms.
253+
254+
Where possible, edit the code in `*/asynchronous/*.py` and not the synchronous files.
255+
You can run `pre-commit run --all-files synchro` before running tests if you are testing synchronous code.
256+
257+
To prevent the `synchro` hook from accidentally overwriting code, it first checks to see whether a sync version
258+
of a file is changing and not its async counterpart, and will fail.
259+
In the unlikely scenario that you want to override this behavior, first export `OVERRIDE_SYNCHRO_CHECK=1`.
260+
249261
## Converting a test to async
250262
The `tools/convert_test_to_async.py` script takes in an existing synchronous test file and outputs a
251263
partially-converted asynchronous version of the same name to the `test/asynchronous` directory.

0 commit comments

Comments
 (0)