Re:Python Best Practices for a New Project in 2021
by inopinatus on Monday July 05, 2021 @07:38AM
(#27736871)
Most production deployment goes like this:
How much ancillary scaffolding you put around that is a matter of taste.
[ Parent
| on HN ]
Re:Python Best Practices for a New Project in 2021
by thundergolfer on Monday July 05, 2021 @08:12AM
(#27737126)
If your Python code has native code under the hood (eg. Numpy) this two-step is very much a 'step1: circle, step 2: draw the rest of owl' description of production deployment.
Re:Python Best Practices for a New Project in 2021
by Doxin on Tuesday July 06, 2021 @04:10AM
(#27745417)
If you're deploying to a server you'll want to pip install dependencies on the server. If you're using docker you'll want to pip install dependencies in your container. If you're deploying to an end users computer you'll want to use pyinstaller, which admittedly is not trivial to get working in all cases.
Re:Python Best Practices for a New Project in 2021
by gjvc on Tuesday July 06, 2021 @09:00AM
(#27747926)
This is exactly my point. .venv/ needs to live in the project deployment directory, and needs a wrapper script to use the python binary/symlink therein.
Isolate the project from the python runtime it uses, and you'll always have the right set of packages installed.
None of this is perfect, but an in-tree .venv/ and convenience scripts seems to be the least-worst option.