Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
The Inner Workings of Python Dataclasses Explained
Ever wondered how those magical dataclass decorators work? Wonder no more! In my latest article, I explain the core concepts behind them and then create a simple version from scratch! Check it out!
https://jacobpadilla.com/articles/python-dataclass-internals
(reposting since I had to fix a small error in the article)
/r/Python
https://redd.it/1hl8qrf
R Automating the Search for Artificial Life with Foundation Models
Happy to release this new work, Automating the Search for Artificial Life with Foundation Models, right before the holiday season!
Blog: https://sakana.ai/asal/
Paper: https://arxiv.org/abs/2412.17799
Website version of paper: https://pub.sakana.ai/asal/
GitHub: https://github.com/SakanaAI/asal
Abstract
With the recent Nobel Prize awarded for radical advances in protein discovery, foundation models (FMs) for exploring large combinatorial spaces promise to revolutionize many scientific fields. Artificial Life (ALife) has not yet integrated FMs, thus presenting a major opportunity for the field to alleviate the historical burden of relying chiefly on manual design and trial-and-error to discover the configurations of lifelike simulations. This paper presents, for the first time, a successful realization of this opportunity using vision-language FMs. The proposed approach, called Automated Search for Artificial Life (ASAL), (1) finds simulations that produce target phenomena, (2) discovers simulations that generate temporally open-ended novelty, and (3) illuminates an entire space of interestingly diverse simulations. Because of the generality of FMs, ASAL works effectively across a diverse range of ALife substrates including Boids, Particle Life, Game of Life, Lenia, and Neural Cellular Automata. A major result highlighting the potential of this technique is the discovery of previously unseen Lenia and Boids lifeforms, as well as cellular automata that are open-ended like Conway's Game of Life. Additionally,
/r/MachineLearning
https://redd.it/1hl4o42
A smart dollhouse that understands natural language commands and uses MicroPython, REST, LLMs
What My Project Does: I created a smart dollhouse that can understand commands in any language and control IoT devices through natural conversation. Using a Raspberry Pi Pico W running MicroPython, I implemented a REST API server that controls LEDs, motors, and sensors. The system uses LLMs to translate natural language commands (in any language!) into API calls. For example, you can say "turn on the yellow LED" in English, "выключи желтый led" in Russian, or "Apaga la led amarilla" in Spanish, and the system will understand and execute the command.
Target Audience: This is primarily an educational/demonstration project aimed at:
Python developers interested in IoT and LLMs
Makers and hobbyists looking to experiment with natural language interfaces
Anyone learning about REST APIs and microcontrollers
Students and educators exploring practical applications of LLMs
Comparison: While there are many IoT projects using voice assistants like Alexa (which I started with), my approach differs in several ways:
1. Language Flexibility: Unlike Alexa, which requires exact phrases, this system understands natural language in any language
2. Lightweight Implementation: Uses Microdot instead of Flask, making it suitable for microcontrollers
3. HATEOAS Implementation: Implements proper REST API design principles for better discoverability
4. Open Architecture: Unlike commercial solutions, this is fully
/r/Python
https://redd.it/1hkxil3
It took me way longer than I'd like to admit to realize how crucial setting up CustomUser is before the first migration.
When I built my first solo Django project, one of the biggest headaches I ran into—and the first thing that made me cry into my coffee—was thinking I had set up the custom user model correctly, only to be hit with a bunch of errors. After some confusion, I realized that since I’d already made migrations, my only choices were to refactor my database or delete it and start over. It was extra terrible because I thought I was done with the project, but failing to set up the custom user model properly ended up costing me another four hours of work. It really made me panic and feel like my whole project was doomed.
Recently I’ve been thinking about what beginners might need to help them learn Django in the smoothest and fastest way possible, and felt that helping them avoid this mistake could be really helpful. So I made a YT video where I basically beg people to set up a custom user and quickly show them how - as it really just takes seconds.
For anyone else who’s had a similar experience, what was your "Django nightmare" moment? Any tips you’d give to those just starting out?
/r/django
https://redd.it/1hk18b7
Hi guys! Today I am releasing my first project and wanted some reviews on it.
What My Project Does:
My project is a simple but useful life manager, some of the things that you can do on it are:
ADD TASKS: You can add some task with a time limit and coin reward, ex: "Study for the finals, 2 days, 50 coins".
CREATE REWARDS: Also, you can create buyable rewards in the shop, example: "Watch a movie, cost: 40 coins".
KEEP TRACK OF YOUR PRODUCTIVITY: The system automatically keep track of the amount of tasks completed by day and plot them at a graph.
Target Audience:
Its meant for anyone that struggles with procrastination and productivity.
Comparison:
I wanted to create my own to make it as simple as possible to use, at the same time of maintaing the important features, tasks tracking and a clear UI
If you have some suggestion I would love to hear it and I really hope that this project helps someone out there.
So, if you want to take a look at it, its in my github at this link: https://github.com/Gabriel-Dalmolin/life\_manager
/r/Python
https://redd.it/1hkvb0z
Error while connecting to MySql database in PythonAnywhere.
https://redd.it/1hkusrd
@pythondaily
Error when trying to use Flask Migrate "Error:no such command 'db'C:\Users\Shimb\Documents\JUKIT_FLASK_PD>flask db init
Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
File "C:\Users\Shimb\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\cli.py", line 245, in locate_app
__import__(module_name)
File "C:\Users\Shimb\Documents\JUKIT_FLASK_PD\app.py", line 3, in <module>
from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'
Usage: flask [OPTIONS] COMMAND [ARGS]...
Try 'flask --help' for help.
Error: No such command 'db'.
/r/flask
https://redd.it/1hkc14i
AndroidSecretary - Your personal, context-aware AI SMS secretary for Android
Hello!
I just released a new project of mine, AndroidSecretary. It uses Flask for its backend, so Python was yet again of great use for this!
What My Project Does
This project provides you with an AI assistant that responds to your SMS messages contextually. It is customizable and can respond for you when you are not available.
Target Audience
Anyone with an Android device supported by the Automate app can have fun and utilize Android Secretary.
Also, this is not meant to be used by the average person. It is meant for developers to use for educational purposes only.
Comparison
So far, there are not many (if any) projects that do what AndroidSecretary does. For reference of features:
1. Ollama & OpenAI Support (with ollama, an external computer more powerful than the phone is likely needed to run more context-wise LLM's, unless you have a phone at least 12 GB of RAM)
2. Context-based assistant responses to messages received.
3. Customization:
1. Name your assistant
2. Limit the max amount of messages per hour per user
3. Blacklist and allowlist features (allowlist overrides blacklist)
4. Block spam feature (provided you give phone contact permissions to Automate)
/r/Python
https://redd.it/1hk6mjr
Do you prefer react or svelte with your django app and why?
What are the pros and cons of both?
I want to build micro saas products for ideas I have. MVPs with the above mentioned technologies. My goal is to become a full stack dev eventually.
/r/django
https://redd.it/1hkgfkn
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:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) 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](https://www.youtube.com/watch?v=a37BL0stIuM)
# 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](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## 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](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1hkb8wt
D Self-Promotion Thread
Please post your personal projects, startups, product placements, collaboration needs, blogs etc.
Please mention the payment and pricing requirements for products and services.
Please do not post link shorteners, link aggregator websites , or auto-subscribe links.
--
Any abuse of trust will lead to bans.
Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
--
Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.
/r/MachineLearning
https://redd.it/1hjq0bm
Creating my own password manager bc I can
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
/r/Python
https://redd.it/1hjjkrx
Spotipy - has anyone used it before?
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?
/r/Python
https://redd.it/1hjkpex
Django Custom User Model Migration Issue - "Lazy Reference to 'users.CustomUser'"
Hello, I'm working on a Django project where I've implemented a custom user model by subclassing AbstractUser
. In my `settings.py`, I've correctly set AUTH_USER_MODEL = 'users.CustomUser'
. However, when I run the migrations, I get the following error: ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'users.customuser', but app 'users' doesn't provide model 'customuser'.
I’ve already made sure that the CustomUser
model is correctly defined in users/models.py
, and the app is listed in INSTALLED_APPS
. I've also run makemigrations
for the users
app, but I’m still encountering this issue.
Has anyone experienced this before or can help me figure out why Django can't find the CustomUser
model? Any advice would be greatly appreciated!
/r/django
https://redd.it/1hjuz9e
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? 🛠️
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!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1hjmlmy
Sec Bot: Configurable Discord Bot that notifies you of new filings
What my project does:
Discord Bot that monitors the SEC for new filings, and pushes it to the discord channel(s) of your choice.
Features:
Filter by submission type (e.g. form 3,4,5, 10-K, etc.)
Filter by company (e.g. Apple, META,...)
Target Audience:
People interested in finance, stocks, investing, who want a free (open-source) way to keep track of regulatory disclosures.
Comparison:
I'm not aware of other open source solutions. There is a free solution provided by CapEdge, but they limit how many companies / form types you can keep track of.
Links: GitHub
/r/Python
https://redd.it/1hktpqa
☕ BeatPrints, create eye-catching, pinterest-style music posters effortlessly
Github | Documentation
Hey r/Python !
I just released a project called BeatPrints, a tool for creating pinterest-style music posters for your favorite tracks. It pulls data from Spotify, grabs lyrics using lrclib’s API, and lets you generate posters that really stand out.
# What My Project Does
BeatPrints makes it simple to generate beautiful music posters for free. It fetches songs or albums from Spotify and lets you create custom lyric-based or album-themed posters.
# Target Audience
This is for anyone who loves collecting song posters as keepsakes or wants unique music art to decorate their room. It's a very niche project, as you can see.
# Comparison
Unlike paid services like Etsy, BeatPrints is completely free, open-source :>
I made this tool so people can easily create music posters without spending money. Check it out and let me know what you think!
/r/Python
https://redd.it/1hl6eck
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:
1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **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](#daily-beginner-thread-link) 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](https://discord.gg/python) for quicker assistance.
## Example Questions:
1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the
/r/Python
https://redd.it/1hl0y7q
Athens Greece backend/frontend devs
Any Django devs on here based in Athens, Greece? I'm at a small startup, Django/Vue tech stack, trying to decide where to build out our engineering team (Warsaw vs Athens).
Anyone I could take for lunch in the new year to get some scuttlebutt on the dev market in Athens?
Looking for insight on:
1. Quality / depth of the talent market - are the best people still here or most emigrated in the crisis?
2. Where Devs look for jobs
3. Who are the local employers known for having the best talent
4. Typical salaries for top people that love writing code
5. Popular events / meetups / conferences
/r/django
https://redd.it/1hklfqu
Experiments in scaling RAPIDS GPU libraries with Ray
Experimental work scaling RAPIDS GPU Python libraries with Ray:
https://developer.nvidia.com/blog/accelerating-gpu-analytics-using-rapids-and-ray/
/r/Python
https://redd.it/1hkpel4
Tailwind/Bootstrap with Svelte
Currently searching for a frontend framework to use alongside Django. I have become comfortable with Svelte, but I am wondering if there is a way to use tailwind or bootstrap to speed up the procedure of implementing simple designs, while utilizing svelte for more complex ones in the same project. Is it going to work and if yes are there any cons?? If you have any other suggestions let me know...
/r/django
https://redd.it/1hkqi39
Looking For A Programming Friend
Hi everyone,
I'm about to start learning Django and would love to connect with someone who is also just starting out or aiming to build a strong command of the Django framework. I'm a beginner coder in my second semester of Computer Science, with a decent understanding of Python, Java, and JavaScript.
If you're interested in learning Django together, sharing knowledge, and collaborating on projects, leave a comment below or DM me. Let’s grow and master Django as a team!
Looking forward to connecting with like-minded learners. 😊
/r/djangolearning
https://redd.it/1hk9w8b
Python Youtube album downloader (Downloads video and splits it up into songs based on timestamps)
Purpose: Chrome fuckin sucks with memory so listening to music on YouTube uses so much ram. During exams, it gets kinda long and the amount by which it heats up gets me scared. BUTTTTT, Spotify is much better at playing music, so if only there was a way to listen to videos only on YouTube but on Spotify instead????? (there probably is but I couldn't find one that did it my way).
What My Project Does: A Python script that allows you to download an album from YouTube and split it up into songs, using a timestamps file as a reference. Note the "album" must be a YouTube video and not a playlist unfortunately :(
Target Audience: This is for anyone willing to use it. I kinda created it for myself but thought to post it here anyways
Comparison: Uses a lot of ffmpeg, so I guess that's the similar program? It's not exactly on par with any crazy video editing software but it does the job.
The only thing that kinda sucks is that the timestamps have to be in a certain format otherwise it wont work, I couldn't be asked/ couldn't think of a way to make a REGEX for it. But yh
/r/Python
https://redd.it/1hkazgu
PipeFunc: Build Lightning-Fast Pipelines with Python - DAGs Made Easy
Hey r/Python!
I'm excited to share pipefunc
(github.com/pipefunc/pipefunc), a Python library designed to make building and running complex computational workflows incredibly fast and easy. If you've ever dealt with intricate dependencies between functions, struggled with parallelization, or wished for a simpler way to create and manage DAG pipelines, pipefunc
is here to help.
What My Project Does:pipefunc
empowers you to easily construct Directed Acyclic Graph (DAG) pipelines in Python. It handles:
1. Automatic Dependency Resolution: pipefunc
intelligently determines the correct execution order of your functions, eliminating manual dependency management.
2. Lightning-Fast Execution: With minimal overhead (around 15 µs per function call), pipefunc
ensures your pipelines run blazingly fast.
3. Effortless Parallelization: pipefunc
automatically parallelizes independent tasks, whether on your local machine or a SLURM cluster. It supports any concurrent.futures.Executor
!
4. Intuitive Visualization: Generate interactive graphs to visualize your pipeline's structure and understand data flow.
5. Simplified Parameter Sweeps: pipefunc
's mapspec
feature lets you easily define and run N-dimensional parameter sweeps, which is perfect for scientific computing, simulations, and hyperparameter tuning.
6. Resource Profiling: Gain insights into your pipeline's performance with detailed CPU, memory, and timing reports.
7. Caching: Avoid redundant computations with multiple caching backends.
8. Type Annotation Validation: Ensures type consistency across your pipeline to catch errors
/r/Python
https://redd.it/1hk85dp
Automated generation of categories for classification D
So I can use Bart zero-shot classification to quantify the relevance of an article to a predefined set of categories but I have a bunch of articles and I want to compute categories from them and then use those categories to classify lots of articles.
I thought maybe I could convert each article to a vector using a text embedding and then use an unsupervised learning algorithm to compute clusters of related articles and then project the groups back into text, maybe by recursively summarizing the articles in each group. However, I don't actually want the constraint that sets of categories must be disjoint which, I think, k-means would impose.
How else might this be accomplished?
/r/MachineLearning
https://redd.it/1hkc5d1
Looking for remote Django developer (contractor)
I'm looking for a Django Web Developer (backend and frontend) to work at SadServers as a contractor that can lead into a part-time or full-time role.
We use Bootstrap, Celery, REST API and Boto3 among other technologies, see our GitHub repo at [https://github.com/sadservers/sadservers](https://github.com/sadservers/sadservers) for details.
The main qualification is to have made significant code contributions to professional Django websites and be able to communicate well. Many things are a bonus, like having experience with our stack / Linux / AWS / SaaS.
There are no interviews with low signal questions like "why do you want to work for us?" or "what's your biggest weakness?", also no factoid technical questions that can be looked up quickly with a web search or an AI agent.
The process is straight-forward:
* Fill out this form: [https://docs.google.com/forms/d/1Y-ESW0rrlbh24B5vnbTamHN5w6toT-WIyipLPKTEIsY/](https://docs.google.com/forms/d/1Y-ESW0rrlbh24B5vnbTamHN5w6toT-WIyipLPKTEIsY/)
* If there's an initial good fit, we'll have one call to discuss what we need and for you to show us and talk about your work.
* If we are both happy, we'll send you an initial short real task to perform on our code and payment for it.
Thanks!
/r/django
https://redd.it/1hkb4x4
Pivot from Flask
Hey everyone,
I recently built an app using Flask without realizing it’s a synchronous framework. Because I’m a beginner, I didn’t anticipate the issues I’d face when interacting with multiple external APIs (OpenAI, web crawlers, etc.). Locally, everything worked just fine, but once I deployed to a production server, the asynchronous functions failed since Flask only supports WSGI servers.
Now I need to pivot to a new framework—most likely FastAPI or Next.js. I want to avoid any future blockers and make the right decision for the long term. Which framework would you recommend?
Here are the app’s key features:
Integration with Twilio
Continuous web crawling, then sending data to an LLM for personalized news
Daily asynchronous website crawling
Google and Twitter login
Access to Twitter and LinkedIn APIs
Stripe payments
I’d love to hear your thoughts on which solution (FastAPI or Next.js) offers the best path forward. Thank you in advance!
/r/flask
https://redd.it/1hjul50
Any tips to improve my simple "game"
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.
/r/Python
https://redd.it/1hjbdai
PyMo - Python Motion Visualizer CLI
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
/r/Python
https://redd.it/1hjjson
Volunteer for a google meet
Hi ! As the title says, i'm looking for a flask developer to volunteer for an interview through google meet.
I teach some university students web development using flask , and i thought it's a good idea to get one of those developers to come into one of our regular meets
You will basically get asked some questions regarding web development,
If you are interested, send a PM
Anyone's help is much appreciated.
Ps : i'll be happy to answer any questions down below
/r/flask
https://redd.it/1hjjxql