Skip to content

Commit d6c9025

Browse files
committed
Add some notes about site-packages/gel.pth.
1 parent fc5f1ac commit d6c9025

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

gel/_internal/arch.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,46 @@ incompatibility. Expected 152 from C header, got 184 from PyObject
171171

172172
Indicate that a `pyx` file has changed. A clean rebuild is necessary.
173173

174+
175+
#### Fix `site-packages/gel.pth` to resolve wall of mypy test errors
176+
177+
A large number of mypy errors such as:
178+
```
179+
RuntimeError: mypy check failed for test_modelgen_operators_integer_arithmetic
180+
181+
test code:
182+
...
183+
184+
mypy stdout:
185+
models/__shapes__/std/net/__init__.py:14: error: Cannot find implementation or library stub for module named "gel.models.pydantic" [import-not-found]
186+
models/__shapes__/std/net/__init__.py:17: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
187+
models/__shapes__/std/net/__init__.py:22: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
188+
models/__shapes__/std/enc.py:14: error: Cannot find implementation or library stub for module named "gel.models.pydantic" [import-not-found]
189+
models/__shapes__/std/enc.py:17: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
190+
models/__shapes__/sys/__init__.py:20: error: Cannot find implementation or library stub for module named "gel.models.pydantic" [import-not-found]
191+
models/__shapes__/sys/__init__.py:53: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
192+
models/__shapes__/sys/__init__.py:60: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
193+
models/__shapes__/sys/__init__.py:65: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
194+
models/__shapes__/sys/__init__.py:70: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
195+
models/__shapes__/sys/__init__.py:75: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
196+
models/__shapes__/sys/__init__.py:80: error: Class cannot subclass "AnyEnum" (has type "Any") [misc]
197+
```
198+
199+
Indicates the `site-packages/gel.pth` file is not set up correctly.
200+
Possible causes include:
201+
- missing the prerequisite step
202+
- changing the project directory name
203+
- etc.
204+
205+
For a better understanding of why this error occurs, look at in `_testbase.py`
206+
for the functions `BaseModelTestCase.setUpClass()` and `_typecheck`. A test
207+
class annotated with `@tb.typecheck` will:
208+
- set up a temp directory with the pydantic model.
209+
- create a copy of test function in a dummy class
210+
- run mypy on this file in a subprocess
211+
- check the result code
212+
213+
174214
#### Other errors
175215

176216
Some other errors that are caused by a weird environment, but more details are

0 commit comments

Comments
 (0)