realpython / python-guide

Python best practices guidebook, written for humans.
https://docs.python-guide.org
Other
28.43k stars 5.83k forks source link

A docker section for python? #1084

Open JaredCE opened 4 years ago

JaredCE commented 4 years ago

I came here as I was looking for similar to: Node.js Best Practices but for Python and github surfaced this in the search results.

I notice this Guide lacks a Docker section. Is this something that could be incorporated?

AcmeNuclear commented 3 years ago

@JaredCE - I agree that mentioning (at a minimum) the use of Docker for handling one's virtual environments for Python development is a great idea. I recently switched over from using Conda (and sometimes venv) for maintaining my Python virtual environments to now using a Docker based solution.

I tried this a few years back and it was not quite ready for mainstream (or perhaps I was not). Now I currently run my development environments (on a Windows machine) using the interconnected - WSL2 (Ubuntu 20.04), Docker Desktop for Windows, Git Bash, and VS Code with the Remote Containers plugin (and Remote WSL). While this sounds more complex on the surface, I was able to get it set up and had a container pop out "Hello World!" in under 10 minutes (I must credit the good instructions provided on YouTube - add YouTuber handle here). I did have almost all of the individual pieces already installed on my machine, but the message is still the same - setup was simple.

I understand if the Python-guide only makes mention of this option and perhaps points to guidance for those interested, as this is more an exercise in using WSL2, Docker D4W, and VS Code than using a Python feature. However, the end result allows me to be much more productive in my Python development work and my virtual environment organization has improved greatly.

I still have to maintain the use of Conda and/or venv though. I am not permitted to use Docker in my work (employment) environment. Waiting patiently for that change. I am a lifetime hobby programmer with current employment that provides opportunities to do minimal coding.

Cheers!