PythonPro #65: PyPy v7.3.19 Updates, FastRTC for AI Communication, and AutoML with mljar-supervised
Welcome to a brand new issue of PythonPro!
In today’s Expert Insight we bring you an excerpt from the book, Learn Quantum Computing with Python and IBM Quantum, Second Edition, which describes how to visualize quantum circuits using Qiskit's circuit_drawer function.
News Highlights: PyPy v7.3.19 fixes JIT bugs and introduces Python 3.11 beta, FastRTC launches for AI-driven real-time communication, Google's free Gemini-powered agent automates data analysis on Colab, and mljar-supervised automates the full ML pipeline with its new AutoML framework.
My top 5 picks from today’s learning resources:
The Secret Life of
__init__.py: Why This Tiny File Holds the Key to Python’s Magic🔑It’s About Time: An Empirical Study of Date and Time Bugs in Open-Source Python Software⏳
And, in From the Cutting Edge, we introduce evclust, a Python library that enhances traditional clustering methods by incorporating the Dempster-Shafer theory to effectively manage and represent uncertainty in cluster memberships.
Stay awesome!
Divya Anne Selvaraj
Editor-in-Chief
🐍 Python in the Tech 💻 Jungle 🌳
🗞️News
PyPy v7.3.19 released: The release primarily addresses JIT-related bug fixes and introduces a Python 3.11 beta interpreter, alongside continued support for Python 2.7 and 3.10, with plans to drop support for 3.10 in the next update.
FastRTC: The Real-Time Communication Library for Python: The library simplifies building audio and video AI applications with features like automatic voice detection, a built-in Gradio UI, and the capability to connect via phone.
Google launches free Gemini-powered Data Science Agent on its Colab Python platform: The free Gemini 2.0-powered agent will automate data analysis with AI-generated Jupyter notebooks to streamline workflows for researchers, data scientists, and developers.
AutoML Open Source Framework with Python API and GUI: The framework, mljar-supervised, automates the entire ML pipeline, including data preprocessing, feature engineering, model selection, and hyperparameter tuning.
💼Case Studies and Experiments🔬
It’s About Time: An Empirical Study of Date and Time Bugs in Open-Source Python Software: Systematically analyzes date and time computation bugs in Python projects using data from GitHub and suggests improvements in software practices.
I Uploaded a 27-Year-Old EXE File to Claude 3.7 and What Happened Next Blew My Mind: Describes an experience with Claude 3.7, which successfully analyzed and converted a Visual Basic EXE into a functional Python application using Pygame.
📊Analysis
Embedding Python in Elixir, it's Fine: Analyzes the integration of Python into Elixir through Pythonx, enhancing interoperability and functionality within Elixir's ecosystem.
A peek into a possible future of Python in the browser: Discusses breakthroughs in running Python on the web, focusing on the SPy project which seeks to compile Python-like code into WebAssembly.
🎓 Tutorials and Guides 🤓
Performing K-means Clustering with Python and Scikit-learn: Explains the concept and steps involved in K-means clustering, including choosing the number of clusters, assigning data points to the nearest cluster, updating cluster centers, and assessing convergence using the inertia metric.
The Secret Life of
__init__.py: Why This Tiny File Holds the Key to Python’s Magic: Explains the purpose and functionality of the__init__.pyfile in Python, highlighting its crucial role in treating directories as packages and organizing modules efficiently within a Python project.Controlling Ableton Live with Python: Provides step-by-step instructions for setting up MIDI in Ableton using the IAC driver, sending MIDI commands using the rtmidi library, generating melodies with Markov chains, and more.
Project Setup with Python: Covers modern practices for Python project setup, including using
pyproject.tomlfor configurations,srclayout for directory structures, virtual environments for development, and the use of requirements files for package management.Affinity Propagation with Python and Scikit-learn: Explores both theoretical aspects of the algorithm—such as how it mimics social group formation and determines cluster numbers—and practical implementation steps, including creating and running an example model.
How to deploy Python or Flask apps on Plesk: Covers installing mod_python and Phusion Passenger, updating Plesk components, configuring Python support in domain settings, adding WSGI application settings to your code, and managing Apache and Nginx settings.
Demand Forecasting with Darts: A Tutorial: Offers a comprehensive tutorial on demand forecasting using Python and Darts, focusing on the TiDE and TFT models for retail scenarios.
🔑Best Practices and Advice🔏
uv + Ray: Pain-Free Python Dependencies in Clusters: Discusses how the integration of the uv package manager with Ray enhances Python dependency management in distributed systems by enabling consistent and efficient environment setup across cluster nodes.
Modern Good Practices for Python Development: Covers code formatting, linting, type hinting, and testing primarily with pytest, alongside packaging advice and the use of data classes, enums, f-strings, and datetime objects.
Counting: How Hard Can it Be?: Explores common misunderstandings in object identity and equality, using the simple act of counting biscuits as a teaching tool.
Hello FastHTML and MonsterUI: Introduces Jeremy Howard's FastHTML and Isaac Flath's MonsterUI, Python-based tools that simplify building modern, responsive web applications with features for easy prototyping and scalability.
Python packaging: Why we can't have nice things: Strongly advises against using Pip with administrative privileges and recommends the exclusive use of wheel distributions to enhance security and reduce the risk of running unintended code.
🔍From the Cutting Edge: evclust—Python library for evidential clustering💥
In "evclust: Python library for evidential clustering," Soubeiga and Antoine present evclust, a Python library which enables evidential clustering. The approach advances traditional clustering methods by integrating the Dempster-Shafer theory to manage uncertainty in cluster memberships.
Context
Evidential clustering extends traditional clustering methods by allowing objects to belong to multiple clusters, each with varying degrees of belief quantified using mass functions. This approach leverages the Dempster-Shafer Theory, a mathematical framework designed for modeling and reasoning with uncertainty. By incorporating this theory, evclust quantifies and manages the uncertainty of cluster memberships more effectively than traditional hard or fuzzy clustering methods. The result is a Credal Partition, a structured set of mass functions that represents uncertain cluster memberships and enables a more nuanced interpretation of data. This framework is particularly valuable in applications where uncertainty or overlap between clusters is a concern, providing a robust tool for complex data analysis scenarios.
Key Features of evclust
Comprehensive Library: Includes state-of-the-art evidential clustering algorithms and tools for analysis.
Integration with Python Ecosystem: Works seamlessly with libraries like numpy, pandas, matplotlib, and scikit-learn.
Visualization and Evaluation Tools: Facilitates the understanding of credal partitions through various visual and analytical tools.
Cross-platform Compatibility: Supports Windows, macOS, and Linux operating systems.
Open Source: Available under the MIT License with ongoing community contributions on GitHub.
What This Means for You
evclust is particularly relevant for data scientists, researchers, and developers involved in data analysis and clustering where uncertainty and ambiguity are factors. It provides a robust framework for enhancing traditional clustering methods with the capability to manage and represent uncertainty effectively.
Examining the Details
The evclust library's architecture supports a variety of evidential clustering algorithms, catering to different data types and clustering complexities. The algorithms like Evidential c-Means (ECM), Relational Evidential c-Means (RECM), and Credal c-Means (CCM) extend existing clustering methodologies to handle uncertainty in data more effectively. These methods incorporate the Dempster-Shafer theory to assign belief levels to cluster memberships, offering a nuanced interpretation compared to hard or fuzzy clustering. This approach allows handling complex uncertainty patterns and better management of overlapping cluster memberships and outliers. The library's comprehensive toolset for visualizing, evaluating, and analyzing credal partitions helps in making more informed decisions based on clustering results.
You can learn more by reading the entire paper or accessing the library on GitHub.
🧠 Expert insight💥
Here’s an excerpt from “Chapter 8: Optimizing and Visualizing Quantum Circuits” in the book, Learn Quantum Computing with Python and IBM Quantum, Second Edition by Robert Loredo, published in February 2025.
Visualizing and enhancing circuit graphs
This section will focus on the various visualizations available in Qiskit. The graphs we have been using so far were from the default visualization library in Qiskit. However, we can specify other drawing tools that may be better suited for your documentation purposes. Say,
for example, that you are authoring a research paper with LaTeX and youwant to use the LaTeX content.
By simply adding style parameters from the Qiskit visualization library, you can then leverage the many features included with the visualization library. We’ll cover a few of those now to get you started.
Learning about customized visual circuits
When rendering a circuit, it is often necessary or convenient to have the results in a format that suits the format of your document. It’s here where the Qiskit circuit_drawer comes in handy with various features. Let’s begin with a simple quantum circuit to illustrate the various visual rendering examples:
First, let’s create a quantum circuit with various operators to get a good representation of all the visual components in the various formats:
# Sample quantum circuit
qc = QuantumCircuit(4)
qc.h(0)
qc.cx(0,1)
qc.barrier()
qc.cx(0,2)
qc.cx(0,3)
qc.barrier()
qc.cz(3,0)
qc.h(0)
qc.measure_all()
# Draw the circuit using the default renderer
circuit_drawer(qc, output='mpl')
This will render the following circuit drawing, which is just a random representation of gates. This circuit does not do anything special; it’s just used to represent various components. As an option, you can use the random_circuit method to create a random circuit:
Figure 8.17: Circuit rendering using the default library
Next, we will render the preceding circuit using
latex:
circuit_drawer(qc, output='latex')
This will render the latex version of the circuit:
If you’re running this on your local machine and not on the platform, you may have some warnings or errors indicating you need to install some file dependencies, such as installing pylatexenc . To install this library you will need to run pip install pylatexenc in a cell first, and then restart the kernel.
Figure 8.18: Circuit rendering using the latex library
If you are planning to post your circuit onto a website, blog, or social media and would like to include some styles on the image, you can do that as well by passing in the style contents as a parameter, such as
backgroundcolor,gatetextcolor, andfontsize, just to name a few:
# Define the style to render the circuit and components
style = {'backgroundcolor': 'lightblue','gatefacecolor': 'white', 'gatetextcolor': 'black', 'fontsize': 9}
# Draw the mpl with the specified style
circuit_drawer(qc, style=style, output='mpl')
The preceding code results in adjusting the background, gate color schemes, and font size, as illustrated here:
Figure 8.19: Rendered circuit with the custom style dictionary on matplotlib
To use the style setting, you must use the output matplotlib as this is the only library that supports the styles.
Note:
Details on the available list of styles can be found in the Style Dict Details section of the Qiskit API documentation (https://docs.quantum-computing.ibm.com/api/qiskit/qiskit.visualization.circuit_drawer).
Learn Quantum Computing with Python and IBM Quantum, Second Edition was published in February 2025. Packt library subscribers can continue reading the entire book for free.
Get the eBook for $35.99 $24.99
And that’s a wrap.
We have an entire range of newsletters with focused content for tech pros. Subscribe to the ones you find the most useful here. The complete PythonPro archives can be found here.
If you have any suggestions or feedback, or would like us to find you a Python learning resource on a particular subject, just respond to this email!









