Reproduce / patch RobertCraigie/prisma-client-py#50
Install poetry and poethepoet, or refer to the pyproject.toml file for commands/dependencies.
poetry install
To get back to a clean state after generating models, run poe clean
poe generate
produces the client at prisma_repro/client
using the generate_partials_patch
module
Import the prisma module with
poe run
poe reproduce
Imports the models directly and reproduces the error.
- The
partials.py
file needs to exist in order for the partial generator to import the partially-generated client package. This is because when the partial generator executes, theclient
andfields
modules have been generated, but not thepartials
module (ref).from . import x
produces anImportError
, not aModuleNotFoundError
as produced by a missingfrom .client import *
, so the catch block doesn't handle this case. - The client package has its own copy of
partial_models_ctx
and generates partials to that, so the site-packages prisma generator needs to pull from the same one. From within the partial generator, we can patch the context on the models module so they are generated to the correct location.