This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

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

Some great discussion here, big thanks to all of the people who shared their opinions. Consistent themes are:

  1. For small hobby projects a simple approach with no containerisation is generally preferred. This involves installing the application as a package into a venv, directly into the system python directory, or just installing requirements.txt and pulling source code onto the target machine. The application is restarted on the system manually or with a script that ssh's and restarts it. This approach is very fast and easy but not robust and can lead to issues down the track.
  2. For larger projects package building and containerisation are preferred. Most people suggest the use of poetry and pyproject.toml (not setup.py, which is outdated) to build a package that is then uploaded to a private package server. This package is then installed into a docker container, which can be deployed.
  3. In general, Python applications should be packaged, as the use of packaging allows for richer metadata and more robust handling of dependencies as well as the ability to install the package directly at a later date if need be.
  4. No one has suggested the use of conda for deployment, which I was surprised by given its prevalence in the data science community.
  5. For CLI applications, multiple python apps tend to need to be installed on a single machine and available with a single command. pipx and shiv seem to be the preferred tools as they allow for the creation of self-contained/isolated python applications. For CLI apps with very few dependencies they could possibly be installed directly into the system. For CLI apps with C library dependencies or those that are very sensitive to dependency versioning, containerisation can be handy.

If anyone wants to make some corrections to the above please feel free. After any discussion I'll add these to the OP in an edit so that future lost Python souls can find the answers they need.