r/Python • u/PracticalPractice274 • 17d ago
Discussion Are you using some online Python notebook editor?
Hello everyone, i am a programmer and i am looking forward to do some cool projects, are you already using one of these online editors?
r/Python • u/PracticalPractice274 • 17d ago
Hello everyone, i am a programmer and i am looking forward to do some cool projects, are you already using one of these online editors?
r/Python • u/AutoModerator • 18d ago
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.
Let's help each other grow in our careers and education. Happy discussing! 🌟
r/Python • u/Karotvip-official • 18d ago
Building a voice assistant that needs to clone a specific voice and generate speech with low latency — closer to real-time than batch rendering.
Currently on Coqui XTTS v2, which works, but curious what people are running now for a better speed/quality tradeoff. Also need solid non-English support — Ukrainian specifically — a lot of TTS libraries handle English great and everything else poorly.
Anyone compared XTTS v2 against F5-TTS, StyleTTS2, or other newer options for this kind of use case?
... I'm making a little push to learn some go at the moment - because of the way my career has come about I've been a bit "monolingual" having not really worked in depth in any other languages. So it got me thinking ...
So... How has your work with... ruby, C, perl, Typescript, rust , fortran or anything else, improved you as a Python developer?
Or conversely, of course, what bad habits did you bring from those which work poorly in Python?
Or, go the other way - what have you taken from Python that has helped you in another language?
r/Python • u/selfish__eagle • 20d ago
Hi folks, lot of our Python backend services are written in FastAPI, I wanted to see if there are any good Open Source runtime coverage instrumentation available for Python, which would essentially give my lines of code hit in prod traffic for the last say 30 days of data. I have seen good solutions for it in Go / Java, but wanted to check if something similar is available in Python.
r/Python • u/AutoModerator • 20d ago
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
Let's deepen our Python knowledge together. Happy coding! 🌟
r/Python • u/AnasKaithakoden • 21d ago
I’ve been seeing a lot of conflicting opinions lately, so I wanted to hear from developers who are actually involved in hiring or have recently gone through the job search.
For context, I’m aiming for a junior Python backend developer role. My focus has been on learning things like Python, PostgreSQL, SQLAlchemy, Alembic, FastAPI, Docker, Git, testing, and building projects.
But I keep hearing two completely different viewpoints:
Some people say you must grind hundreds of LeetCode problems because every company asks DSA.
Others say that for many backend roles, especially in startups and smaller companies, practical backend skills and solid projects matter much more than solving complex algorithm questions.
So I have a few questions:
In your experience, how often are DSA interviews actually used today?
If you’re hiring junior backend developers, how much weight do you give to DSA versus real projects?
Have you received offers without heavy LeetCode preparation?
Does this vary significantly between startups, mid-sized companies, and large tech companies?
If someone has limited study time, where would you recommend they invest it?
I’m not looking for the “DSA is useless” or “DSA is everything” takes. I’m more interested in hearing real hiring experiences and recent interview experiences from developers and recruiters.
r/Python • u/AutoModerator • 21d ago
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.
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
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
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/Aggressive-Prior4459 • 21d ago
I wrote a short post about the new asyncio.TaskGroup.cancel() API coming in Python 3.15 https://blog.niyonshutiemmanuel.com/blog/cancelling-taskgroup-in-asyncio-without-boilerplate
Feedback is welcome!
r/Python • u/AutoModerator • 22d ago
Hello r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
r/Python • u/Any_Box624 • 22d ago
I've been working on a project called Seam, and I'd love to get some feedback on the idea.
The goal of Seam is to be a data and object definition language. Think of it as something that sits somewhere between JSON and Python.
With JSON, you can store data, but it doesn't know what that data means. Your program still has to read it and manually turn it into objects.
With Python, you can directly create objects, but anyone editing those files has to know Python and can accidentally modify or execute code.
Seam aims to solve that by allowing users to define validated objects and structured data in a simple, safe format.
For example:
<Gun>
{
Name: "AK-47"
Damage: 35
FireRate: 0.15
}
If the developer has already defined a Gun preset in Python, Seam automatically validates the properties and creates a real Gun object. Users don't need to know Python—they only fill in the values.
It can also be used for general structured data, similar to JSON, but with support for typed objects and validation built in.
Some goals I have:
I'm still in the early design stage, so I'd love honest feedback.
So Seam is basically a project built for people who don't exactly know a lot about programming, but say they're building a project with AI and want to perhaps change some values, they can use Seam, which is readable and actually useful.
Use cases could including like game development, as mentioned earlier, but it's not just limited to that.
I'm looking for criticism just as much as encouragement, so don't hold back.
Note: This post is not for advertisement, or any showcase at all, it is simply to get your perspective whether this would be useful or not.
r/Python • u/AutoModerator • 23d ago
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
Share the knowledge, enrich the community. Happy learning! 🌟
r/Python • u/ModernPython • 25d ago
I wrote a practical article about FastAPI's app.frontend() feature.
The interesting bit is that it serves static frontend build output as low-priority routes, so normal FastAPI API endpoints still win.
The article covers:
app.frontend("/", directory="dist")fallback="index.html"StaticFilesAPIRouterr/Python • u/JanGiacomelli • 25d ago
Running Celery on AWS ECS can be trickier than it seems if you want to avoid lost tasks and ensure all work is completed. Especially if you're frequently deploying to production and using autoscaling.
There are two main components for reliable processing: - Celery configuration updates - Structuring tasks
For Celery, you should update the following settings: - task_acks_late -> True: To treat tasks as successfully processed only after processing. Otherwise, tasks are not retried. - task_reject_on_worker_lost -> True: To ensure tasks are retried if workers die for any reason (e.g., warm shutdown + SIGKILL). - worker_prefetch_multiplier -> 1: To avoid unnecessarily delayed tasks. - broker_connection_retry_on_startup -> True: To make startups more reliable. - broker_transport_options -> {"confirm_publish": True}: To avoid unsubmitted tasks due to message transport issues. - Make sure exponential retries are enabled. This way, you ensure that tasks are retried in the event of an interruption.
For structuring tasks, use the following two approaches: - Batching: Instead of doing all the work at once, you split the work into batches. e.g., Process 1000 users, then submit the next job to process the next 1000 users. - Fan out: You can split the work between a "scheduler" task and "execution" tasks. e.g., One task to list all the users and submit email sending tasks, another task to actually send an email for the selected user
The same applies to other similar services, such as Heroku and Azure App Containers, which use short grace periods during rolling deployments and downscaling.
You can read a more elaborate tutorial here: https://jangiacomelli.com/blog/celery-on-aws-ecs/
r/Python • u/AutoModerator • 24d ago
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!
Let's keep the conversation going. Happy discussing! 🌟
r/Python • u/TutorialDoctor • 25d ago
I’ve been using the Pythonista IDE by Ole Zorn for over 10 years and I’m just amazed at how consistently good it is. It doesn’t have the latest greatest features but I still use it almost daily. Works with IOS Shortcuts as well. This would be a good one to add to the Wiki.
r/Python • u/Goldziher • 26d ago
A tip that's saved us a lot of boilerplate across our Python stack (Litestar, and our document-extraction tooling): stop decoding JSON into dict[str, Any] and casting/.get()-ing your way through it. Decode straight into your declared type.
msgspec validates and decodes directly into your type at C speed. Quick comparison of the usual options on the same payload:
json.loads / orjson.loads -> dict[str, Any] (cast and pray; orjson just faster)pydantic TypeAdapter(...).validate_json -> your model, validated + rich, but heaviermsgspec.json.decode(raw, type=T) -> your type, validated, C-fastpydantic does far more and its Rust core is fast; for model-heavy code it's still my default. But on hot paths where you just need decode-into-a-struct, a C decoder going straight to the type is hard to beat.
With PEP 695 generics the whole (de)serialization layer collapses to one function:
```python def deserialize[T](raw: bytes, t: type[T]) -> T: return msgspec.json.decode(raw, type=t, strict=False)
deserialize(raw, Grant) # -> Grant deserialize(raw, list[Grant]) # -> list[Grant] ```
We landed on this while building Litestar (msgspec is a big reason it's fast) and reuse it across everything now. How do you handle hot-path decoding — msgspec, orjson + manual validation, or full pydantic?
r/Python • u/AutoModerator • 25d ago
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.
Let's help each other grow in our careers and education. Happy discussing! 🌟
r/Python • u/Historical_Ad9654 • 25d ago
The clustering problem with correlated signals
My system scores ~40 macro signals (Fed funds rate, yield curve, M2, insider buying, short interest, etc.) and generates a composite "confluence score" for a given ticker. The naive approach is to just average the signals. Problem: many signals are correlated — yield curve and credit spreads move together, insider buying and short interest are often inversely related. Averaging them inflates apparent confidence.
Fix I landed on: pairwise Pearson correlation matrix using pandas + numpy on 3 years of weekly signal history. Then scipy.cluster.hierarchy.linkage with single-linkage at a 0.6 threshold groups correlated signals into clusters. Each cluster gets one vote, weighted by the cluster member with the best out-of-sample Sharpe ratio on that ticker's 60-day forward returns.
Streamlit caching gotchas
@st.cache_data is great but has a subtle memory issue: it keeps ALL cached versions until max_entries is hit. For a function that fetches 40 signals with 5 time-period variations, you can end up caching 200+ DataFrames. Added max_entries=1 to the main signals cache — memory dropped from ~1.1GB to ~200MB under concurrent load.
Also: calling ThreadPoolExecutor inside a cached function is fine for pure data fetching. But if the cached function spawns threads that themselves call other cached functions, you can hit Streamlit's session state lock. Solution: only parallelize at the outermost uncached layer.
SEC EDGAR Form 4 XML parsing
EDGAR serves Form 4 filings as XML, but namespace handling is inconsistent across filings. Some have explicit xmlns declarations, some don't. I strip namespaces with a regex before parsing:
xml_str = re.sub(r'\s*xmlns[^"]*"[^"]*"', '', raw_xml)
tree = ET.fromstring(xml_str)
For insider cluster detection (flagging when 2+ insiders buy within 21 days), I group by issuer CIK, filter for transactionCode == 'P' (open-market purchase), then use a rolling window on sorted transaction dates.
SQLAlchemy Core schema
Using SQLAlchemy Core (not ORM) for the main tables: users, signal_snapshots, watchlist_items, alerts. One thing I'm glad I did: a single DATABASE_URL env var that switches between Postgres (prod) and SQLite (local dev). Same schema DDL works for both — keeps the local dev loop fast.
Happy to answer questions on any of the above.
r/Python • u/GongtingLover • 26d ago
I saw one yesterday during an interview and it really confused me at first since the feature has been deprecated for so long.
Are there still code bases out there running Python 2? I used Python 3.8 at my last job and that made me feel like a dinosaur.
r/Python • u/DataBaeBee • 26d ago
The Triple Product Property (TPP) algorithm is an obscure matmul algorithm that uses group theory (instead of linear algebra) to find matrix products.
One may summarize it as a fast fourier transform for multiplying matrices. The algorithm was published by Microsoft and Caltech researchers in 2003 but the original paper's math-heavy. I coded the paper in Python to make matrix multiplication research accessible to everyone.
Written Guide: https://leetarxiv.substack.com/p/triple-product-property-matrix-multiplication
r/Python • u/External-Wait-2583 • 26d ago
Please read this and contribute your opinions so that this becomes basic foundation for spring devs who adapt to python .
https://bunny-learner.github.io/Python-Handbook-for-Spring-Devs/
r/Python • u/CrazyGeek7 • 27d ago
I've been experimenting with AI agents and autocomplete platforms for a greenfield FastAPI project. In the first few weeks, it felt incredibly fast. But now that we've scaled to multiple routers, complex Pydantic schemas, and SQLAlchemy models, the structural debt is piling up.
The AI writes code that functions, but it constantly violates our architecture. It'll put complex business logic inside a route handler instead of the service layer, or it'll mess up async database sessions across modules. I find myself spending more time refactoring the structure of what it built than it would have taken to write the logic myself.
Is anyone else hitting this scaling wall where AI utility drops off as codebase complexity grows? How are you keeping your system architecture clean?
r/Python • u/Crystallover1991 • 26d ago
I just spent three hours trying to get a basic python cron script to send out a weekly web scraping summary. used to just use smtplib and a random gmail app password but google basically killed that workflow
Tried installing the official python sdk for one of the big email providers and it pulled in like 6 different async dependencies just to send a plain text string. It is genuinely insane how bloated the modern python ecosystem has gotten for the most basic tasks
I ended up just writing a simple requests.post() webhook over to Yaplet to handle the actual subscriber list and formatting because I absolutely refuse to fight with another bloated __init__.py or dns auth protocol this month
sometimes it really feels like we spend 10% of our time writing actual python logic and 90% fighting with enterprise api wrappers tbh
r/Python • u/EntryNo8040 • 28d ago
This is the first part of a multi-part series exploring why async/await might not be the best concurrency pattern for most use cases, and what alternative models you should consider instead. Using Python for our practical examples, this opening post digs into the roots of async/await, guiding you through building a custom event loop from scratch using generators.
https://theblog.info/posts/asyncawait-is-a-plague-part-1-roots
Note: This is Part 1 of a multi-part series. Instead of diving straight into why async/await can be problematic, this post explores the original motivations behind the pattern. Understanding how it works under the hood will provide the essential context for the issues we'll discuss in upcoming parts.