/r/Python
If you have questions or are new to Python use r/LearnPython
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
Online Resources
Five life jackets to throw to the new coder (things to do after getting a handle on python)
PyMotW: Python Module of the Week
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
/r/Python
Hi all -
Has anyone used Spotipy? I'm just a bit concerned that I'd be giving my username and password to something I haven't wrote myself - I'm used to using random scripts off github, but it gives me pause to hand over my details
am I just being silly?
Hello, I have build a motion visualizer in python as a CLI script.
What My Project Does: It extracts frames from a video, offsets them and blends them using difference (blend mode from Image and Video Editing Software), applies a few filters and exports a new video.
Target Audience: This is for anyone willing to use it, mostly for fun. If you are comfortable with running scripts in a terminal, you are the target audience. I have mostly created it to see the movement of my vape clouds and that is fun and interesting.
Comparison: As this process can be achieved in any video editing software, even blender, there is not much of a comparison. The only thing that my project does, is the post processing. It just runs contrast and denoise, but that brings out details, which video editing software mostly won't give you (At least from my experience).
This was just a fun project for me which got me to learn and understand tqdm and opencv2.
Check it out at my Github Repo: https://github.com/TheElevatedOne/pymo
I started off with creating a CLI app and want to slowly move into making a desktop app, a web app, and a mobile app so I can just host my db and encryption key somewhere and be done with it. I was wondering if anyone can take a peek and give me some criticisms here and there since I don't normally create apps in python: https://github.com/mariaalexissales/password-manager
Are companies looking for freelance Python developers for hourly or statement of work, fixed price scripting work from places other than Upwork or Fiver or similar sites?
Hey everyone im starting a new YouTube series where i condense an hour of coding into just one minute. The goal is to show the process of creating projects quickly and engagungly but without dragging things out.
Youtube Link: https://youtu.be/dXljs-eWn3E
The first video covers an hour of work on a Python project where i start and finish a program from scratch. My plan is to release more of these, gradually increasing the time spent coding, like "2 Hours of Coding in 2 Minutes", and so on.
So any and all feedback is appreciated as i also want this Youtube channel to serve as proof to potential employers that i know what im doing and im also very passionate about it in ways where im happy to learn to further increase my knowledge.
Thanks for checking it out if your reading this im looking forward to hearing your thouhgts
I wrote a post of developer tooling I like at the moment: https://pydevtools.com/blog/effective-python-developer-tooling-in-december-2024/
hey, i did the ib diploma in highschool and for my computer science project i made a simple 2d game, but due to deadlines i kinda rushed it, (here is the github link) now that i finished highschool i have more time and id like to redo it from scratch and do something that im proud of, if you could give me any tips on what i could add and how to improve it it would be extremely helpful, thank you everyone and have a wonderful weekend.
Hey everyone!
I’m thrilled to announce TSignal 0.4.0, a pure-Python signal/slot library that helps you build event-driven applications with ease. TSignal integrates smoothly with async/await, handles thread safety for you, and doesn’t force you to install heavy frameworks.
You can now connect a slot with weak=True. If the receiver object is garbage-collected, TSignal automatically removes the connection, preventing memory leaks or stale slots in long-lived applications:
# Set weak=True for individual connections
sender.event.connect(receiver, receiver.on_event, weak=True)
# Or, set weak_default=True at class level (default is True)
@t_with_signals(weak_default=True)
class WeakRefSender:
@t_signal
def event(self):
pass
# Now all connections from this sender will use weak references by default
# No need to specify weak=True for each connect call
sender = WeakRefSender()
sender.event.connect(receiver, receiver.on_event) # Uses weak reference
# Once `receiver` is GC’d, TSignal cleans up automatically.
A new connection parameter, one_shot=True, lets you disconnect a slot right after its first call. It’s handy for “listen-once” or “single handshake” scenarios. Just set:
signal.connect(receiver, receiver.handler, one_shot=True)
The slot automatically goes away after the first emit.
TSignal’s internal locking and scheduling mechanisms have been refined to further reduce race conditions in high-concurrency environments. This ensures more robust behavior under demanding multi-thread loads.
We’ve expanded TSignal’s examples to guide you from simple demos to full-fledged applications. Each example has its own GitHub link with fully commented code.
For detailed explanations, code walkthroughs, and architecture diagrams of these examples, check out our Examples Documentation.
signal_basic.py and signal_async.py
signal_function_slots.py and signal_lambda_slots.py
Together, these examples highlight TSignal’s versatility—covering everything from quick demos to production-like patterns with threads, queues, and reactive UI updates.
Pure Python, No Heavy Frameworks TSignal imposes no large dependencies; it’s a clean library you can drop into your existing code.
Built for modern asyncio workflows; you can define async slots that are invoked without blocking your event loop.
Signals are dispatched to the correct thread or event loop behind the scenes, so you don’t have to manage locks.
Connect to class methods, standalone functions, or lambdas. Use strong references (the usual approach) or weak=True.
We’ve invested heavily in test coverage, plus we have real-world examples (including a GUI!) to showcase best practices.
from tsignal import t_with_signals, t_signal, t_slot
@t_with_signals
class Counter:
def __init__(self):
self.count = 0
@t_signal
def count_changed(self):
pass
def increment(self):
self.count += 1
self.count_changed.emit(self.count)
@t_with_signals
class Display:
@t_slot
def on_count_changed(self, value):
print(f"Count is now: {value}")
counter = Counter()
display = Display()
counter.count_changed.connect(display, display.on_count_changed)
counter.increment()
# Output: "Count is now: 1"
If you’re building async or threaded Python apps that could benefit from a robust event-driven approach, give TSignal a try. We’d love to know what you think—open an issue or share your experience!
Thanks for checking out TSignal 0.4.0, and happy coding!
Hello guys I am Dharshan, a final year computer science student. In this video, I have share my detailed interview experience with Tredence, where I secured a Data Analyst job offer for 10 LPA! for which I used python to crack the coding questions. I'll be joining in 2025, and I’m excited to walk you through my journey. I have already posted 3 interview experience videos on my channel and the next one will be amazon interview experience. https://youtu.be/aeLL29SHBGw?si=9CULGR5plBDWs-jg
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! 🌟
ShortMoji is a lightweight, open-source program that lets you insert emojis anywhere using simple, intuitive keyboard shortcuts. Inspired by Discord's emoji system, it supports 89 unique emoji shortcuts (and counting!) to make your conversations and workflows more expressive.
Simply type a shortcut like :smi
, and it transforms into 😃 instantly. ShortMoji runs in the background and is designed for speed and ease of use.
Features include:
Esc
twice.ShortMoji is for anyone who loves emojis and wants a faster way to use them. Whether you're:
While there are other emoji tools available, ShortMoji sets itself apart with:
Unlike system-level emoji menus or bloated applications, ShortMoji is a focused solution for quick and easy emoji input.
🎉 Try ShortMoji Now!
Download it on GitHub and join the emoji revolution!
I'm committed to regularly updating ShortMoji with new emojis and features. Contributions are welcome—submit pull requests or suggest ideas to help it grow! What features or emojis would you like to see next? Let me know! 🚀
I have been working on a terminal music player for Linux and Windows. Feel free to suggest or report bugs on GitHub.
What does my project do: It's meant to be a simple, lightweight music player that runs right in your terminal. It's main purpose is to play music randomly and stay out of your way, you just drop music into your music folder and let it play.
Target Audience: Mostly meant for slightly tech savvy people who want something that won't take up a ton of resources, it only uses ~60mb of RAM on my system.
Comparison: I'd compare it to VLC Media player, what I think bnap4000 does better is with simplicity. It has a very simple UI that shows what song is playing, a couple things like volume, a progress bar, and a queue.
GitHub page: https://github.com/0hStormy/bnap4000
bnap stands for Badass New Audio Player if you were wondering.
Hey folks! I built shrlnk.icu, a free tool that lets you create and customize short links.
What My Project Does: You can tweak pretty much everything - from the actual short link to all the OG tags (image, title, description). Plus, you get to see live previews of how your link will look on WhatsApp, Facebook, and LinkedIn. Type customization is coming soon too!
Target Audience: This is mainly for developers and creators who need a simple link customization tool for personal projects or small-scale use. While it's running on SQLite (not the best for production), it's perfect for side projects or if you just want to try out link customization without breaking the bank.
Comparison: Most link customization services out there either charge around $25/month or miss key features. shrlnk.icu gives you the essential customization options for free. While it might not have all the bells and whistles of paid services (like analytics or team collaboration), it nails the basics of link and preview customization without any cost.
Tech Stack:
Want to try it out? Check it at shrlnk.icu
If you're feeling techy, you can build your own by following my README instructions.
GitHub repo: https://github.com/nizarhaider/shrlnk
Enjoy! 🚀
Hello everyone 👋
I built gnome-libravatar today, a small python script that fetches avatar from libravatar (or gravatar) and sets it as user profile in gnome.
What My Project Does
/var/lib/AccountCenter/user/<username>
Icon
entrysystemd
file that runs on every reboot to refresh the avatar.Target Audience
This project is for power linux users, those who want to have one profile picture but see it everywhere.
Comparison
There is no alternative project that does this.
GitHub: https://github.com/baseplate-admin/gnome-libravatar
I would love if you guys take a look at the project
I did my first attempt in Rust, but that was following along a tutorial that wasn’t very well explained. Then I followed another person on YouTube who was reading through the book Crafting Interpreters. I followed along with them in Rust but kept finding myself fighting the language and spending way too much time just making sense of Rust constructs.
So, I decided to go back to first principles and make it in Python instead to see how far I could get in a month. I only spend about 2 hours a week on it, depending on my mood.
Happy to say I’ve now got something Turing complete! I’ve got loops, branching conditionals, procedures, and even some built-in functions.
Next, I’m planning to write the same thing again in Go once I properly understand classes etc. Hoping to get something multithreaded going (looking at you, GIL).
Thanks for reading my rant! If you’re curious, here’s the repo: GitHub Link.
I am interested in knowing if anyone is building on top of python NoGIL. I have seen a few async frameworks being built but do not see anyone taking advantage of NoGIL python.
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! 🌟
This is my first ever public python package, it is a job/task management queuing system using sqlite.
Using a worker, jobs are picked up off the queue, manipulated/edited, then reinserted.
It is meant to replace messaging services like RabbitMQ or Kafka, for smaller, lightweight apps. Could also be good for a benchmark tool, to run several processes and use the sqlite database to build reports on how long n number of processes took to run.
Devs looking to not have to use a heavier messaging service, and not having to write your own database queries with sqlite to replace that.
I don't know of any packages that do queuing/messaging like this, so not sure.
Feel free to give it a try and leave it a star if you like it, also feel free to submit a PR if you are having issues.
i’m running a scraping tool via python that extracts network response from requests that return 403 errors. i started using selenium wire and i got it to work, but the main issue is the memory increasing more and more the longer i run it.
i’ve tried everything in order for it to not increase in memory usage, but ive had no success with it.
i’m wondering if anyone has had this problem and found a solution to access these requests without memory increasing over time. or if anyone has found another solution.
i’ve tried playwright and seleniumbase, but i didn’t have success with those.
thank you.
Hi everyone! I've been working in the controlling department of my company for about 3 months. Generally, apart from SAP, I'm terrified by the amount of Excel, the amount of files that I prepare for analyses for other departments. Of course, every excel has queries from SQL... I'm thinking about switching to Python, but I'm afraid that people won't understand it. I used to work on production analyses, I did a lot of "live" Power BI reports and in Python for my calculations. My goal is to replace Excel with Python.
LiveKit is a platform for building real-time applications (livestreaming, virtual meetings, etc.). They have an "AI agents" framework that allows you to add programmatic agents to your app to interact with the real-time data.
I wrote this tutorial on how you can use this to add an AI agent that transcribes speech in real time and prints it in the chatbox:
Let me know what you think!
Master the Fundamentals of Python is a comprehensive course that I was recently selling for $99 but have now released for free.
The course comes with:
This is a college-level course that requires over 50 hours of effort to complete.
Modules
Hi everyone!
I’ve done many projects like creating visualizations in Tableau and performing analysis using SQL and Python. While these are great for showcasing on LinkedIn, I feel they might not stand out enough on my resume.
I’m looking for ideas for data analysis projects that could really make an impression on potential employers. What kinds of projects would you suggest that go beyond the basics and demonstrate real value?
Thanks in advance for your suggestions! 😊
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! 🌟
Hey Everyone 👋
I recently built Amurex, a self-hosted AI meeting copilot that actually works:
What My Project Does
Amurex is a self-hosted AI meeting copilot that:
It’s open source, self-hosted, and ensures full data privacy with no subscriptions or vendor lock-in. And of course, it uses Robyn as the backend ;)
Target Audience
Perfect for professionals, privacy-conscious users, and open-source enthusiasts who want smarter meeting tools.
Comparison
Feature | Amurex | Others |
---|---|---|
Real-Time Suggestions | Yes | No |
Seamless Recording | Yes | Bot interruptions |
Self-Hosted Privacy | Full control | Third-party servers |
GitHub: https://github.com/thepersonalaicompany/amurex
Website: https://www.amurex.ai/
Would love to know what you all think of it. 😊
I am looking forward to implement a trading strategy, I have computer science background having skilled in python and JavaScript. My concern is that I am not able to find the best platform or framework to create an algo trading software. I have tried pine script but I think it is not quite customisable in comparison with python. But as I moved to exploring options that are available in python, I found backtrader, quant connect, blueshift, and many more but still I am not able to completely understand from where will I be able to achieve my last goal. I am looking for a push from where I can start from an expert who is in this field from many years. Thanks
I have to create a website, which consists of content pages fuelled by a CMS, and some other pages which are basically CRUD applications. Which CMS is the easiest to extend or merge with own development: Django CMS, Wagtail or Mezzanine?
Besides good developer experience I also need good documentation.
I am writing an open-source library that simplifies CRUD operations for PostgreSQL. The most similar library would be SQLAlchemy Core.
I plan to benchmark my library against SQLAlchemy ORM, SQLAlchemy Core, and SQLModel. I am unsure about the setup. I have the following considerations:
- Local DB vs Remote DB. Or both?
- My library depends on psycopg. Should I only use psycopg for the others?
- Which test cases should I cover?
- My library integrates pydantic / msgspec for serialisation and validation. What' the best practice for SQLAlchemy here? Do I need other libraries?
What are your opinions. Do you maybe have some good guidelines or examples?
My library is not yet released but quite stable. You can find more details here:
Github: https://github.com/dakivara/pgcrud
Docs: https://pgcrud.com
Wondering if anyone here has coded a checkout bot on python? I'm looking to see if someone can code me one before purchasing one online. It seems that there isn't any great options online really. And the difficulties of coding this i believe is out of my realm as I only ever took a high-school coding class.