Skip to content

Commit ef09fdd

Browse files
authored
PYTHON-5889 - Clean up AGENTS.md instructions (mongodb#2909)
1 parent 1ccf555 commit ef09fdd

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

AGENTS.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Official Python driver for MongoDB.
55

66
## Tech Stack
7-
- **Build/env:** `hatch` — use `hatch run test:test` and `hatch run test:test-async`, not `pytest` directly
87
- **Task runner:** `just` (Justfile at repo root)
98
- **Linter/formatter:** `ruff` via pre-commit
109
- **Type checker:** `mypy` (strict)
@@ -13,37 +12,31 @@ Official Python driver for MongoDB.
1312
> **Never** run `pip install bson`. PyMongo ships its own `bson`; the PyPI `bson` package silently breaks things.
1413
1514
## Project Structure
16-
- `pymongo/synchronous/`sync driver (MongoClient, Collection, Database, etc.) generated from `pymongo/asynchronous/` using unasync
17-
- `pymongo/asynchronous/`async API, mirrors `pymongo/synchronous/`
15+
- `pymongo/asynchronous/`async driver (AsyncMongoClient, AsyncCollection, etc.)
16+
- `pymongo/synchronous/`sync driver (MongoClient, Collection, etc.) generated from `pymongo/asynchronous/` using `just synchro`
1817
- `bson/` — BSON implementation
1918
- `gridfs/` — GridFS API
20-
- `test/`sync test suite
21-
- `test/asynchronous/`async test suite, mirrors `test/`
19+
- `test/asynchronous/`async test suite
20+
- `test/`sync test suite (generated from `test/asynchronous/` by `just synchro`) and shared test suite
2221
- `test/unified_format/` — cross-driver spec tests (Unified Test Format)
23-
- `tools/convert_test_to_async.py` — generates async test stubs from sync tests
22+
23+
Do not edit files in `pymongo/synchronous/` or mirrored files in `test/` directly: they are generated by `just synchro` from `pymongo/asynchronous/` and `test/asynchronous/`.
24+
A file in `test/` is mirrored if a file of the same name exists in `test/asynchronous/`.
2425

2526
## Commands
2627
```bash
27-
just install # set up venv + pre-commit hook
28-
just typing-mypy # type check
29-
just run lint-manual # ruff linter
30-
31-
hatch run test:test # run sync tests
32-
hatch run test:test-async # run async tests
33-
34-
MONGODB_VERSION=8.0 just run-server # start a local MongoDB server
28+
just install # set up venv + pre-commit hooks
29+
just typing # type check
30+
just lint-manual # pre-commit linting and synchro
31+
just synchro # generate synchronous driver and mirrored tests
32+
just test # run all tests
33+
just test test/asynchronous # run async tests
34+
MONGODB_VERSION=8.0 just run-server # start a local MongoDB 8.0 server
3535
```
3636

3737
## Testing
3838
Tests require a live MongoDB server (`just run-server` above).
3939

40-
Never modify pymongo/synchronous code first; update the async counterpart and run our `tools/synchro.py` script:
41-
1. Make changes in `pymongo/asynchronous` or top-level `pymongo/` files and `test/`.
42-
2. Run `tools/convert_test_to_async.py` on the sync test file to generate a starting-point async version.
43-
3. Manually complete the async version in `test/asynchronous/`.
44-
45-
Do not edit files in `pymongo/synchronous/` or mirrored files in `test/` directly — they are auto-generated by `tools/synchro.py` from `pymongo/asynchronous/` and `test/asynchronous/`. Only edit them if the change includes a `_IS_SYNC` statement.
46-
4740
Async functions must not call blocking I/O.
4841

4942
New features need integration tests. Bug fixes need regression tests.

justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ lint *args="": && resync
6464
lint-manual *args="": && resync
6565
uvx pre-commit run --all-files --hook-stage manual {{args}}
6666

67+
# Run synchro
68+
[group('lint')]
69+
synchro: && resync
70+
uvx pre-commit run --all-files synchro
71+
6772
# Run pytest (e.g. just test test/test_uri_parser.py)
6873
[group('test')]
6974
test *args="-v --durations=5 --maxfail=10": && resync

0 commit comments

Comments
 (0)