
Episode 222
Using Virtual Environments in Docker & Comparing Python Dev Tools
The Real Python Podcast Β· Real Python
September 27, 202455m 46s
Audio is streamed directly from the publisher (dts.podtrac.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.
Show Notes
<p>Should you use a Python virtual environment in a Docker container? What are the advantages of using the same development practices locally and inside a container? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder’s Weekly articles and projects.</p>
<p>We share a recent post by Hynek Schlawack about building Python projects using Docker containers. Hynek argues for using virtual environments for these projects, like developing a local one. He’s found that keeping your code in an isolated, well-defined location and structure avoids confusion and complexity.</p>
<p>We also discuss our development setups, including Python versions, code editors, virtual environment practices, terminals, and customizations. We dig into how your programming history affects the tools you use.</p>
<p>We share several other articles and projects from the Python community, including a group of new releases, addressing the “why” in comments, comparing a data science workflow in Python and R, removing common problems from CSV files, and a project for creating HTML tables in Django.</p>
<p>This episode is sponsored by InfluxData. </p>
<div class="alert alert-primary" role="alert">
<p><strong>Course Spotlight:</strong> <a href="https://realpython.com/courses/advanced-import-techniques/">Advanced Python import Techniques</a> </p>
<p>The Python import system is as powerful as it is useful. In this in-depth video course, you’ll learn how to harness this power to improve the structure and maintainability of your code.</p>
</div>
<p>Topics:</p>
<ul>
<li>00:00:00 – Introduction</li>
<li>00:02:55 – Python Releases 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20</li>
<li>00:03:26 – Python Release Python 3.13.0rc2</li>
<li>00:04:07 – Django Security Releases Issued: 5.1.1, 5.0.9, and 4.2.16</li>
<li>00:04:36 – Polars Has a New Lightweight Plotting Backend</li>
<li>00:05:49 – Why I Still Use Python Virtual Environments in Docker</li>
<li>00:11:37 – How to Use Conditional Expressions With NumPy <code>where()</code></li>
<li>00:15:55 – Sponsor: InfluxData</li>
<li>00:16:39 – PythonistR: A Match Made in Data Heaven</li>
<li>00:23:44 – Why Not Comments</li>
<li>00:26:48 – Video Course Spotlight</li>
<li>00:28:10 – Discussion: Personal development setups</li>
<li>00:51:01 – csv_trimming: Remove Common Ugliness From CSV Files</li>
<li>00:53:01 – django-tables2: Create HTML Tables in Django</li>
<li>00:54:39 – Thanks and goodbye</li>
</ul>
<p>News:</p>
<ul>
<li><a href="https://docs.python.org/release/3.12.6/whatsnew/changelog.html">Python Releases 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20</a></li>
<li><a href="https://www.python.org/downloads/release/python-3130rc2/">Python Release Python 3.13.0rc2</a></li>
<li><a href="https://www.djangoproject.com/weblog/2024/sep/03/security-releases/">Django Security Releases Issued: 5.1.1, 5.0.9, and 4.2.16</a></li>
</ul>
<p>Show Links:</p>
<ul>
<li><a href="https://pola.rs/posts/lightweight_plotting/">Polars Has a New Lightweight Plotting Backend</a> – Polars 1.6 allows you to natively create beautiful plots without pandas, NumPy, or PyArrow. This is enabled by Narwhals, a lightweight compatibility layer between dataframe libraries.</li>
<li><a href="https://hynek.me/articles/docker-virtualenv/">Why I Still Use Python Virtual Environments in Docker</a> – Hynek often gets challenged when he suggests the use of virtual environments within Docker containers, and this post explains why he still does.</li>
<li><a href="https://realpython.com/numpy-where-conditional-expressions/">How to Use Conditional Expressions With NumPy <code>where()</code></a> – This tutorial teaches you how to use the where() function to select elements from your NumPy arrays based on a condition. You’ll learn how to perform various operations on those elements and even replace them with elements from a separate array or arrays.</li>
<li><a href="https://cosimameyer.com/post/2024-09-05-pythonistr-a-match-made-in-data-heaven/">PythonistR: A Match Made in Data Heaven</a> – In data science you’ll sometimes hear a debate between R and Python. Cosima says ‘why not choose both?’ She outlines a data pipeline that uses the best tool for each job.</li>
<li><a href="https://buttondown.com/hillelwayne/archive/why-not-comments/">Why Not Comments</a> – This post talks about why you might want to include information in your code comments about why you didn’t take a particular approach.</li>
</ul>
<p>Discussion:</p>
<ul>
<li><a href="https://realpython.com/tutorials/editors/">Editors & IDEs β Real Python</a></li>
<li><a href="https://code.visualstudio.com/">Visual Studio Code - Code Editing. Redefined</a></li>
<li><a href="https://jupyter.org/">Project Jupyter - Home</a></li>
<li><a href="https://www.vim.org/">vim online: welcome home</a></li>
<li><a href="https://iterm2.com/">iTerm2 - macOS Terminal Replacement</a></li>
</ul>
<p>Projects:</p>
<ul>
<li><a href="https://github.com/LucaCappelletti94/csv_trimming">csv_trimming: Remove Common Ugliness From CSV Files</a></li>
<li><a href="https://github.com/jieter/django-tables2">django-tables2: Create HTML Tables in Django</a></li>
</ul>
<p>Additional Links:</p>
<ul>
<li><a href="https://hynek.me/articles/virtualenv-lives/">virtualenv Lives! - Hynek Schlawack - 2014</a></li>
<li><a href="https://hynek.me/articles/docker-uv/">Production-ready Python Docker Containers with uv - Hynek Schlawack</a></li>
<li><a href="https://github.com/cosimameyer/r-python-talk">r-python-talk: π¦ΈπΌββοΈ Contains material for talk on how to use Python and R together</a></li>
<li><a href="https://posit.co/downloads/">Download RStudio - Posit</a></li>
<li><a href="https://leanpub.com/logic/">Logic for Programmers by Hillel Wayne - Leanpub</a></li>
</ul>
<p>Level up your Python skills with our expert-led courses:</p>
<ul>
<li><a href="https://realpython.com/courses/using-jupyter-notebooks/">Using Jupyter Notebooks</a></li>
<li><a href="https://realpython.com/courses/absolute-vs-relative-imports-python/">Absolute vs Relative Imports in Python</a></li>
<li><a href="https://realpython.com/courses/advanced-import-techniques/">Advanced Python import Techniques</a></li>
</ul> <p><a rel="payment" href="https://realpython.com/join">Support the podcast & join our community of Pythonistas</a></p>