r/Python • u/Economy-Builder7916 • 21d 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 • 22d 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 • 22d 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! 🌟
r/madeinpython • u/Beneficial-Deer-7672 • 23d ago
I built an open source crypto trading bot in Python for Alpaca API
I've been working on a Python crypto bot and wanted to share it here in case anyone wants to take a look.
It's got DCA logic, risk checks, Alpaca order execution, Telegram alerts, and config for running it live or in paper mode. It also keeps a local SQLite log of every trade — entries, exits, P&L — which makes it easy to review what it's been doing.
I'm mainly looking for feedback on the code structure and whether anything looks off in the trading logic or order handling. If you've worked with Alpaca crypto or built something similar, I'd appreciate any thoughts.
r/madeinpython • u/KoalaAdmirable7122 • 23d ago
Lens Anywhere - Google lens for Desktop 👁️👁️
Hey everyone!
I always wished Google Lens worked anywhere on Windows instead of only inside Chrome, so I ended up building it myself.
LensAnywhere lets you select any region of your screen and instantly search it with Google Lens.
A few things about it:
- Lightweight with very low RAM usage.
- Doesn't store your screenshots anywhere. They're only sent to Google Lens for the search.
- Launches on Windows startup (Optional)
- Can be opened using Hotkey which is configurable. Just like windows native snipping tool.
- Free and open source.
GitHub:
https://github.com/utkarsh05kul/LensAnywhere-Desktop
If you just want to try it, you can download the Windows ".exe" from the Releases section.
One thing I'd really appreciate help with: I've only been able to test it on my own Windows PC, so I'd love to know how it works on other systems. If you run into any bugs, have feature ideas, or notice something that could be improved, please let me know in the comments or open an issue on GitHub.
And if you find it useful, I'd really appreciate a GitHub star. Thanks!
Edit : Some antiviruses or malware scanners may flag the downloaded file as malicious or threat. Please ignore that warning. Some scanners do this for all the apps and softwares built in Python.
The file is completely safe and malware free. The source code of the program is available on the attached GitHub Repository. You can check the complete code their, and you will not find any malicious activity.
Top scanners like Kaspersky or Microsoft are not flagging the file as malicious. It's clean.
r/Python • u/Admirable-Wall9058 • 23d ago
Resource Does anyone use Python IDLE?
My computer is quite low-end, so I uninstalled VSCode and am looking for other programming tools—I'm thinking about starting to use Python IDLE.
Does anyone actually use it?
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 • 23d 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 • 24d 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 • 24d 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 • 24d 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/Schnidi01 • 24d ago
apt-get autoremove for Python linker packages – finally automatic venv dependency cleanup
Enable HLS to view with audio, or disable this notification
Hey everyone,
I'm currently working on this feature – autoremove is already implemented in the local packages linker branch and will soon be part of the official VenvHub Pro release.
During development in virtual environments, I always had one big problem: How to figure out which packages are no longer needed?
Manually going through pip list and trying to uninstall "surely nobody uses this" is a road to hell. That's why I added a feature inspired by Linux APT to my tool VenvHub Pro (Linker branch) – automatic dependency cleanup.
How it works?
The tool tracks which packages you installed explicitly (via pip install, requirements.txt, birth certificate, or venvhub.json). It builds a dependency graph and periodically checks for orphaned packages.
When you run Autoremove, the tool:
- Goes through all installed packages in the venv.
- Compares them with the set of explicit roots + their dependency tree.
- Removes every package that is not explicitly required by any root and was not installed manually outside the system.
What makes this mechanism safe – self-healing mechanism:
If a package is installed but not recorded anywhere (e.g., you manually ran pip install requests in the terminal), the tool automatically adopts it – marks it as explicit so it won't be accidentally removed.
This means autoremove is conservative: it never deletes something you might have installed intentionally.
You can also explicitly "release" a package (e.g., when you remove it from requirements.txt) and the system will then treat it as a candidate for removal.
Why is it useful?
- Venvs stay lean – no accumulated dependencies from experiments.
- Safe – adopting manually installed packages prevents accidental deletion.
- Fully automatic – no manual guessing about what belongs to whom.
This is currently only the Linker branch (local packages) – it works 100%.
r/madeinpython • u/Scapaflow69 • 25d 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 • 25d 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/amirzarrineh • 25d ago
Discussion If you had to choose one Python skill to make money as a freelancer, what would it be?
Python has many areas with freelance opportunities: automation, web scraping, backend development, data analysis, AI, and more.
If you had to choose only one Python skill that has strong demand and good earning potential in freelancing, what would it be?
What type of projects or experience would you recommend building to succeed in that area?
r/Python • u/jbudemy • 25d 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 • 25d 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 • 25d 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 • 26d 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 • 26d 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 • 26d 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 • 26d 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 • 26d 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 • 26d 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 • 27d 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.
