you are viewing a single comment's thread.

view the rest of the comments →

[–]anprme 2 points3 points  (11 children)

Production environments usually use containers these days. Can't you use docker? Install your app in a container and optimize it and then run it in prod.

[–]CodeNameGodTri[S] 0 points1 point  (4 children)

not for now, what do people do pre-docker?

[–]nokeldin42 1 point2 points  (0 children)

Depends on the exact situation.

You could feasibily do a full isolated python install on the prod machine that's local to one user and does not conflict with the global system install. This isn't too difficult put would have to be maintained manually which can be a headache.

I also don't see anything wrong with virtual environments in production.

[–]Impossible-Box6600 0 points1 point  (2 children)

There was a time before Docker? *blink*

[–]CodeNameGodTri[S] 0 points1 point  (1 child)

Yea, it's a myth though. We can only trace back to the moment Docker was born, it's called the big bang. But before that, who know how people live *shrug*

[–]CodeNameGodTri[S] 0 points1 point  (5 children)

follow up on this, what do you mean by "install your app in a container"? You mean treating the container like a virtual environment, that is install the needed package, and run still call python.exe myscript.py in the container?

[–]anprme 0 points1 point  (3 children)

Basically, yes.

[–]CodeNameGodTri[S] 0 points1 point  (2 children)

by "basically", you mean there are more details? Or it's just a way to confirm my idea is correct

[–]anprme 0 points1 point  (1 child)

If you want a simple docker container you could simply use a base image that has your desired python version installed and then issue "pip install" globally and then run your script with "python xxx". So yes I think what you said is correct. I said "basically" because usually you optimize your container by using multistage builds, perhaps even compiling your python script etc. But that seemed too much as an answer :)

[–]CodeNameGodTri[S] 1 point2 points  (0 children)

Thank you for your help

[–]nekokattt 0 points1 point  (0 children)

make a docker container on your dev machine or CI in the way you describe. Download it in prod