/r/pythoncoding
/r/Pythoncoding is a subreddit for advanced Python content. Developers can share articles and news about the Python ecosystem, deep dives into Python intricacies, or showcase advanced projects they are working on.
This sub is currently being cleaned up. Please help by reporting unsuitable content!
/r/PythonCoding a subreddit for advanced Python content. Python developers can share articles and discuss things relevant to the Python programming language, while avoiding chaff like tutorials, courses, books, and blog spam.
In turn, this subreddit has a strict moderation policy for submissions.
For general or beginner content, see /r/Python or /r/LearnPython instead.
If you have an issue with the moderation policy, please send us a message
Don't post:
Full rules: Here
Other Python subreddits:
/r/django
/r/learnpython
/r/madeinpython
/r/python
/r/pythontips
Other related subreddits:
/r/pythoncoding
Hello r/PythonCoding,
I have recently finished building a DIY home security system that supports multiple devices. It works well on old laptops and can use a RaspberryPi Zero W for on-demand pictures and videos (I have found the Zero W too weak for full motion detection with OpenCV).
You can get the source code here: MingSec
Here is some more information about the project:
Features:
Project Structure:
I am in the second stage in the development of my interpeter for math, now I am in the parser stage, the interpeter will be ready soon, it already has a parser and lexer and counts simple math calculations, in the future this interpeter will become a full-fledged programming language, I will be glad for feedback and stars on Github
Github link 🔗 https://github.com/Nikchan5/Math-Interpreter
Hello r/pythoncoding ,
After loads of requests from the FastAPI and Python community, I have launched supa-fast.com
Supafast is a FastAPI boilerplate that is simple, easily extendable and industry tested where you can input configs and get all of this, it is that EASY:
- Built in authentication on top of supabase
- Start accepting payments with Stripe (webhook ready)
- Docs and walkthoughs
- Folder-by-feature set up so you can scale easily
- Deployments with render with a click of a button (AWS, GCP and Azure deployments ready soon)
- uv for super fast package and dependency management
- Fully async database operations with SQLAlchemy + asyncpg + alembic for migrations
Get lifetime access to supafast + all future updates at supa-fast.com with promo code: `SUPAEARLY` for 50% OFF
Thank you!
I’m trying to run the “chromedriver” command on python (selenium). I have the chrome.exe in a folder that I can successfully path on Python, but I can’t fire the “chromedriver” command. I have it blocked as it gets considered suspicious/malware and can’t find a way to disable the block on it. Hopefully someone can help me ✌🏼
Hello everyone. I wanted to share this Discord bot I've been working on called Soupy. It's basically a fun little project that lets you generate images using Flux, and also engage in LLM-based chat. It's written in Python. I'm just a hobbyist coder doing this for fun, but I'm happy to help if you run into issues. This is my first and only project. It's seen many iterations throughout the years.
The main thing Soupy does is generate images using the Flux model - just type /flux with your prompt and it'll create something for you. There are some neat buttons under each image that let you remix it with a new seed, make the prompt fancier, or edit it in various ways. You can also hit "random" and it'll generate a completely random prompt using a combination of themes, characters, and styles (which you can customize if you want). It does this by combining keywords from included files, and then sends those words to the LLM for elaboration. It works extremely well and just spamming the Random button is fun.
The bot also acts as a chatbot using LM Studio as the backend. You can just say "soup" or "soupy" and start chatting, and it also responds randomly at times. It's pretty sarcastic and sometimes jumps into conversations on its own. The personality is set in the .env. It follows the contents of urls/links in the chat, so it's aware of what's going on in the chat. Currently, it reads the last 25 messages of chat history as context for its responses. In the repo, you can see an example of it in action.
There's also a /search command that scrapes Google (using BeautifulSoup, not Google's API) and summarizes it, plus some fun stuff like magic 8-ball, magic 9-ball (LLM powered and weird). And some other little stuff.
You'll need a decent GPU (ideally 24GB VRAM, but you might get by with less) to run the image generation smoothly. The chat part uses LM Studio - I use Lexi Llama Uncensored but you can use whatever model you want. Setup is pretty straightforward: just clone the repo, set up your .env file with your Discord token and local URLs, install dependencies, and you're good to go.
I've got a few different versions in the repo depending on what you want to do. The main new updated one (soupy-remastered.py) does everything locally, but there's also versions that use OpenAI's API or add different features like user profiles. They use OpenAI's API, so use them if you want. But they're also more complicated to setup.
Here's the repo if you want to check it out: https://github.com/sneezeparty/soupy
Let me know if you try it out! And if you have any ideas for making it better, I'm all ears.
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
Has anyone been able to figure out how to write to a file on your local network with a message to Alexa?
This library (tries) to make decentralized networking easy. I'm open to suggestions and contributors and would love to find others that are interested in this topic!
Hey r/pythoncoding!
I just wanted to share a fun little project I’ve been working on – FlaskBlog! It’s a simple yet powerful blog app built with Flask. 📝
What’s cool about it?
You can check it out, clone it, and get it running in just a few steps. I learned a ton while building this, and I’m really proud of how it turned out! If you’re into Flask or just looking for a simple blog template, feel free to give it a try.
Would love to hear your feedback, and if you like it, don’t forget to drop a ⭐ on GitHub. 😊
Thanks for checking it out!
I have a model.h5 and I want to use it on my site, so I want to convert it to TensorFlow JS. For this, I need to use the tensorflowjs_converter. I tried installing tensorflowjs with the following command:
sudo pip install tensorflowjs --break-system-packages
But when I try to run the command to convert, this is what I get:
ice@ice-Mint-PC:~$ tensorflowjs_converter --input_format keras "/home/ice/Downloads/handwritten (1).h5" \
/home/ice/Desktop
tensorflowjs_converter: command not found
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
Whenever I'm researching or studying anything, I tend to save a ton of content. It could be a cool article link, a fact someone mentioned in my chats or a blog post about it. But organizing all this content and then effectively researching or learning from it is a difficult task. That’s where SurfSense comes in. SurfSense acts like a personal brain for any content you consume, allowing you to easily revisit, organize, and effectively research and learn from your saved content.
Check it out at https://github.com/MODSetter/SurfSense
Well my project have 3 things where extension and frontend is made in JS but core backend is made in python with LangChain and FastAPI.
If any good python devs could go through my backend and suggest some tips to improve it would be great.
And if u know any good resources about WebSockets implementation with FastAPI do mention in comments.
Researchers, Students or Anyone who consume a lot of content
We’re excited to announce Maelstrom 0.12.0, a test runner for Python that can run tests locally or on a cluster. Our new UI features real-time information about running tests, output from the build, and a new progress bar.
Maelstrom is a suite of test runners, built on top of a general-purpose clustered job engine. Maelstrom packages your tests into micro-containers, then distributes them to be run on an arbitrarily large cluster of test-runners, or locally on your machine using a custom-built, super-fast container runtime.
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
Hey everyone! I am Dinones! I coded a Python program using object detection that lets my computer hunt for shiny Pokémon on my physical Nintendo Switch while I sleep. So far, I’ve automatically caught shiny Pokémon like Giratina, Dialga or Azelf, Rotom, Drifloon, all three starters, and more in Pokémon BDSP. Curious to see how it works? Check it out! The program is available for everyone! Obviously, for free; I'm just a student who likes to program this stuff in his free time :)
The games run on a Nintendo Switch (not emulated, a real one). The program gets the output images using a capture card, then, it process them to detect whether the pokemon is shiny or not (OpenCV). Finally, it emulates the joycons using bluetooth (NXBT) and control the Nintendo. Also works on a Raspberry Pi!
I don't make money with this, I just feel my project can be interesting for lot of people.
📽️ Youtube: https://www.youtube.com/watch?v=84czUOAvNyk
🤖 Github: https://github.com/Dinones/Nintendo-Switch-Pokemon-Shiny-Hunter
Well when I’m browsing the internet, I tend to save a ton of content—but remembering when and what you saved? Total brain freeze! ❄️ That’s where SurfSense comes in. SurfSense is like a Knowledge Graph 🧠 Brain 🧠 for anything you see on the World Wide Web. Now, you’ll never forget any browsing session. Easily capture your web browsing session and desired webpage content using an easy-to-use Chrome extension. Then, ask your personal knowledge base anything about your saved content., and voilà—instant recall! 🧑💻🌐
The whole backend is made in FastAPI & Langchain in Python.
Do give it a try : https://github.com/MODSetter/SurfSense
and lmk what is your feedback/suggestions.
I have been coding for a long time in Python, but I recently started college to get my bachelor's. My teacher made these comments, and I am not sure how to improve. While I did not get a bad grade, he deducted points, and dont want to make the same mistake.
Cmmments from my teacher:
Your code is clear and easy to understand—great job!
Questions:
How can I add more indentations with Python, as it needs to be indented in a certain way?
What comments can I make about the code, specifically the "complex " parts, as this is a basic example and not complex?
My code:
class BudgetCalculator:
def __init__(self):
self.monthly_income = 0
self.fixed_expenses = 0
self.variable_expenses = []
def gather_user_data(self):
try:
self.monthly_income = float(input("Enter your monthly income: "))
self.fixed_expenses = float(input("Enter your fixed monthly expenses (e.g., rent, utilities): "))
while True:
var_expense = input("Enter a variable expense (or type 'done' to finish): ")
if var_expense.lower() == 'done':
break
expense = float(var_expense)
if expense < 0:
print("Expense cannot be negative, please re-enter.")
else:
self.variable_expenses.append(expense)
except ValueError:
print("Invalid input. Please enter numeric values.")
def calculate_total_variable_expenses(self):
return sum(self.variable_expenses)
def calculate_remaining_budget(self):
total_variable_expenses = self.calculate_total_variable_expenses()
if self.fixed_expenses < 0 or total_variable_expenses < 0:
raise ValueError("Expenses cannot be negative.")
if self.monthly_income < (self.fixed_expenses + total_variable_expenses):
raise ValueError("Expenses exceed income.")
remaining_budget = self.monthly_income - (self.fixed_expenses + total_variable_expenses)
return remaining_budget
def display_result(self):
try:
remaining_budget = self.calculate_remaining_budget()
print(f"Your remaining budget for the month is: ${remaining_budget:.2f}")
except ValueError as e:
print(e)
def main():
budget_calculator = BudgetCalculator()
budget_calculator.gather_user_data()
budget_calculator.display_result()
if __name__ == "__main__":
main()
Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!
If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.
You can find it at Stava.io, looking forward to the feedback! :)