The Real Python Podcast· Folge 222

Using Virtual Environments in Docker & Comparing Python Dev Tools

Freitag, 27. September 2024 · 56 min

MP3

Shownotes

<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="realpython.com/courses/advanced-import-techniq… 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="docs.python.org/release/3.12.6/whatsnew/change… Releases 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20</a></li>
<li><a href="python.org/downloads/release/python-3130rc2/&q… Release Python 3.13.0rc2</a></li>
<li><a href="djangoproject.com/weblog/2024/sep/03/security-… Security Releases Issued: 5.1.1, 5.0.9, and 4.2.16</a></li>
</ul>
<p>Show Links:</p>
<ul>
<li><a href="pola.rs/posts/lightweight_plotting/">P… 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="hynek.me/articles/docker-virtualenv/">… 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="realpython.com/numpy-where-conditional-express… 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="cosimameyer.com/post/2024-09-05-pythonistr-a-m…: 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="buttondown.com/hillelwayne/archive/why-not-com… 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="realpython.com/tutorials/editors/">Edi… & IDEs – Real Python</a></li>
<li><a href="code.visualstudio.com/">Visual Studio Code - Code Editing. Redefined</a></li>
<li><a href="jupyter.org/">Project Jupyter - Home</a></li>
<li><a href="vim.org/">vim online: welcome home</a></li>
<li><a href="iterm2.com/">iTerm2 - macOS Terminal Replacement</a></li>
</ul>
<p>Projects:</p>
<ul>
<li><a href="github.com/LucaCappelletti94/csv_trimming"…: Remove Common Ugliness From CSV Files</a></li>
<li><a href="github.com/jieter/django-tables2">djan…: Create HTML Tables in Django</a></li>
</ul>
<p>Additional Links:</p>
<ul>
<li><a href="hynek.me/articles/virtualenv-lives/">v… Lives! - Hynek Schlawack - 2014</a></li>
<li><a href="hynek.me/articles/docker-uv/">Producti… Python Docker Containers with uv - Hynek Schlawack</a></li>
<li><a href="github.com/cosimameyer/r-python-talk">…: 🦸🏼‍♀️ Contains material for talk on how to use Python and R together</a></li>
<li><a href="posit.co/downloads/">Download RStudio - Posit</a></li>
<li><a href="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="realpython.com/courses/using-jupyter-notebooks… Jupyter Notebooks</a></li>
<li><a href="realpython.com/courses/absolute-vs-relative-im… vs Relative Imports in Python</a></li>
<li><a href="realpython.com/courses/advanced-import-techniq… Python import Techniques</a></li>
</ul> <p><a rel="payment" href="realpython.com/join">Support the podcast & join our community of Pythonistas</a></p>

0:00 / 0:00