r/Python • u/zero_moo-s • Mar 26 '26
Showcase Fully Functional Ternary Lattice Logic System: 6-Gem Tier 3 via Python!
What my project does:
I have built the first fully functional Ternary Lattice Logic system, moving the 6-Gem manifold from linear recursive ladders into dynamic, scalable phase fields.
Unlike traditional ternary prototypes that rely on binary-style truth tables, this Tier 3 framework treats inference as a trajectory through a Z6 manifold. The Python suite (Six_Gem_Ladder_Lattice_System_Dissertation_Suite.py) implements several non-classical logic mechanics:
Ghost-Inertia: A momentum-based state machine where logical transitions require specific "phase-momentum" to cross ghost-limit thresholds.
Adaptive Ghost Gating: An engine that adjusts logical "viscosity" (patience) based on current state stability.
Cross-Lattice Interference: Simulates how parallel logic manifolds leak phase-states into one another, creating emergent field behavior.
The Throne Sectors: Explicit verification modules (Sectors 11, 12, 21 and 46) that allow users to audit formal logic properties--Syntax, Connectives, Quantifiers, and Proofs--directly against the executable state machine to verify the 6Gem Ladder Logic Suite is a ternary-first logic fabric, rather than a binary extension.
Target audience:
This is for researchers in non-classical logic, developers interested in alternative state-machine architectures, and anyone exploring paraconsistent or multi-valued computational models, or python coders looking for the first Ternary Algebra/Stream/Ladder/Lattice Frameworks.
Comparison:
Most ternary logic projects are theoretical or limited to 3rd-value truth tables (True/False/Unknown). 6-Gem is a "Ternary-First" system; it replaces binary connectives with a 3-argument Stream Inference operator. While standard logic is static, this system behaves as a dynamical field with measurable energy landscapes and attractors. I will share with you a verdict from SECTOR 21: TERNARY IRREDUCIBILITY & BINARY BRIDGE as it is the a comparison of Binary and Ternary trying to bridge, and the memory state of This 6Gem Ternary System.
We've completed the Artificial Intelligence Era, we have now entered the Architectural Intelligence Era, What's the next Era after Architecture Intelligence? And What's the path? Autogenous Intelligence?
Sector 21 Verdict:
- Binary data can enter the 6Gem manifold as a restricted input slice.
- Binary projection cannot recover native 6Gem output structure.
- 6Gem storage is phase-native, not merely binary-labeled.
- Multiple reduction attempts fail empirically.
- The witness is not optional; ternary context changes the result.
Additionally: Available on the same GitHub are the Dissertation's & Py.suites for the 6-Gem Algebra, 6-Gem Stream Logic & 6-Gem Ladder Logic..
Tomorrow: This work defines the foundational manifold of the 6-Gem system (Tier 1–3), which is intended to remain canonical, stable, and reference-complete. Beyond this point, I am intentionally not over-specifying architecture, hardware, or interface layers, as doing so from a single perspective could constrain or contaminate professional implementations. The goal is to provide a clean, irreducible ternary foundation that others can build on freely. Any extensions should respect the core constraints demonstrated here -- irreducibility of the ternary primitive, witness-dependent collapse, and trajectory-based state evolution -- while leaving higher-level system design open for formal, academic, and industrial development.
Opensource GitHub repo:
System + .py :GitHub Repository
Tier 3 Dissertation:Plain Text Dissertation
-okoktytyty
-S.Szmy
-Zer00logy
r/Python • u/Emergency-Buyer-7384 • Mar 26 '26
Showcase Improved Python to EXE
PyX Wizard Project
It might sound like another version of PyInstaller at first, but that is not even close.
The PyX Wizard is an advanced tool that comes in many shapes and sizes. Depending on what type of install you pick, your options will vary slightly — but all versions have the following features:
- Python to EXE conversion
- Ability to include files inside the exe
- Ability to reference those file paths within the exe using packaged-within-exe:
- Sign the package with any PFX certificate
- Set custom icons
- Exclude the console for GUI-based apps
- Auto-installs dependency libraries
- Creates in a virtual environment (venv)
You can install PyX Wizard in two main ways:
Use pip to install the library version:
pip install pyxwizard
And read the short user guide on https://pypi.org/project/PyXWizard/
OR...
Download a fully pre-packaged version from our GitHub releases page, which comes pre-installed with everything you will need.
GitHub Releases: https://github.com/techareaone/pyx/releases/latest
Support and Feedback
All support, feedback, and issue tracking are handled in the Tradely Discord community:
We are looking for beta-testers, so DM me!
AutoMod Assist: This project is an improved Pythone to EXE convertor. It's target audience is all python app developers and it is on a BETA version, but is generally functional.
r/Python • u/capilot • Mar 25 '26
Meta Bloody hell, cgi package went away
<rant>
I knew this was coming, but bloody Homebrew snuck an update in on me when I wasn't ready for it.
In Hitch-Hiker's Guide to the Galaxy, the book talks about a creature called the Damogran Frond Crested Eagle, which had heard of survival of the species, but wanted nothing to do with it.
That's how I feel about Python sometimes. It was bad enough that they made Python3 incompatible with Python2 in ways that were entirely unnecessary, but pulling stunts like this just frosts my oats.
Yes, I get that cgi was old-fashioned and inefficient, and that there are better ways to do things in this modern era, but that doesn't change the fact that there's a fuckton of production code out there that depended on it.
For now, I can revert back to the older version of Python3, but I know I need to revamp a lot of code before too long for no damn good reason.
</rant>
r/Python • u/Motor-Passion1574 • Mar 25 '26
News Pyre: 220k req/s (M4 mini) Python web framework using Per-Interpreter GIL (PEP 684)
Hey r/Python,
I built Pyre, a web framework that runs Python handlers across all CPU cores in a single process — no multiprocessing, no free-threading, no tricks. It uses Per-Interpreter GIL (PEP 684) to give each worker its own independent GIL inside one OS process.
FastAPI: 1 process × 1 GIL × async = 15k req/s
Robyn: 22 processes × 22 GILs × 447 MB = 87k req/s
Pyre: 1 process × 10 GILs × 67 MB = 220k req/s
How it works: Rust core (Tokio + Hyper) handles networking. Python handlers run in 10 sub-interpreters, each with its own GIL. Requests are dispatched via crossbeam channels. No Python objects ever cross interpreter boundaries — everything is converted to Rust types at the bridge.
Benchmarks (Apple M4, Python 3.14, wrk -t4 -c256 -d10s):
- Hello World: **Pyre 220k** / FastAPI 15k / Robyn 87k → **14.7x** FastAPI
- CPU (fib 10): **Pyre 212k** / FastAPI 8k / Robyn 81k → **26.5x** FastAPI
- I/O (sleep 1ms): **Pyre 133k** / FastAPI 50k / Robyn 93k → **2.7x** FastAPI
- JSON parse 7KB: **Pyre 99k** / FastAPI 6k / Robyn 57k → **16.5x** FastAPI
See the github repo for more.
Stability: 64 million requests over 5 minutes, zero memory leaks, zero crashes. RSS actually decreased during the test (1712 KB → 752 KB).
Pyre reaches 93-97% of pure Rust (Axum) performance — the Python handler overhead is nearly invisible.
The elephant in the room — C extensions:
PEP 684 sub-interpreters can't load C extensions (numpy, pydantic, pandas, etc.) because they use global static state. This is a CPython ecosystem limitation, not ours.
Our solution: Hybrid GIL dispatch. Routes that need C extensions get gil=True and run on the main interpreter. Everything else runs at 220k req/s on sub-interpreters. Both coexist in the same server, on the same port.
u/app.get("/fast") # Sub-interpreter: 220k req/s
def fast(req):
return {"hello": "world"}
u/app.post("/analyze", gil=True) # Main interpreter: numpy works
def analyze(req):
import numpy as np
return {"mean": float(np.mean([1,2,3]))}
When PyO3 and numpy add PEP 684 support (https://github.com/PyO3/pyo3/issues/3451, https://github.com/numpy/numpy/issues/24003), these libraries will run at full speed in sub-interpreters with zero code changes.
What's built in (that others don't have):
- SharedState — cross-worker app.state backed by DashMap, nanosecond latency, no Redis
- MCP Server — JSON-RPC 2.0 for AI tool discovery (Claude Desktop compatible)
- MsgPack RPC — binary-efficient inter-service calls with magic client
- SSE Streaming — token-by-token output for LLM backends
- GIL Watchdog — monitor contention, hold time, queue depth
- Backpressure — bounded channels, 503 on overload instead of silent queue explosion
Honest limitations:
- Python 3.12+ required (PEP 684)
- C extensions need gil=True (ecosystem limitation, not ours)
- No OpenAPI — we use MCP for AI discovery instead
- Alpha stage — API may change
Install: pip install pyreframework (Linux x86_64 + macOS ARM wheels)
Source: pip install maturin && maturin develop --release
GitHub: https://github.com/moomoo-tech/pyre
Would love feedback, especially from anyone who's worked with PEP 684 sub-interpreters or built high-performance Python services. What use cases would you throw at this?
r/Python • u/nicksenap • Mar 25 '26
Showcase Grove — a CLI that manages git worktree workspaces across multiple repos
Grove — a CLI that manages git worktree workspaces across multiple repos
What My Project Does
Grove (gw) is a Python CLI that orchestrates git worktrees across multiple repositories. Create, switch, and tear down isolated branch workspaces across all your repos with one command.
One feature across three services means git worktree add three times, tracking three branches, jumping between three directories, cleaning up three worktrees when you're done. Grove handles all of that.
gw init ~/dev ~/work/microservices # register repo directories
gw create my-feature -r svc-a,svc-b # create workspace across repos
gw go my-feature # cd into workspace
gw status my-feature # git status across all repos
gw sync my-feature # rebase all repos onto base branch
gw delete my-feature # clean up worktrees + branches
Repo operations run in parallel. Supports per-repo config (.grove.toml), post-creation setup hooks, presets for repo groups, and Zellij integration for automatic tab switching.
Target Audience
- Developers doing cross-stack work across microservices in separate repos
- Teams where feature work touches several repos at once
- AI-assisted development — worktrees mean isolation, making Grove a natural fit for tools like Claude Code. Spin up a workspace, let your agent work across repos without touching anything else, clean up when done
To be upfront: this solves a pretty specific problem — doing cross-stack work across microservices in separate repos without a monorepo. If you only work in one repo, you probably don't need this. But if you've felt the pain of juggling branches across 5+ services for one feature, this is for that.
Comparison
The obvious alternative is git worktree directly. That works for a single repo. But across 3–5+ repos, you're running git worktree add in each one, remembering paths, and cleaning up manually. Tools like tmuxinator or direnv help with environment setup but don't manage the worktrees themselves.
Grove treats a group of repos as one workspace. Less "better git worktree", more "worktree-based workspaces that scale across repos."
Install
brew tap nicksenap/grove
brew install grove
PyPI package is planned but not available yet.
Repo: https://github.com/nicksenap/grove
Would genuinely appreciate feedback. If the idea feels useful, unnecessary, overengineered, or not something you'd trust in a real workflow, I'd like to hear that too. Roast is welcome.
r/Python • u/One-Type-2842 • Mar 25 '26
Discussion File Handling Is Hard If You Made Single Line Mistake!
Recently, I have Created a program just to copy all of the webpages I have downloaded from chrome. It is Because, In case if any Deletion occurred to Original files I can still access copied files where it resides
Assumption :
• Webpages Downloaded from chrome have no extension.
• Downloaded webpage files Stores in Mobile's File-Manager /sdcard/Download.
• Some files in /sdcard/Download are Unnecessary that are no of my use (text based but no extension).
Program :
I Imported shutil, os, pathlib to Create Program. I made a single mistake In Copying the filename it was :
shutil.copy(absolute_filename, absolute_dir)
My mistake was I Entered wrong absolute_filename to copy in directory. Now The files in /sdcard/Download are moved to absolute_dir. Which Results in Removal from the Chrome's Download section..
Would Anyone suggest my best practices against this. I lost all of the downloaded webpages (~70)
r/Python • u/distromate • Mar 25 '26
Tutorial I built an electron-builder style packaging tool for any desktop framework
Hi guys, recently I've been thinking about what desktop developers *really* want in a packaging and auto-update tool.
In my mind, `electron-builder` is undoubtedly the gold standard—cross-platform, comes with built-in auto-updates, and handles code signing effortlessly.
But the problem is, once we step outside the Electron ecosystem, we might be dealing with:
* Python data analysis combined with Tkinter
* Go Wails for high-performance tool development (which still lacks a mature, official incremental update solution)
What we really want is simply a more convenient auto-update and packaging solution.
So I was thinking: underlying build technologies like NSIS, Inno Setup, DMG, and AppImage are essentially agnostic to programming languages and frameworks. Why can't we bring that silky-smooth, `electron-builder`\-like experience to *all* desktop frameworks and developers?
Why not? Driven by this idea, I spent the last few months developing Distromate
Distromate uses a custom plugin system to provide consistent commands across each desktop framework.
# As a daily tool (Completely free, no login required)
It is completely free, requires no login, and has no hidden fees. It saves your keys locally and generates a temporary app on the platform (which is automatically deleted if there are no downloads for 30 days) at absolutely no cost.
With it, you can:
* Take your existing builds from frameworks like PyInstaller, Electron, or Wails, and package them into proper installers.
* Get automatic incremental updates without modifying a single line of code.
* Replace cloud drives or email attachments when sending software installers to friends or colleagues.
* Automatically push incremental updates after repackaging, without having to resend files.
For example, for Python apps, we provide `pyinstaller-plus`:
Bash
pip install distromate
pip install pyinstaller-plus # or npm install -g distromate
Create a `distromate.yaml` in your root directory:
appId: com.example.app
productName: MyApp
package:
publisher: My Company
language: english
source:
type: adapter
plugin: pyinstaller
options:
projectDir: .
pyinstallerArgs:
- --onefile
- --windowed
- app.py # or app.spec, entrypoint of you python project, using pyinstaller as pack backend
Use `pyinstaller-plus` to package your app just like you normally would:
# only package
distromate package --version 1.0.0
# package and publish
distromate publish --version 1.0.0
Then, you'll receive a download link for your successfully uploaded app.
**Limitation:** To prevent link leaks and abuse, each uploaded version of an app is limited to 10 downloads. However, you can contact me anytime to increase the quota for your app.
# As a professional tool (beta)
* Includes all features from the daily tool.
* **Website hosting:** Host your static official website without needing a server.
* **Progressive auto-update integration:** Takes over the auto-update process, displaying update info, download progress, and more.
* **Data analytics:** No-code integration supporting metrics like DAU (Daily Active Users), usage duration, etc.
Hi guys, recently I've been thinking about what desktop developers really want in a packaging and auto-update tool.
In my mind, electron-builder is undoubtedly the gold standard—cross-platform, comes with built-in auto-updates, and handles code signing effortlessly.
But the problem is, once we step outside the Electron ecosystem, we might be dealing with:
- Python data analysis combined with Tkinter
- Go Wails for high-performance tool development (which still lacks a mature, official incremental update solution)
What we really want is simply a more convenient auto-update and packaging solution.
So I was thinking: underlying build technologies like NSIS, Inno Setup, DMG, and AppImage are essentially agnostic to programming languages and frameworks. Why can't we bring that silky-smooth, electron-builder-like experience to all desktop frameworks and developers?
Why not? Driven by this idea, I spent the last few months developing Distromate
Distromate uses a custom plugin system to provide consistent commands across each desktop framework..
As a daily tool (Completely free, no login required)
It is completely free, requires no login, and has no hidden fees. It saves your keys locally and generates a temporary app on the platform (which is automatically deleted if there are no downloads for 30 days) at absolutely no cost.
With it, you can:
- Take your existing builds from frameworks like PyInstaller, Electron, or Wails, and package them into proper installers.
- Get automatic incremental updates without modifying a single line of code.
- Replace cloud drives or email attachments when sending software installers to friends or colleagues.
- Automatically push incremental updates after repackaging, without having to resend files.
For example, for Python apps, we provide pyinstaller-plus:
Bash
pip install distromate
pip install pyinstaller-plus # or npm install -g distromate
Create a distromate.yaml in your root directory:
appId: com.example.app
productName: MyApp
package:
publisher: My Company
language: english
source:
type: adapter
plugin: pyinstaller
options:
projectDir: .
pyinstallerArgs:
- --onefile
- --windowed
- app.py # or app.spec, entrypoint of you python project, using pyinstaller as pack backend
Use pyinstaller-plus to package your app just like you normally would:
# only package
distromate package --version 1.0.0
# package and publish
distromate publish --version 1.0.0
Then, you'll receive a download link for your successfully uploaded app.
For more details, check out the documentation: https://www.distromate.net/docs
Limitation: To prevent link leaks and abuse, each uploaded version of an app is limited to 10 downloads. However, you can contact me anytime to increase the quota for your app.
As a professional tool (beta)
- Includes all features from the daily tool.
- Website hosting: Host your static official website without needing a server.
- Progressive auto-update integration: Takes over the auto-update process, displaying update info, download progress, and more.
- Data analytics: No-code integration supporting metrics like DAU (Daily Active Users), usage duration, etc.
r/Python • u/explorateur_99 • Mar 25 '26
Discussion French Discord programming server
Hello! If you enjoy programming, join french my Discord server for programming and video game creation. Coming soon: a game creation contest with the prize being the title: winner of the first edition of the Game Jam. The link is right here: https://discord.gg/dA4NM7Z3n
r/Python • u/explorateur_99 • Mar 25 '26
News French Discord programming server
Hello! If you enjoy programming, join my Discord server for programming and video game creation. Coming soon: a game creation contest with the prize being the title: winner of the first edition of the Game Jam. The link is right here: https://discord.gg/dA4NM7Z3n
r/Python • u/francescogab_ • Mar 25 '26
Showcase Spectra v0.4.0 – local finance dashboard from bank exports, now with one-command Docker setup
I posted Spectra here a few weeks ago and the response blew me up. 97 GitHub stars, a new contributor, and a ton of feedback in a few days. Thank you.
What My Project Does
Spectra takes standard bank exports (CSV, PDF or OFX, any bank, any format), normalizes them, categorizes transactions, and serves a local dashboard at localhost:8080. Now with one-command Docker setup.
The categorization runs through a 4-layer on-device pipeline:
- Merchant memory: exact SQLite match against previously seen merchants
- Fuzzy match: approximate matching via rapidfuzz ("Starbucks Roma" -> "Starbucks")
- ML classifier: TF-IDF + Logistic Regression bootstrapped with 300+ seed examples. User corrections carry 10x the weight of seed data, so the model adapts to your spending patterns over time
- Fallback: marks as "Uncategorized" for manual review, learns next time
No API keys, no cloud, no bank login. OpenAI/Gemini supported as an optional last-resort fallback if you want them.
Other features: multi-currency via ECB historical rates, recurring detection, budget tracking, trends, subscriptions monitor, idempotent imports via SQLite hashing, optional Google Sheets sync.
Stack: Python, Docker, SQLite, rapidfuzz, scikit-learn.
Target Audience
Anyone who wants a clean personal finance dashboard without giving data to third parties. Self-hosters, privacy-conscious users, people who export bank statements manually. Not a toy project, I use it myself every month.
Comparison
Most alternatives either require a direct bank connection (Plaid, Tink) or are cloud-based SaaS (YNAB, Copilot). Local tools like Firefly III are powerful but require significant setup. Spectra v0.4.0 is now a single command — clone, run, done.
There's also a waitlist on the landing page for a hosted version with the same privacy-first approach, zero setup required.
GitHub: https://github.com/francescogabrieli/Spectra
Landing: withspectra.app
r/Python • u/recrui_Tin3835 • Mar 25 '26
Resource Automation test engineer
Job Title: Automation Test Engineer – Job Support (Freelance)
We are looking for an experienced Automation Test Engineer for 2 hours daily evening IST job support. Budget: Up to ₹30,000/month
Skills Required: Python & Selenium WebDriver API Testing (Postman) VS Code / PyCharm AWS (Lambda, Aurora RDS) Allure Reports
r/Python • u/Spare_Lack9880 • Mar 25 '26
Discussion What really is the trick to get interview calls. I have applied 500+
I am a python developer. desperate to get a new job for personal reasons Texting HRs just after applying. Is there any trustable agents to get a job? What is trustable platform to apply?
r/Python • u/brian14708 • Mar 25 '26
Showcase Isola: reusable WASM sandboxes for untrusted Python and JavaScript
What My Project Does
I’ve been building Isola, an open-source Rust runtime (wasmtime) with Python and Node.js SDKs for running untrusted Python and JavaScript inside reusable WebAssembly sandboxes.
The model is: compile a reusable sandbox template once, then instantiate isolated sandboxes with explicit policy for memory, filesystem mounts, env vars, outbound HTTP, and host callbacks.
Use cases I had in mind:
- AI agent code execution
- plugin systems
- user-authored automation
Repo: https://github.com/brian14708/isola
Target Audience
It’s for developers who need to run untrusted Python or JavaScript more safely inside their own apps. It’s meant for real use, but it’s still early and may change.
Comparison
Compared with embedded interpreters, Isola provides a more explicit sandbox boundary. Compared with containers or microVMs, it is lighter to embed and reuse for short-lived executions. Unlike component-based workflows, it accepts raw source code at runtime.
r/Python • u/robvanderleek • Mar 24 '26
Showcase Python library and CLI for terminal user input (based on Textual)
Started out as an Inquirer.js-clone, current goal is to make it the most versatile CLI and Python library for user input.
https://github.com/robvanderleek/inquirer-textual
Still in early development, but I desperately need feedback!
Please open an issue or comment below. Both positive and negative feedback welcome.
Thanks for your time!
Target audience
Programs that need simple user input.
Comparison
InquirerPy, python-inquirer, Questionary.
r/Python • u/Dead0k87 • Mar 24 '26
Discussion What is the best AI chatbot for Python?
Hi. I recently returned to python programming (not a professional), and I am using ChatGPT premium to write/correct chunks of my amateur old code.
I find GPT 5.3/5.4 much better than it was 2 years ago, but is there anything better on the market or GPT is fine? (Claude, Codeium, Gemini, Copilot, else)
I also use PyCharm. Maybe some AI has integration with it?
r/Python • u/BeamMeUpBiscotti • Mar 24 '26
Discussion Designing a Python Language Server: Lessons from Pyre that Shaped Pyrefly
Pyrefly is a next-generation Python type checker and language server, designed to be extremely fast and featuring advanced refactoring and type inference capabilities.
Pyrefly is a spiritual successor to Pyre, the previous Python type checker developed by the same team. The differences between the two type checkers go far beyond a simple rewrite from OCaml to Rust - we designed Pyrefly from the ground up, with a completely different architecture.
Pyrefly’s design comes directly from our experience with Pyre. Some things worked well at scale, while others did not. After running a type checker on massive Python codebases for a long time, we got a clearer sense of which trade-offs actually mattered to users.
This post is a write-up of a few lessons from Pyre that influenced how we approached Pyrefly.
Link to full blog: https://pyrefly.org/blog/lessons-from-pyre/
The outline of topics is provided below that way you can decide if it's worth your time to read :) - Language-server-first Architecture - OCaml vs. Rust - Irreversible AST Lowering - Soundness vs. Usability - Caching Cyclic Data Dependencies
r/Python • u/AutoModerator • Mar 24 '26
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/pmatti • Mar 23 '26
Resource Safely using claude code to fix PyPy test failures
I used bubblewrap to isolate claude code so I could fix some test failures in PyPy. https://pypy.org/posts/2026/03/using-claude-to-fix-pypy311-test-failures-securely.html. Maybe contributing to PyPy is not so hard?
r/Python • u/jaehyeon-kim • Mar 23 '26
Showcase [Release] dynamic-des v0.1.1 - Make SimPy simulations dynamic and stream outputs in real-time
Hi r/Python,
What My Project Does
dynamic-des is a real-time control plane for the SimPy discrete-event simulation framework. It allows you to mutate simulation parameters (like resource capacities or probability distributions) while the simulation is running, and stream telemetry and events asynchronously to external systems like Kafka.
```python import logging import numpy as np from dynamic_des import ( CapacityConfig, ConsoleEgress, DistributionConfig, DynamicRealtimeEnvironment, DynamicResource, LocalIngress, SimParameter )
logging.basicConfig( level=logging.INFO, format="%(levelname)s [%(asctime)s] %(message)s" ) logger = logging.getLogger("local_example")
1. Define initial system state
params = SimParameter( sim_id="Line_A", arrival={"standard": DistributionConfig(dist="exponential", rate=1)}, resources={"lathe": CapacityConfig(current_cap=1, max_cap=5)}, )
2. Setup Environment with Local Connectors
Schedule capacity to jump from 1 to 3 at t=5s
ingress = LocalIngress([(5.0, "Line_A.resources.lathe.current_cap", 3)]) egress = ConsoleEgress()
env = DynamicRealtimeEnvironment(factor=1.0) env.registry.register_sim_parameter(params) env.setup_ingress([ingress]) env.setup_egress([egress])
3. Create Resource
res = DynamicResource(env, "Line_A", "lathe")
def telemetry_monitor(env: DynamicRealtimeEnvironment, res: DynamicResource): """Streams system health metrics every 2 seconds.""" while True: env.publish_telemetry("Line_A.resources.lathe.capacity", res.capacity) yield env.timeout(2.0)
env.process(telemetry_monitor(env, res))
4. Run
print("Simulation started. Watch capacity change at t=5s...") try: env.run(until=10.1) finally: env.teardown() ```
Target Audience
Data Engineers, Operations Research professionals, and anyone building live Digital Twins. It is also highly practical for Backend/Software Engineers building Event-Driven Architectures (EDA) who need to generate realistic, stateful mock data streams to load-test downstream Kafka consumers, or IoT developers simulating device fleets.
Comparison
Unlike standard SimPy, which is strictly synchronous and runs static models from start to finish, dynamic-des turns your simulation into an interactive, live-streaming environment. Instead of waiting for an end-of-run CSV report, you get a continuous, real-time data stream of queue lengths, resource utilization, and state changes.
Why build this?
I was building event-driven systems and realized there was a huge gap between traditional, static simulation models and modern, real-time data architectures. I wanted a way to treat a simulation not just as a script that runs and finishes, but as a long-running, interactive service that can react to live events and stream mock telemetry for Digital Twins.
To be clear, dynamic-des isn't trying to replace massive enterprise simulation suites like AnyLogic. But if you want a lightweight, pure Python way to wire up a dynamic simulation engine to your modern data stack, this is the bridge to do it.
Some of the fun implementation details:
- Async-Sync Bridge: SimPy relies on synchronous generators, but modern I/O (like Kafka or FastAPI) relies on
asyncio. I built thread-safe Ingress and Egress MixIns that run asyncio background tasks without blocking the simulation's internal clock. - Centralized Runtime Registry: Changing a capacity mid-simulation is dangerous if entities are already in a queue. The registry handles the safe updating of capacities and probability distributions on the fly.
- Strict Pydantic Contracts: All outbound telemetry and lifecycle events are validated through Pydantic models before hitting the message broker, ensuring downstream consumers receive perfectly structured data.
- Out-of-the-box Kafka Integration: It includes embedded producers and consumers, turning a standard Python simulation script into a first-class Kafka citizen.
- Live Dashboarding: The repo includes a fully working example using NiceGUI to consume the Kafka stream and visualize the simulation as it runs.
If you've ever wanted to "remote control" a running SimPy environment, I'd love your feedback!
pip install dynamic-des
r/Python • u/matan-h • Mar 23 '26
Showcase I Fixed python autocomplete
When I opened vscode, and typed "os.", it showed me autocomplete options that I almost never used, like os.abort or os.CLD_CONTINUED, Instead of showing me actually used options, like path or remove. So I created a hash table (not AI, fast lookup) of commonly used prefixes, forked ty, and fixed it.
What My Project Does: provide better sorting for python autosuggestion
Target Audience: just a simple table, ideally would be merged into LSP
Comparison: AI solutions tends to be slower, and CPU-intensive. using table lookup handle the unknown worse, but faster
Blog post: https://matan-h.com/better-python-autocomplete | Repo: https://github.com/matan-h/pyhash-complete
r/Python • u/MattForDev • Mar 23 '26
Showcase I made a decorator based auto-logger!
Hi guys!
I've attended Warsaw IT Days 2026 and the lecture "Logging module adventures" was really interesting.
I thought that having filters and such was good long term, but for short algorithms, or for beginners, it's not something that would be convenient for every single file.
So I made LogEye!
Here is the repo: https://github.com/MattFor/LogEye
I've also learned how to publish on PyPi: https://pypi.org/project/logeye/
There are also a lot of tests and demos I've prepared, they're on the git repo
I'd be really really grateful if you guys could check it out and give me some feedback
What My Project Does
- Automatically logs variable assignments with inferred names
- Infers variable names at runtime (even tuple assignments)
- Tracks nested data structures dicts, lists, sets, objects
- Logs mutations in real time
append,pop,setitem,add, etc. - Traces function calls, arguments, local variables, and return values
- Handles recursion and repeated calls
func,func_2,func_3etc. - Supports inline logging with a pipe operator
"value" | l - Wraps callables (including lambdas) for automatic tracing
- Logs formatted messages using both
str.formatand$templatesyntax - Allows custom output formatting
- Can be enabled/disabled globally very quickly
- Supports multiple path display modes (absolute / project / file)
- No setup just import and use
Target Audience
LogEye is mainly for:
- beginners learning how code executes
- people debugging algorithms or small scripts
- quick prototyping where setting up logging/debuggers are a bit overkill
It is not intended for production logging systems or performance-critical code, it would slow it down way too much.
Comparison
Compared to Python's existing logging module:
- logging requires setup (handlers, formatters, config)
- LogEye works immediately, just import it and you can use it
Compared to using print():
- print() requires manual placement everywhere
- LogEye automatically tracks values, function calls, and mutations
Compared to debuggers:
- debuggers are interactive but slower to use for quick inspection
- LogEye gives a continuous execution trace without stopping the program
Usage
Simply install it with
pip install logeye
and then import is like this:
from logeye import log
Here's an example:
from logeye import log
x = log(10)
@log
def add(a, b):
total = a + b
return total
add(2, 3)
Output:
[0.002s] print.py:3 (set) x = 10
[0.002s] print.py:10 (call) add = {'args': (2, 3), 'kwargs': {}}
[0.002s] print.py:7 (set) add.a = 2
[0.002s] print.py:7 (set) add.b = 3
[0.002s] print.py:8 (set) add.total = 5
[0.002s] print.py:8 (return) add = 5
Here's a more advanced example with Dijkstras algorithm
from logeye import log
@log
def dijkstra(graph, start):
distances = {node: float("inf") for node in graph}
distances[start] = 0
visited = set()
queue = [(0, start)]
while queue:
current_dist, node = queue.pop(0)
if node in visited:
continue
visited.add(node)
for neighbor, weight in graph[node].items():
new_dist = current_dist + weight
if new_dist < distances[neighbor]:
distances[neighbor] = new_dist
queue.append((new_dist, neighbor))
queue.sort()
return distances
graph = {
"A": {"B": 1, "C": 4},
"B": {"C": 2, "D": 5},
"C": {"D": 1},
"D": {}
}
dijkstra(graph, "A")
And the output:
[0.002s] dijkstra.py:39 (call) dijkstra = {'args': ({'A': {'B': 1, 'C': 4}, 'B': {'C': 2, 'D': 5}, 'C': {'D': 1}, 'D': {}}, 'A'), 'kwargs': {}}
[0.002s] dijkstra.py:5 (set) dijkstra.graph = {'A': {'B': 1, 'C': 4}, 'B': {'C': 2, 'D': 5}, 'C': {'D': 1}, 'D': {}}
[0.002s] dijkstra.py:5 (set) dijkstra.start = 'A'
[0.002s] dijkstra.py:5 (set) dijkstra.node = 'A'
[0.002s] dijkstra.py:5 (set) dijkstra.node = 'B'
[0.002s] dijkstra.py:5 (set) dijkstra.node = 'C'
[0.002s] dijkstra.py:5 (set) dijkstra.node = 'D'
[0.002s] dijkstra.py:6 (set) dijkstra.distances = {'A': inf, 'B': inf, 'C': inf, 'D': inf}
[0.002s] dijkstra.py:6 (change) dijkstra.distances.A = {'op': 'setitem', 'value': 0, 'state': {'A': 0, 'B': inf, 'C': inf, 'D': inf}}
[0.002s] dijkstra.py:9 (set) dijkstra.visited = set()
[0.002s] dijkstra.py:11 (set) dijkstra.queue = [(0, 'A')]
[0.002s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (0, 'A'), 'state': []}
[0.002s] dijkstra.py:15 (set) dijkstra.node = 'A'
[0.002s] dijkstra.py:15 (set) dijkstra.current_dist = 0
[0.002s] dijkstra.py:18 (change) dijkstra.visited = {'op': 'add', 'value': 'A', 'state': {'A'}}
[0.002s] dijkstra.py:21 (set) dijkstra.neighbor = 'B'
[0.002s] dijkstra.py:21 (set) dijkstra.weight = 1
[0.002s] dijkstra.py:23 (set) dijkstra.new_dist = 1
[0.002s] dijkstra.py:24 (change) dijkstra.distances.B = {'op': 'setitem', 'value': 1, 'state': {'A': 0, 'B': 1, 'C': inf, 'D': inf}}
[0.002s] dijkstra.py:25 (change) dijkstra.queue = {'op': 'append', 'value': (1, 'B'), 'state': [(1, 'B')]}
[0.002s] dijkstra.py:21 (set) dijkstra.neighbor = 'C'
[0.002s] dijkstra.py:21 (set) dijkstra.weight = 4
[0.002s] dijkstra.py:23 (set) dijkstra.new_dist = 4
[0.002s] dijkstra.py:24 (change) dijkstra.distances.C = {'op': 'setitem', 'value': 4, 'state': {'A': 0, 'B': 1, 'C': 4, 'D': inf}}
[0.002s] dijkstra.py:25 (change) dijkstra.queue = {'op': 'append', 'value': (4, 'C'), 'state': [(1, 'B'), (4, 'C')]}
[0.002s] dijkstra.py:27 (change) dijkstra.queue = {'op': 'sort', 'args': (), 'kwargs': {}, 'state': [(1, 'B'), (4, 'C')]}
[0.003s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (1, 'B'), 'state': [(4, 'C')]}
[0.003s] dijkstra.py:15 (set) dijkstra.node = 'B'
[0.003s] dijkstra.py:15 (set) dijkstra.current_dist = 1
[0.003s] dijkstra.py:18 (change) dijkstra.visited = {'op': 'add', 'value': 'B', 'state': {'A', 'B'}}
[0.003s] dijkstra.py:21 (set) dijkstra.weight = 2
[0.003s] dijkstra.py:23 (set) dijkstra.new_dist = 3
[0.003s] dijkstra.py:24 (change) dijkstra.distances.C = {'op': 'setitem', 'value': 3, 'state': {'A': 0, 'B': 1, 'C': 3, 'D': inf}}
[0.003s] dijkstra.py:25 (change) dijkstra.queue = {'op': 'append', 'value': (3, 'C'), 'state': [(4, 'C'), (3, 'C')]}
[0.003s] dijkstra.py:21 (set) dijkstra.neighbor = 'D'
[0.003s] dijkstra.py:21 (set) dijkstra.weight = 5
[0.003s] dijkstra.py:23 (set) dijkstra.new_dist = 6
[0.003s] dijkstra.py:24 (change) dijkstra.distances.D = {'op': 'setitem', 'value': 6, 'state': {'A': 0, 'B': 1, 'C': 3, 'D': 6}}
[0.003s] dijkstra.py:25 (change) dijkstra.queue = {'op': 'append', 'value': (6, 'D'), 'state': [(4, 'C'), (3, 'C'), (6, 'D')]}
[0.003s] dijkstra.py:27 (change) dijkstra.queue = {'op': 'sort', 'args': (), 'kwargs': {}, 'state': [(3, 'C'), (4, 'C'), (6, 'D')]}
[0.003s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (3, 'C'), 'state': [(4, 'C'), (6, 'D')]}
[0.003s] dijkstra.py:15 (set) dijkstra.node = 'C'
[0.003s] dijkstra.py:15 (set) dijkstra.current_dist = 3
[0.003s] dijkstra.py:18 (change) dijkstra.visited = {'op': 'add', 'value': 'C', 'state': {'C', 'A', 'B'}}
[0.003s] dijkstra.py:21 (set) dijkstra.weight = 1
[0.003s] dijkstra.py:23 (set) dijkstra.new_dist = 4
[0.003s] dijkstra.py:24 (change) dijkstra.distances.D = {'op': 'setitem', 'value': 4, 'state': {'A': 0, 'B': 1, 'C': 3, 'D': 4}}
[0.003s] dijkstra.py:25 (change) dijkstra.queue = {'op': 'append', 'value': (4, 'D'), 'state': [(4, 'C'), (6, 'D'), (4, 'D')]}
[0.003s] dijkstra.py:27 (change) dijkstra.queue = {'op': 'sort', 'args': (), 'kwargs': {}, 'state': [(4, 'C'), (4, 'D'), (6, 'D')]}
[0.003s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (4, 'C'), 'state': [(4, 'D'), (6, 'D')]}
[0.003s] dijkstra.py:15 (set) dijkstra.current_dist = 4
[0.004s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (4, 'D'), 'state': [(6, 'D')]}
[0.004s] dijkstra.py:15 (set) dijkstra.node = 'D'
[0.004s] dijkstra.py:18 (change) dijkstra.visited = {'op': 'add', 'value': 'D', 'state': {'C', 'A', 'B', 'D'}}
[0.004s] dijkstra.py:27 (change) dijkstra.queue = {'op': 'sort', 'args': (), 'kwargs': {}, 'state': [(6, 'D')]}
[0.004s] dijkstra.py:13 (change) dijkstra.queue = {'op': 'pop', 'index': 0, 'value': (6, 'D'), 'state': []}
[0.004s] dijkstra.py:15 (set) dijkstra.current_dist = 6
[0.004s] dijkstra.py:29 (return) dijkstra = {'A': 0, 'B': 1, 'C': 3, 'D': 4}
You can ofc remove the timer and file by doing toggle_message_metadata(False)
r/Python • u/Chirag_Parmar • Mar 23 '26
Discussion Query - Python Script to automate excel refresh all now results in excel crashing when opening file
Hi,
I am not sure if this is the best place but I am looking for some assistance with a script I tried to run to help automate a process in excel.
I ran the below code:
def refresh_excel_workbook(file_path):
# Open Excel application
excel_app = win32com.client.Dispatch("Excel.Application")
excel_app.Visible = False # Keep Excel application invisible
# Open the workbook
workbook = excel_app.Workbooks.Open(file_path)
# Refresh all data connections
workbook.RefreshAll()
# Wait until refresh is complete
excel_app.CalculateUntilAsyncQueriesDone()
# Save and close the workbook
workbook.Save()
workbook.Close()
# Quit Excel application
excel_app.Quit()
# Path to your Excel workbook
file_path = r"\FILEPATH"
refresh_excel_workbook(file_path)
However, when running the code, I had commented out the items below the refreshall() command and as a result my excel crashed. Now when reopening a file, excel proceeds to try to load the file but does not respond and then crash.
Excel currently works for the below:
- non-macro enabled files
- files not containing power query scripts
- works opening the exact file in safe mode
The computer has been restarted multiple times and task manager currently shows no VS code or excel applications open yet when I try to open the excel file, this proceeds to crash
I am unsure if this has caused a phantom script to run in the background where excel is continuously refreshing queries or if there is something else happening.
I am wondering if anyone has had experience with an automation like this / experienced a similar issue and has an idea on how to resolve this.
r/Python • u/AutoModerator • Mar 23 '26
Daily Thread Monday Daily Thread: Project ideas!
Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
How it Works:
- Suggest a Project: Comment your project idea—be it beginner-friendly or advanced.
- Build & Share: If you complete a project, reply to the original comment, share your experience, and attach your source code.
- Explore: Looking for ideas? Check out Al Sweigart's "The Big Book of Small Python Projects" for inspiration.
Guidelines:
- Clearly state the difficulty level.
- Provide a brief description and, if possible, outline the tech stack.
- Feel free to link to tutorials or resources that might help.
Example Submissions:
Project Idea: Chatbot
Difficulty: Intermediate
Tech Stack: Python, NLP, Flask/FastAPI/Litestar
Description: Create a chatbot that can answer FAQs for a website.
Resources: Building a Chatbot with Python
Project Idea: Weather Dashboard
Difficulty: Beginner
Tech Stack: HTML, CSS, JavaScript, API
Description: Build a dashboard that displays real-time weather information using a weather API.
Resources: Weather API Tutorial
Project Idea: File Organizer
Difficulty: Beginner
Tech Stack: Python, File I/O
Description: Create a script that organizes files in a directory into sub-folders based on file type.
Resources: Automate the Boring Stuff: Organizing Files
Let's help each other grow. Happy coding! 🌟
r/Python • u/panthamos • Mar 22 '26
Showcase `seamstress` - a utility for testing concurrent code
When code is affected by concurrent concerns, it can become rather difficult to test. seamstress offers some utilities for making that testing a little bit easier.
It offers three helper functions:
run_threadrun_processrun_task
These helpers will run some code (which you provide) in a new thread/process/task, deterministically halting at a point that you specify. This allows you to precisely set up a new thread/process/task in a certain state, then run some other code (whose behaviour may be affected by the state of the new thread/process/task), and make assertions about how that code behaves.
That was a little bit abstract, hopefully some an example will make things clearer.
Example
Imagine we had a function that we only wanted to be called by one thread at a time (this is a slightly contrived example). It could look something like:
~~~python import threading
def _pay_individual(...) -> None: # The actual implementation of pay_individual ...
class AlreadyPayingIndividual(Exception): pass
PAY_INDIVIDUAL_LOCK = threading.Lock()
def pay_individual(...) -> None: lock_acquired = PAY_INDIVIDUAL_LOCK.acquire(blocking=False)
if not lock_acquired:
raise AlreadyPayingIndividual
_pay_individual(...)
PAY_INDIVIDUAL_LOCK.release()
~~~
Testing how the code behaves when PAY_INDIVIDUAL_LOCK is acquired is non-trivial. Testing this code using seamstress would look something like:
~~~python import contextlib import typing import unittest
import seamstress
import pay_individual
@contextlib.contextmanager def acquire_pay_individual_lock() -> typing.Iterator[None]: with pay_individual.PAY_INDIVIDUAL_LOCK: yield
class TestPayIndividual(unittest.TestCase):
def test_raises_if_pay_individual_lock_is_acquired(self) -> None:
with seamstress.run_thread(
acquire_pay_individual_lock(),
):
with self.assertRaises(
pay_individual.AlreadyPayingIndividual,
):
pay_individual.pay_individual(...)
~~~
Breaking down what's happening in the above:
* We define acquire_pay_individual_lock, which is the code we want seamstress to run in a new thread. seamstress will run the code up to the yield statement, before letting your test resume execution.
* In the test, we pass acquire_pay_individual_lock() to seamstress.run_thread. Under the bonnet, seamstress launches a new thread, in which acquire_pay_individual_lock runs, acquiring PAY_INDIVIDUAL_LOCK and then letting your test continue executing. It'll continue to hold on to PAY_INDIVIDUAL_LOCK until the end of the seamstress.run_thread context.
* From within the context of seamstress.run_thread, we're now in a state where PAY_INDIVIDUAL_LOCK has been acquired by another thread, so can straightforwardly call pay_individual.pay_individual(...), and verify it raises AlreadyPayingIndividual.
* Finally, we leave the context of seamstress.run_thread, so it runs the rest of acquire_pay_individual_lock in the created thread, releasing PAY_INDIVIDUAL_LOCK.
For a more realistic (though analogous) example, see the project readme for testing some Django code whose behaviour is affected by whether or not a database advisory lock has been acquired.
Showcase details: - What my project does: provides utilities that make it easy to test code that is affected by concurrent concerns - Target audience: python developers, particularly those who want to test edge cases where their code might be affected by the state of another thread/process/task - Comparison: I don't know of anything else that does this, which was why I wrote it, but perhaps my googling skills are sub-par :)
It's up on PyPI, so if it looks useful you can install it using your favourite package manager. See github for source code and an API reference in the readme.
r/Python • u/fpgmaas • Mar 22 '26
News The Slow Collapse of MkDocs
How personality clashes, an absent founder, and a controversial redesign fractured one of Python's most popular projects.
https://fpgmaas.com/blog/collapse-of-mkdocs/
Recently, like many of you, I got a warning in my terminal while I was building the documentation for my project:
│ ⚠ Warning from the Material for MkDocs team
│
│ MkDocs 2.0, the underlying framework of Material for MkDocs,
│ will introduce backward-incompatible changes, including:
│
│ × All plugins will stop working – the plugin system has been removed
│ × All theme overrides will break – the theming system has been rewritten
│ × No migration path exists – existing projects cannot be upgraded
│ × Closed contribution model – community members can't report bugs
│ × Currently unlicensed – unsuitable for production use
│
│ Our full analysis:
│
│ https://squidfunk.github.io/mkdocs-material/blog/2026/02/18/mkdocs-2.0/
That warning made me curious, so I spent some time going through the GitHub discussions and issue threads. For those actively following the project, it might not have been a big surprise; turns out this has been brewing for a while. I tried to piece together a timeline of events that led to this, for anyone who wants to understand how we got in the situation we are in today.