prisma-client-py
prisma-client-py copied to clipboard
Move binaries outside of `/tmp` by default
Problem
Currently, the downloaded binaries are placed in /tmp/ on Linux. However, /tmp/ directory is cleared on boot everytime.
Suggested solution
Placing the binaries in /var/tmp/ on Linux. See Temporary folder.
Alternatives
Placing the binaries in site-packages/prisma/
Placing binaries in /var/tmp would be great for multiple projects. Also looking forward to this implementation on Macs.
The reason they're placed in /var/tmp/
is to avoid unnecessarily bloating user storage with version upgrades as the engine binaries are quite large.
I now understand that the Prisma TypeScript Client stores them in ~/.cache/prisma/
so I'm considering switching the default to match that.
I think the best solution for this is to support configuring the binaries directory through an env variable or an entry in a pyproject.toml
file, for example:
[tool.prisma]
binaries_dir = "~/.cache/prisma-binaries"
Apologies for the duplicated comments, my internet connection dropped while I was posting.
This has created issues for me when deploying to Heroku. Heroku's Python build pack doesn't copy the binaries to the production app and so it is left without the binaries. Had to go through various hoops to make it work. Would be great if I could have just sourced the binaries from site_packages
or another directory that Heroku copies by default.
Yeah this is something I'd really like to have, in terms of the direct site-packages
binaries this would be solved with #55.
A more feasible solution that could be implemented soon would be the environment variable support which would mean that you could set the environment variable to point to your site-packages
.
You can now configure the location of the binaries through either a pyproject.toml
file:
[tool.prisma]
binary_cache_dir = '.binaries'
Or through an environment variable, e.g.
PRISMA_BINARY_CACHE_DIR=".binaries"
The default location is still in a temporary directory, however I plan on changing that soon.
You can now configure the location of the binaries through either a
pyproject.toml
file:[tool.prisma] binary_cache_dir = '.binaries'
Or through an environment variable, e.g.
PRISMA_BINARY_CACHE_DIR=".binaries"
The default location is still in a temporary directory, however I plan on changing that soon.
I tried adding the custom env variable and also using the pyproject.toml
file too. But it always downloads in the /tmp
folder
@max-programming The aforementioned feature has not been released yet. You can try it out by installing from github like so:
pip install -U git+https://github.com/RobertCraigie/prisma-client-py
Thanks @RobertCraigie. Had a hard time finding out this exact command.