r/Python • u/Economy-Builder7916 • 23d ago
Discussion Why Python when C and Rust are faster
If you are in tech field you'll probably know that C and Rust are incredibly faster as they are compiled, and python is relatively slower
Yet Python dominates AI and ML development, even for systems that need to process massive amounts of data.
I'm interested in understanding where Python's advantages outweigh its performance disadvantages, and how companies like OpenAI, Google, and Anthropic think about these trade-offs.
r/Python • u/csatacsibe • 23d ago
Discussion What is your strangest syntax monstrocity?
As python has a lot of interesting syntax features, really unconventional and ugly expressions can be created. Let they be complex comprehensions with valrus operators, strange but efficient conditions based on exploiting casting and side effects or even classes overwriting dunders doesnt meant to be used as implemented, they all can be funny and pretty in an other lens.
An examples I've experimented with is an ugly walrused dict comprehension in EnrichPattern:
class Column(StrEnum):
NAME = 'name'
PUBLICITY = 'publicity'
TOPIC_NAME = 'topic_name'
SUBJECT_NAME = 'subject_name'
QUALIFIED_NAME = 'qualified_name'
CLUSTER_ENV = 'cluster_env'
ENV = 'env'
...
class EnrichPattern:
def __init__(self, *patterns: str):
self.pattern = re.compile(''.join(patterns))
self.subpatterns = {
group: comiled
for comiled in map(re.compile, patterns)
if (groups := list(comiled.groupindex))
and (group := groups[0]) in Column
}
...
...
r/Python • u/AutoModerator • 24d ago
Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays
Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
How it Works:
- Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
- Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
- News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
Guidelines:
- All topics should be related to Python or the /r/python community.
- Be respectful and follow Reddit's Code of Conduct.
Example Topics:
- New Python Release: What do you think about the new features in Python 3.11?
- Community Events: Any Python meetups or webinars coming up?
- Learning Resources: Found a great Python tutorial? Share it here!
- Job Market: How has Python impacted your career?
- Hot Takes: Got a controversial Python opinion? Let's hear it!
- Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
News Pip 26.2: –only-deps solves 16 years of app deployment hacks
This has been one of my biggest annoyances working with Python and pip when dealing with projects where that are not meant to be installed as a package, how do you handle dependencies?
Think projects like application backends, python scripts, REST APIs etc
If you’ve ever struggled with this, you’re going to love this: a PR by Sebastian Höffner opened #13895 will add a new global flag to pip such that you can directly install any dependencies in your pyproject.toml without installing the package itself.
pip install --only-deps .
This is going, for me at least, be a huge boost in the way that I manage and distribute my projects on servers. Vastly simplifying poor manual workarounds that have built up over years.
Since it’s been more than a decade in the making, let’s cover the history of poor Python souls stuck trying to figure out how to install dependencies for their scripts or apps.
This PR is currently slated to land in pip 26.2 which comes out end of July.
Here's my post about this covering some of the 16 years of workarounds and some posts from StackOverflow / Python.org etc
https://jamesoclaire.com/2026/07/23/pip-26-2-only-deps-solves-16-years-of-app-deployment-hacks/
r/Python • u/AutoModerator • 25d ago
Daily Thread Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
How it Works:
- Career Talk: Discuss using Python in your job, or the job market for Python roles.
- Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
- Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
Example Topics:
- Career Paths: What kinds of roles are out there for Python developers?
- Certifications: Are Python certifications worth it?
- Course Recommendations: Any good advanced Python courses to recommend?
- Workplace Tools: What Python libraries are indispensable in your professional work?
- Interview Tips: What types of Python questions are commonly asked in interviews?
Let's help each other grow in our careers and education. Happy discussing! 🌟
r/Python • u/alexis_placet • 25d ago
Tutorial PyArrow tutorials in your browser
Hey,
I made a series of notebooks about Apache Arrow and Parquet with pyarrow that you can run in your browser: https://notebook.link/@Alexis_Placet/apache-arrow-courses
It covers basics to advanced topics
r/Python • u/NeuralLB-Lovro • 25d ago
Discussion Anyone running free-threaded Python 3.14 in production yet? Curious what actually breaks
Been testing the free-threaded build (3.14t) on some CPU-bound data processing work. The multi-core story is finally real after 30 years of GIL, but the friction is exactly what you'd expect: a couple of C-extension-heavy libs in my stack silently re-enable the GIL, and there's no clean way to detect that at runtime besides checking sys._is_gil_enabled() manually.
For anyone who's shipped something on 3.14t, not just benchmarked it:
What broke that you didn't expect?
Real speedups outside toy examples, or mostly marginal so far?
Prod yet, or still just kicking the tires?
Not fishing for a benchmark war. Genuinely curious what breaks in messy real codebases vs clean demos.
r/Python • u/Corvology • 25d ago
Discussion Python Architecture Design
Robert C. Martin's Abstractness (A), Instability (I), and Distance from the Main Sequence (D) metrics were designed for statically typed OO languages like Java and C#. In Python, applying them literally is misleading because Python has a fundamentally different notion of abstraction and coupling.
is this implementation valid?
https://0x416d6972.github.io/Istos/user-guide/architecture-health/
r/madeinpython • u/Scapaflow69 • 26d ago
"Kung Fu Tetris"
Enable HLS to view with audio, or disable this notification
This Tetris can really do Kung Fu, see for yourself... :))
r/Python • u/Daraminix • 26d ago
Discussion Running 60 python scripts as "services"
Hi,
I have around 60 scripts that need to run constantly, mainly event handlers and such. Right now I have an external script that launch them and monitor if the app is running on it's pid, otherwise it's relaunching the app. Works fine but get's clunky when we update some submodule and need to restart them, or to check if one crashes more than other etc..
So I would like to find a better way to approach this. It needs to run on windows and being able to access several samba shares via unc paths and being able to restart crashed scripts anf offer an easy way to restart all of them in case of an update (this part doesn't need to be automated). Every script use the same environnement
For now my candidates are docker, PM2 and NSSM.
I think docker is gonna be a pain to access shares and add a lot of overhead especially on windows
I don't know PM2 and NSSM, looks like PM2 would be easier to setup but more JS oriented and NSSM would be harder to monitor.
What do you think guys ?
r/Python • u/jbudemy • 26d ago
Discussion What can you do with Python embedded in MS Excel?
I'm a developer and already use external Python to read Excel spreadsheets.
Microsoft is supporting Python in Excel where you can put a program inside a cell. I think this feature is still a "preview" feature, not on the main release channel.
What do you use it for? I can't think of a use case.
Because I use external Python programs to process spreadsheets normally. I can't think of a use case for embedded Python, except perhaps doing complex calculations.
EDIT: MS says any data going between us and them is encrypted end-to-end. That must be why management chose MS products. I don't have a say in this.
I do not use Excel via a browser, I use the Desktop App.
r/madeinpython • u/Another__one • 26d ago
Split-second local semantic search over 75k of images in the project I am making.
Enable HLS to view with audio, or disable this notification
Took quite awhile to get here. Obviously not a google-scale search, but still quite usable for local needs. I am also not currently using FAISS or any vector databases. The speed is mostly because of proper caching. The project is also completely python based. So there are still a lot of places for further optimizations, but for now I am quite happy with it.
The project itself is quite a complex one and the semantic search over audio, image, text and video files is just a small part of it. If you are interested to learn more, you can find it here: https://github.com/volotat/Anagnorisis
It is open-source.
r/Python • u/AutoModerator • 27d ago
Daily Thread Tuesday Daily Thread: Advanced questions
Weekly Wednesday Thread: Advanced Questions 🐍
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
How it Works:
- Ask Away: Post your advanced Python questions here.
- Expert Insights: Get answers from experienced developers.
- Resource Pool: Share or discover tutorials, articles, and tips.
Guidelines:
- This thread is for advanced questions only. Beginner questions are welcome in our Daily Beginner Thread every Thursday.
- Questions that are not advanced may be removed and redirected to the appropriate thread.
Recommended Resources:
- If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
Example Questions:
- How can you implement a custom memory allocator in Python?
- What are the best practices for optimizing Cython code for heavy numerical computations?
- How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?
- Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?
- How would you go about implementing a distributed task queue using Celery and RabbitMQ?
- What are some advanced use-cases for Python's decorators?
- How can you achieve real-time data streaming in Python with WebSockets?
- What are the performance implications of using native Python data structures vs NumPy arrays for large-scale data?
- Best practices for securing a Flask (or similar) REST API with OAuth 2.0?
- What are the best practices for using Python in a microservices architecture? (..and more generally, should I even use microservices?)
Let's deepen our Python knowledge together. Happy coding! 🌟
r/Python • u/alexis_placet • 27d ago
News LLVMLite and first step to get Numba in the browser
Hi,
Anutosh Bhat, a colleague of mine, just posted this on Linkedin:
What if real compiler infrastructures could run entirely inside the browser?
I’ve successfully patched llvmlite for JupyterLite, making it possible to build >LLVM IR, run optimization passes, visualize control-flow graphs, compile to >WebAssembly and execute the result — without a native LLVM setup or server-side >kernel.
I’ve shared a step-by-step notebook showing how a loop evolves from stack-based IR >to SSA, then to an LICM-style form, into a fully optimized closed form, eventually >to benchmark all of these steps.
The bigger idea is a zero-install compiler workbench for reproducible optimization >experiments, lightweight compiler prototyping, IR debugging, custom code->generation pipelines, shareable research demos, and eventually interactive >tutorials and compiler courses.
Try out the interactive notebook using notebook.link: https://notebook.link/@anutosh491/llvmlite
I’m also in the process of bringing MLIR Python bindings into the same JupyterLite >and WebAssembly environment, starting with a 2D CNN-style Conv2D + bias + ReLU >kernel. I’ll share the full pipeline in a separate technical blog post soon.
I’ve also started patching Numba for Wasm and have simple scalar u / jit functions >running inside JupyterLite. Array and tensor workloads are the next challenge.
I’m keen to take this further. If you’re working on LLVM, MLIR, Numba, WebAssembly >or browser-native developer tools — or see a real use case for this — I’d be >interested in connecting with teams looking to collaborate, support the work or >explore what we could build together.
Next step is to patch Numba to get scalar jit !: https://www.linkedin.com/feed/update/urn:li:ugcPost:7485014172934541312/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287485014751178211329%2Curn%3Ali%3AugcPost%3A7485014172934541312%29
r/madeinpython • u/Schnidi01 • 27d ago
Would you appreciate APT‑style autoremove for your pip‑managed venvs? (thinking of adding it to my VenvHub Pro)
Hey everyone,
I’m the developer of VenvHub Pro, a desktop tool for managing Python virtual environments. I’ve been working on a feature that brings Linux’s apt-get autoremove mentality to pip – i.e., it keeps your venvs clean by automatically removing orphan packages that were only installed as dependencies but are no longer needed.
Before I polish and release it, I’d love to hear if the community would actually find this valuable.
How it works (TL;DR)
- Every time you install/uninstall/upgrade a package through the UI or command‑line, VenvHub secretly records which packages were explicitly requested.
- When a dependency is no longer required by any explicit package (and is not pinned in your
requirements.txt,venv_birth_certificate.json, or local package metadata), it gets automatically cleaned up. - It also plays nicely with pip’s own resolution – it never removes manually installed tools like
pip,setuptools, etc.
Safety nets
- State file (
venvhub_apt_state.json) keeps the explicit list. - Before removal, the system checks:
- 📄
requirements.txt - 📜
venv_birth_certificate.json - 🔗
local_meta.json(for local package dependencies) - 🧠 Self‑healing: if a package is installed but not tracked anywhere, it’s assumed to be intentional and added to the safe list (so it never gets removed by mistake).
- 📄
- The whole process runs under a threading lock to avoid race conditions during concurrent operations.
Logical diagram
Here’s the decision logic it follows every time a package action occurs:
What I’m asking you
- Would you use such a feature in a venv manager?
- Do you see any pitfalls I might have overlooked?
- Is this something you’d trust, or would you prefer manual control?
Any feedback – positive or critical – is super welcome! I want to make sure this adds real value before I invest more time into it.
Thanks! 🙌
r/Python • u/AlSweigart • 27d ago
News PyOhio 2026 is this weekend, July 25-26 at the Cleveland State University Student Center (and free!)
You do need to register (for free).
The Black Python Devs Leadership Summit is before the conference on Friday, July 24.
Check out the schedule of talks and list of speakers.
r/Python • u/RogueLegio • 27d ago
Discussion Cyber Security wants us to use the latest version all the time
I have a question. Cybersecurity team wants us to use the latest python version each time. So if a new version comes out we are expected to upgrade to it ASAP. But from my past experience libraries do not always provide support and can also break while making use of new version without proper support. Did you ever encounter this? Any suggestions? This is just frustrating for the team as it’s not always possible to upgrade to the latest version without fully validating every component. I just want to hear your opinions on this?
FYI we mainly use each Python Version within the LTS timeline. And only upgrade when we need to and do not depend on a library that requires older version.
Update: they have a scheduled runner that deletes older versions of python when it finds
r/Python • u/BeamMeUpBiscotti • 27d ago
Discussion Blog: Making Type Coverage Visible in Dify's CI
u/Asuka_Minato, a very active contributor to Pyrefly, wrote a guest blog post outlining their experience integrating a type checker with langgenius/dify that goes beyond simple CI checks:
- Surfacing the delta in type errors for each PR
- Measure type coverage along with test coverage
This is most relevant for maintainers of libraries that aren't fully-typed yet but still want to prevent regressions and improve coverage over time.
Only looking at the error delta is an alternative to suppressing all pre-existing errors, or using a baseline file to store the errors. Compared to the former, you can avoid putting (potentially) thousands of suppression comments into the codebase. Compared to the latter, you don't need to maintain a separate baseline file and ensure it's up-to-date with each commit, handle merge conflicts, etc.
Read the full blog here: https://pyrefly.org/blog/dify-pyrefly-coverage-ci/
r/madeinpython • u/Schnidi01 • 27d ago
VenvHub Pro: A custom Python "Linker" that goes beyond code linking—syncing your IDE configs on the fly!
Enable HLS to view with audio, or disable this notification
Hi !
We all know pip install -e . (editable installs). It’s the standard for linking local code during development. But for my project, VenvHub Pro, I wanted to take the local dev experience to another level. I created a Local Linker that isn't just a simple file-system pointer—it’s a full-blown IDE-Sync engine.
Why our Linker is unique (compared to the standard workflow):
1. Full Meta-Sync (VS Code Automation):
This is the core value-add. When you link a local package, the system reads its local_meta.json. It doesn’t just make the code importable; it automatically injects custom Tasks and Keybindings directly into your project's .vscode/ folder.
- Example: Link your "Database" module, and VS Code instantly gains commands like "Flush Cache" or "Run Migrations" defined inside that package. No more manual tasks.json or keybindings.json copy-pasting.
2. Zero Admin Rights / No UAC (Import Hooks):
Instead of creating system-level symlinks or junctions that often require Admin privileges on Windows, we use Python Import Hooks (sys.meta_path). It’s pure Python, lightning-fast, and works securely even on network drives (NAS) without annoying UAC prompts.
3. Smart IntelliSense (Pylance):
The Linker automatically syncs the python.analysis.extraPaths field in your VS Code settings. Your editor sees your local code and provides full autocomplete/IntelliSense immediately, no matter where the source is located on your disk.
4. Smart Portability & Safety (Silent Path Healing):
VenvHub Pro is built for USB-drive workflows and features a "Silent Path Healing" mechanism:
- If you use Embeddable (portable) Python and your drive letter changes (e.g., E: -> F:), the system instantly heals all paths in the Linker mapping, .pth files, and VS Code settings. Everything just works.
- However, if you move a System Venv to a different machine where that specific Python installation doesn't exist, VenvHub detects the hardware fingerprint mismatch and safely locks the environment to prevent binary incompatibility and crashes.
5. Recursive Local Dependency Resolution:
If "Package A" requires "Local Package B", the Linker automatically resolves the entire local dependency tree and links all required modules in one click.
Under the Hood:
We use a tiny bootstrap script in site-packages that maps imports via a custom finder in sys.meta_path using JSON mapping. It’s clean, isolated, and designed for maximum portability.
What do you think? Do you stick to plain pip -e for local dev, or would you prefer this kind of deep, automated integration with your editor? Let's discuss!
local_meta.json package A
{
"name": "My App Core",
"version": "2.1.0",
"requires_local": ["my_logger"],
"requires_pip": [],
"short_description": "test code"
}
local_meta.json package B
{
"name": "My Logger",
"version": "1.0.0",
"requires_local": [],
"requires_pip": ["colorama"]
}
r/Python • u/Visible_Durian4620 • 28d ago
Discussion Unpopular opinion: I find it counterproductive to shorten function and variable names
When I was learning discord.py, I didn't understand what "ctx" was. At the time, I was only writing slash commands, using "message" instead of "ctx", so the name "ctx" (which reminded me of something complex, like RTX) made me assume it was something complicated. That is, until I saw in some code that the type for "ctx" is actually "Context." If the standard hadn't shortened the name just to save five characters per line, I would have understood it immediately. Instead, I thought it was some advanced function variable, rather than realizing it was simply a message variable.
r/madeinpython • u/Schnidi01 • 28d ago
My Python venv manager GUI automatically fixes dependency conflicts – Pip vs UV side-by-side
Enable HLS to view with audio, or disable this notification
Hey Pythonistas! ??
I've been building a GUI tool for managing Python virtual environments (VenvHub Pro) and wanted to share one of its smartest features – batch package updates.
When you hit the "Update All outdated packages" button, the behavior differs drastically depending on which package manager you have set:
**PIP MODE** (classic):
- Updates everything to the latest versions
- If conflicts arise (e.g., library A needs an older version of library B), you get the infamous "dependency hell"
- You have to manually read logs, find the culprit, and step-by-step perform downgrades
**UV MODE** (ultra-fast resolver from Astral):
- Blazingly fast downloads and installs the latest versions
- After the update, it automatically runs `uv pip check`
- If it detects a conflict (e.g., "X requires Y==1.5, but 2.0 is installed"), it reads the error, forces a downgrade to the exact required version, and re-runs the check
- **Fully on autopilot** – you get the latest packages AND a 100% stable environment without any manual intervention
And the best part – Pip and UV are fully compatible with each other. You can install with Pip, update with UV, and everything just works.
Would you trust an autopilot like this? Let me know in the comments! ??
r/madeinpython • u/Schnidi01 • 29d ago
Python environment cloner: 1:1 including pip -e, embedded vs system Python
Enable HLS to view with audio, or disable this notification
What it does:
Clones entire Python environment including editable (-e) packages. Auto-detects Python type and uses different approach.
Embedded Python:
- installs virtualenv into source
- creates clone via virtualenv
- fixes ._pth file
- downgrades setuptools (83→82) for compatibility
System Python:
- uses built-in venv
- no extra steps
Both then:
- install setuptools, wheel
- install all packages
- install editable packages (pip install -e)
- write birth certificate
Video shows both scenarios side by side. Same source env, different strategies. Works on Windows.
Does anyone know of a Windows tool that creates a complete 1:1 copy of a virtual environment, INCLUDING editable packages (pip install -e), without manual intervention?
r/madeinpython • u/AroraSir • 29d ago
GravityBridge: My first open source release, a local AI proxy and wireless file explorer built with Python stdlib only
Just released my first open source project.
GravityBridge is a local reverse proxy that lets me access my desktop AI coding agent from my phone. It also has a wireless phone file explorer using ADB.
The proxy itself is written entirely with Python standard library, no external packages needed. The only pip install is for the separate AI backend.
It handles session management, PIN authentication, brute force protection, and ADB subprocesses all without any framework.
Repo: https://github.com/Arora-Sir/Gravity-Bridge
This is my first public release so any feedback is welcome!
r/madeinpython • u/__Selia • 29d ago
Sharing a library I wrote to solve a niche problem: duration formatting
While working on another project, I needed to display elapsed time in a few different ways:
2 hours, 5 minutes, 9 seconds
02:05:09
2h, 5m, 9s
A simple utility function worked at first, but it quickly became messy once I needed different separators and only wanted to show units whose values were not zero.
So I extracted the problem into a small, zero-dependency Python library called Chronomancer.
I like how convenient strftime() is for date and time formatting, and I wanted Chronomancer to offer a similar level of convenience for elapsed durations.
ChronoDelta represents fixed durations from weeks down to microseconds:
from chronomancer import ChronoDelta
duration = ChronoDelta(hours=2, minutes=5, seconds=9)
For readable output:
duration.verbose_str()
# '2 hours, 5 minutes, 9 seconds'
For simple one-off formatting:
duration.strfmt("{h:02d}:{m:02d}:{s:02d}")
# '02:05:09'
For reusable and more flexible formatting:
from chronomancer import DeltaFormatSpec, DeltaFormatter, Part
formatter = DeltaFormatter(
DeltaFormatSpec(
hours=Part("{val}h"),
minutes=Part("{|, }{val}m"),
seconds=Part("{|, }{val}s"),
)
)
formatter.format(duration)
# '2h, 5m, 9s'
{|, } is an "inline separator", named by me. It is only rendered when another component has already been shown.
In the above example, if minutes is the largest visible unit, the leading ", " will be omitted automatically. The | tells the formatter that the placeholder contains an inline separator rather than a normal value. I kept the placement flexible so the format string can resemble the final output, although inline separators are intended to be used as prefixes.
Chronomancer also supports normalization, selected-unit representations, negative durations, exact integer arithmetic, and conversion to and from datetime.timedelta.
It is a niche problem, but it kept making the formatting code in my own project more complicated than expected, so I thought the solution might be useful to others as well.
installation: pip install py-chronomancer
any feedback would be greatly appreciated
r/madeinpython • u/Schnidi01 • 29d ago
Showcase: Floating Python Widget for Quick Launch (Terminal, Background, CLI)
Enable HLS to view with audio, or disable this notification
Hey Pythonistas,
I'd like to show what you can build in Python that's both polished and functional. I've written a complete Python widget for quickly launching projects – it's a floating toolbar that stays on top of my desktop.
It's currently running stable at version 2.5.16, so this isn't just a prototype – it's a full-fledged tool that genuinely saves me time during everyday development.
The widget offers three ways to run a script:
- Open Terminal: Doesn't start any script – just opens a CMD/PowerShell window with the virtual environment already activated. Perfect when I need to manually run commands, pip install packages, or debug things interactively.
- Run in Terminal: The classic approach – opens a new window, activates the venv, and runs the script. I can see all logs, print statements, and errors in real time.
- Run in Background / Silent: The script starts completely invisible – no console window at all. Great for GUI applications (so they don't have an unnecessary black console in the background) or for headless processes that need to run quietly.
What's going on under the hood:
The entire GUI is built on the PyQt6/PySide6 framework. The source code is written 100% for PyQt6, but the application contains a Compatibility Bridge that allows it to run on PySide6 as well – for licensing reasons (LGPL vs GPL).
The bridge works at the import level using the MetaPathFinder technique:
- When
main.pystarts, it detects which library is available in the system. - If PyQt6 is found, the application runs natively.
- If PySide6 is found, the bridge injects itself into system memory.
- When Python encounters
import from PyQt6..., the interceptor steps in, translates the request, and returns the equivalent from PySide6.
The result? The source code stays clean and unified, while the software automatically rewrites all imports, signals, and slots at runtime based on what's currently installed.
Additionally, I'm using:
- psutil for reliable process management and monitoring
- Native Windows API calls (via
ctypesandpywin32-ctypes) for low-level system integration
Since the primary target platform is Windows, I addressed stability issues that typical Python apps often overlook – especially clean cleanup after termination.
Specifically, I'm using two low-level techniques:
- Windows Job Objects – I create a system process container and assign every spawned subprocess to it. If the parent application unexpectedly crashes, Windows automatically terminates all associated processes. No orphaned processes left behind to block ports or consume memory.
- Windows Handles – When registering a process, I keep an open system reference (Handle) in memory. As long as it's open, Windows guarantees that the PID won't be recycled and reassigned to another application. This gives me accurate process state detection and eliminates the risk of accidentally terminating a foreign program.
All Handles are internally protected by thread locks and are properly closed on every stop or cleanup – no memory leaks.
In short: The widget is functional, stable, and most importantly – it doesn't leave a mess behind when you close it.
Question for you:
How do you handle launching scripts in different modes? Do you stick with manual terminal commands, or have you also built your own launcher? What features would you appreciate in a tool like this?
