Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
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/1dromws
Sonos Moments - A simple web app to control Sonos speakers

I finally open-sourced my tiny side-project where I implemented a web app for controlling Sonos speakers, especially switching between pre-defined "moments".

**Link**: [Sonos Moments](https://github.com/falkoschindler/sonos_moments)

After the latest update of the official [Sonos app for Android](https://play.google.com/store/apps/details?id=com.sonos.acr2) with an average rating of 1.2 stars, I needed an alternative solution for common tasks like changing the volume or pausing/unpausing the music. And starting my morning routine with a single click is not possible at all with the official app. Apart from that it is a great opportunity to use [NiceGUI](https://nicegui.io/) for rapidly solving a real-world problem at hand.

**What My Project Does**

* Provide a simple web UI for controlling Sonos speakers in a local network.
* Allow capturing and managing the state of multiple speakers ("moments") and restoring them with a single click.
* Allow to quickly play/pause speakers and control their volume without opening the official mobile app.

**Target Audience**

* Python developers and smart home enthusiasts in need for a better Sonos app.

**Comparison**

* As far as I'm aware, there is no other open-source web UI for Sonos speakers.

/r/Python
https://redd.it/1drczng
FastAPI + Django Admin is the best practice?

Hey guys! I wanted to use Django Admin for my FastAPI project, namely django-unfold. So what do you think about this idea?

My used orm: SQLAlchemy

/r/django
https://redd.it/1drj08o
Discord trading bot

I follow a very successful day trader that posts all his trades on discord. I was wondering if it would be possible to develop a bot that buys and sells a stock exactly when he posts his trades. I have no experience in programming but I really want to create this bot so that I can make trades while I do my day job. Any help is appreciated.

/r/Python
https://redd.it/1drx7qr
Flask MongoEngine ListField(StringField) error

\` from .db import db

class Movie(db.Document):
name = db.StringField(required=True, unique=True)
casts = db.ListField(db.StringField(), required=True)
genres = db.ListField(db.StringField(), required=True)`


in flask when trying to do `db.ListField(db.StringField(), required=True)`

I get an error like

`casts = db.ListField(db.StringField(), required=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: WtfFieldMixin.__init__() takes 1 positional argument but 2 were given`

then tried `casts = db.ListField(required=True)` and it works.

But I need list of string in model. how to do it?

/r/flask
https://redd.it/1drsa15
Things you dont like about python package manager

Share some things you dont like about this.



NOTE: not mentioning the name since the bot is programmed to do too much and whenever i mention it i get flagged



/r/Python
https://redd.it/1drznbg
AI contextualization for scraping

Hi everyone,

I’m the founder and chairperson of the Association of Computer Science students at my university. In my free time, I enjoy creating scripts for our community. Currently, I’m working on a web scraper to collect and share bursaries, internships, graduate programs, learnerships and more with our students through our communication platforms like whatsapp.

However, I’ve encountered a problem, the descriptions of these opportunities vary widely and often don’t explicitly state that they are related to computer science. I want to integrate a tool that can help contextualize these descriptions and determine whether they are relevant to computer science.

Is there a free method to connect my script to an AI service that can assist with this? Any recommendations or advice would be greatly appreciated.

Thank you.

/r/Python
https://redd.it/1ds0r50
Django SaaS Boilerplate

Hi all !

Since quite many people found my previous website template helpful, wanted to share a simple, open-source SaaS boilerplate as well.

You can get the code on Github: [Django saas Boilerplate](https://github.com/PaulleDemon/Django-SAAS-Boilerplate)

You can check out the demo here: [https://django-saas-boilerplate.vercel.app/](https://django-saas-boilerplate.vercel.app/)

Signup is disabled, For demo login use

demo@mail.com
demo123*

This template is built on top of previous template.

**Some of the features of Django Saas boilerplate include**

* **Responsive UI**: Comes with a responsive base template, so you can focus on other parts of your websites.
* **Login flow:** Comes with Login, signup, password rest, etc.
* **Payment integration:** Comes with default stripe integration, add your API keys and get started.
* **Pricing page:** Display exactly what your customers get.
* **Landing page**: Comes with a landing page you can modify.
* **Contact us page**: An inquiry form, to allow your users to contact you.
* **Blog with Trix Editor:** An integrated Trix editor on admin panel to manage and write blogs about your SaaS webstite.
* **Custom User model**: Comes with an existing custom user model you can modify.
* **Tailwind Css:** For rapid prototyping and development.
* **Frontend framework independent**: Comes with basic html, css just enough for your about page, you are free to use any

/r/django
https://redd.it/1ds0ubg
Flask socketio doesn't work on Chrome Android

I made a chat websitee with socketio, firstly I tested in localhost, it worked between PC and ANDROID, then I put it on heroku and bought a custom domain, and I got an SSL certification, but it seems the socketio on android chrome just does not want to connect. I can't solve the issue because there isn't any devtools on android.

/r/flask
https://redd.it/1drziqg
Django 5 By Example: Build powerful and reliable Python web applications from scratch, any good?

Just wondered if anyone had read this book by Antonio Melé and could share their opinions on it as I am considering purchasing it, thanks in advance.

/r/django
https://redd.it/1ds2t2e
A Twitter bot that posts about public domain science fiction books

Source code: https://github.com/ben-n93/pg\_scifi\_twitter\_bot

What my Project Does

Picks a random science fiction book from Project Gutenberg and posts about it on Twitter.

Target Audience
Anyone interested in Twitter bots and/or free science fiction books!

/r/Python
https://redd.it/1ds1xs7
Django REST vs Django Ninja

I'm curious if Django Ninja is mature enough now

/r/django
https://redd.it/1ds6rlt
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/1dsfboc
Add a GUI or not?

I recently convinced my IT department to allow me to install and develop python scripts for internal use in our company. I am the only one with any python knowledge and the ability to run scripts, so in order to share anything with my colleagues I will have to distribute them as .exe files.

I have made my first useful script and now I'm not sure if I should add a simple tkinter gui or not. The script can work on its own as long as it's placed in the folder (it changes some documents and converts them to pdfs).

Here are my thoughts on adding a GUI.

Pros:
It would create a user experience they are more familiar with. It would make the script/app more dynamic as it would make it easier for them to tweak settings.

Cons:
it would increase file size of the .exe, I know it's not a low but some colleagues are old school and will share it by email.
It would make the code more complex and harder to maintain for myself (and potentially others in the future)
Tkinter looks and feels outdated to many users (I know could use another gui framework but that would require I

/r/Python
https://redd.it/1dsebb8
Stockdex: Python Package to Extract Financial data From Multiple Sources

Happy Weekend every one!

Here to showcase stockdex, a Python package that provides an interface to access financial data (e.g revenue, cash flow ...) from data sources such as:
- Yahoo Finance API
- Yahoo Finance website
- Digrin website
- Macrotrends website
- JustETF website (EU etf data)

Data is returned as a pandas DataFrame and it functions similar to yfinance python package.

## Comparison with yfinance

With stockdex, one can access data from multiple sources (not just Yahoo Finance) and unlike yahoo finance which provides only data from last 4 years, stockdex provides data from multiple sources and in some cases, data from the beginning of the stock's existence (e.g macrotrends and digirin have older than 4 years data).

## Target audience

People who are interested in financial data and familiar with python programming language.

## References

For more details or to contribute, feel free to visit the links below:

Github Repo Link

Pypi link

/r/Python
https://redd.it/1ds33vs
G-Scraper: a GUI Web Scraper written in Python

***Source Code:*** [***https://github.com/thegigacoder123/G-Scraper***](https://github.com/thegigacoder123/G-Scraper)

**What my project does:** Provide a GUI interface to scrape webpages

**Target audiences:** Data collectors, web scrapers tired of using terminal, or people who just want to scrape with a nice GUI.

Features of the project:

1. Supports GET and POST requests
2. Can scrape multiple URLs
3. Can scrape multiple elements from a single URL
4. Can send payload/web parameter data with a specific URL, meaning it can also handle login pages.
5. Has a logging function, including error logging
6. Scraping processes run in separate thread from GUI process
7. Stores data in .txt files
8. Generates very unique filenames for logs and scraped data using datetime and random modules.

Some limitations that im working on:

1. Does not provide output to the user on the GUI
2. Delete unwanted/mistype from the entered data
3. Edit a variable once it has been entered

Other features that I am also working on but not prioritizing:

* A preset function: basically user can create presets of scrapes they think will do over and over again to save time. Just load and run the preset.



This is my 2nd big project (1st was a flask website). I am still learning so any and all feedback will be welcomed. Feel free to share any new ideas you

/r/Python
https://redd.it/1dsn27o
Building AI tools should be simple

A few months ago, I was experimenting with AI tools for information retrieval and found the process needlessly complex. Managing RAGs, vector databases, inference services, and multiple API keys among other things. I just wanted to iterate on a few ideas without getting bogged down by all these details that should "just work".

That's why I started working on Firedust. It abstracts away these complexities, minimizing the time from concept to product. Unlike OpenAI's Assistants API, Firedust simplifies the development process and doesn't tie you to a single LLM. You can easily switch between models without downtime. It also allows deployment to Slack, supports group chats, and has data encryption and user privacy built-in.

I’d love to hear your thoughts and feedback!

Source code: https://github.com/ion2088/firedust

Target audience: Developers that want to quickly iterate and deploy AI tools

/r/Python
https://redd.it/1ds3xlk
How do you manifest ideas for projects?

I have learnt basic of python and I’m new to django, I wanted to create a project for my internship so I was wondering how do you people came up with the ideas and how to plan it out, it can open my mind for how and where to get ideas.

/r/django
https://redd.it/1dsnl9i
html <textarea> not interpreting <br>

https://preview.redd.it/65v2g7yzsv9d1.png?width=538&format=png&auto=webp&s=47791506a959d23094dc9d16ba48bc1d5c96d9b1

fetching data with \\n from db rendered to <br>, but <br> not recognising by <textarea> (no new line)

/r/django
https://redd.it/1dsperq
Choosing the Right Architecture for Django Application: Monolith vs. Microservices

Hi there! I'm working on a project for a school system that aims to integrate various existing sites with different sizes and technologies. The portal will include:

* **Student Dashboard:** Students can log in to view their personal information, subject details, exam scores, and class schedules (including who is the teacher, which room, and time of start...).
* **Assignments**: Teachers can upload assignments, students can submit their answers, and teachers can grade submissions and leave comments.
* **Additional Features**: Teacher ratings and exam applications, among other functionalities.

These are just the major features; the portal will have more functionalities than I mentioned here.

# Choosing the Right Architecture: Microservices vs. Monolith

# 1. Microservices vs. Monolith

I'm deciding between microservices and a monolithic architecture. I have no prior experience with microservices but have some ideas on implementation. Which approach would be better for this project?

# 2. Microservices Implementation

If microservices are recommended, how should data management and communication be handled?

* How should other services access necessary data? Should they send requests to the relevant microservice each time they need specific information?

you can give the user an example.

# 3. Efficient Monolithic Design

If a monolithic architecture is preferred, how can we prevent performance issues as the project scales?

* Monoliths can

/r/django
https://redd.it/1dskt3b