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/1c94bxm
Is Django the right fit for my project? Or overkill?

Hi! I am a SW Engineer hoping to start another passion project. I want to build a very lightweight website that allows a user to customize a prebuilt PC and then order it. This would then put their order in a database that I can look at to build and then ship their custom PC.

I need the website and GUI to be intelligent enough to recommend parts that:
1. Are in stock
2. Avoid bottlenecks
3. Are geared towards their interests (user says they do lots of compilation/encoding I will recommend specific cpu class over gpus etc...)

This intelligence and smart recommendations is why I'm leaning towards a python-based solution so I can develop and really tweak that logic

I really really like python development so am drawn to Django as a solution, however maybe I can make this work with one of those canned-style wordpress sites and a couple of plugins--My thought process was I pay for a few plugins I need, but then why not just code my own plugin, but then why not

/r/django
https://redd.it/1c92icg
I made a web app using Flask that converts YouTube videos into step-by-step tutorial guides

Hey guys. I've been working on this side project for the past month. It generates a step-by-step tutorial guide for YouTube videos that you can follow along without watching long videos. Best suited for tutorial videos but can work for other videos aswell. No BS. Just straight to the point.

The guides are generated from pure transcript so you don't have to worry about it being AI. It's my first project as a total beginner. Something I had to do inorder to get out of tutorial hell.

Please let me know if you have any suggestions or if you face any problems or bugs. I would try to fix them to the best of my abilities and as soon as possible. I would appreciate your feedback on this. You can message me directly.

Here's the link: stepify.tech

/r/flask
https://redd.it/1c96l5o
Introducing Stockdex: A Superior Python Package for Real-Time Financial Data Retrieval

Greetings!

I've previously introduced my Python package in this post. Since then, I've significantly enhanced its performance and expanded its capabilities.

# What My Project Does
A lightweight python package designed for the efficient retrieval of financial data from various sources like Yahoo Finance, Nasdaq, Digrin and JustETF websites (somewhat similar to yfinance). This tool provides functionality akin to yfinance but with broader data access.

# Main benefits of stockdex over yfinance

- Fresh data: Yahoo Finance often delays updates to financial data by several days while Nasdaq and other sources typically update on the day reports are released. Stockdex enables access to this fresher data, such as quarterly earnings.

- Broader Data Sources: Unlike yfinance which relies solely on the Yahoo Finance API, Stockdex aggregates data from multiple platforms including Digrin, JustETF, Nasdaq, and Yahoo Finance. For specific examples of data retrieval, refer to this readme.

- Access to Historical Data: Yahoo Finance limits access to the most recent five annual or four quarterly reports. Stockdex, however, taps into sources that maintain extensive historical archives not available through Yahoo Finance.

# Target Audience
The package is targeted at people who are interested in financial analysis using python.

Explore more:

- Github Repo Link
- Pypi link

/r/Python
https://redd.it/1c92iom
Someone Wants to Buy My SaaS - ?????

Hey! I’ve been working on a SaaS project called Bitezzy (my first one) Bitezzy - Simplify your menu management, which helps restaurants create and manage digital menus that customers can access by scanning a QR code. It’s built with Django, and uses Stripe to handle subscriptions for registered users who create and manage these menus.

Recently, someone approached me with an interest in buying Bitezzy. This is both exciting and a bit overwhelming since it's the first time I've been in this situation. I'm not sure how to value the project or the steps I should take next.

Bitezzy is still in development (I'm not a frontend expert, I'm still learning) and has shown great potential. Figuring out a fair price involves considering the time I've invested and the future market potential (it may work, it may not). There's also an emotional component because I've poured so much into developing it from the ground up.

I'm reaching out to see if anyone here has experience with selling a similar project. Could you share some advice on how I should approach this?

What factors are important to consider when valuing a SaaS focused on service like this?
Is there a standard method

/r/django
https://redd.it/1c943qz
Hosting Flask when taking data transfer costs into consideration question

Hi all,



I'm developing a Flask application and was thinking of hosting it on either Heroku on AWS or possibly even elsewhere. After reading some past posts that drew my attention to this, it occurred to me there are more considerations that I was aware of. My application will have users submitting images (which could be of a good size) so I need to factor in data costs. With this in mind, I would be grateful for any pointers for the best place that would balance good service with (hopefully) fewer costs.



Many thanks

/r/flask
https://redd.it/1c8umxd
My latest TILs about Python

After 10+ years working with it, I keep discovering new features. This is a list of the most recent ones: https://jcarlosroldan.com/post/329

/r/Python
https://redd.it/1c97glg
[D] Meta's H100 figure represents its H100 purchase as per company earnings call 1 Feb 2024. Excludes a further 250,000 H100 equivalents worth of GPU.

/r/MachineLearning
https://redd.it/1c8ydji
Matlab to Python

Hello everyone,
in your opinion what is the best way to convert a Matlab script to a Python one?
Personally I do it by hand, but I also heard about extensions like SMOP etc..
What do you think?

/r/Python
https://redd.it/1c9cjtl
Webhost for VOD webapp: noob edition

I have developped a VOD webapp, streaming educational content to subscribers using mux.com, based on django (with sqlite, or something else later), with html/bootstrap and some basic js, matomo for analysis. Landing page has a 3-4 images, and the user-only section has basically navigation buttons, text and the mux player. I expect no more than 10 concurrent logged in users, but would like to be able to scale to 100 as seamlessly as possible if it were to happen (beyond that there would be enough money for scalability to be someone else's job). And I'm quite lost regarding hosting options.

The first question I have is ressource needs. I'm used to simple web hosting of pure html/css, with shared ressources and bandwidth: would that be enough, and until what point? Any requirements beyond python? If I go dedicated ressources, how many Cores / Ram should I need?

The second is the maintenance of the server if I choose VPS/Cloud server. I'm ok/interested to learn how to deploy on a server, but the security/maintenence part of it worries me. Are there intermediate options, something equivalent to a VPS/Cloud but where most security related parts (firewall, software upgrades,...) are handled for me?

Any provider/solution to

/r/django
https://redd.it/1c9dv0x
Clerk React Django

I was using clerk auth with react with one of project where backend is Django. So I created a middleware to authenticate the clerk users and assign the user object to the requests. This is along with the default django auth.
Here is the github :- https://github.com/ravikrsngh/clerk-django-react


Clerk Middleware

​

new clerk permission

​

This is fine or we have better ways to do it ?

/r/django
https://redd.it/1c9pfjm
Understanding Flask-SQLalchemy lifecycle

I do a once a day maintenance job where I fetch all "parent" in db, and do some checking/updates on "children" and "grandchildren". Parents have grown and this operation has become quite time consuming, so I am looking into ways of speeding up, and one way is to reduce **write** transactions with DB.

Pseudo-code below shows a simplified pattern of how I do it currently: Get all parents, loop, do updates on children/grandchildren and commit on every loop.

Is there way I could move the commit to be done once instead of for each loop? If I move the commit to after the for loop (and remove the one inside update\_children), will it still catch the changes that have been done on children inside update\_children()?

Disregard legacy sqlalchemy syntax.

def daily_maintenance()
parents = Parents.query.all()
for parent in parents:
update_children(parent)

# Can I move db.session.commit() here?

def update_children(parent):


/r/flask
https://redd.it/1c9l1n8
Django Authentication

I'm still new and I've never built a site for a client only personal projects, I came across django-allauth is this a good way for authentication or I should stick to the default mode of authentication

/r/djangolearning
https://redd.it/1c9ojwt
Should I use pydantic for all my classes?

Pydantic makes your code safer by making it strongly typed. You can no longer input a wrongly typed argument without getting an error (if pydantic can't convert it). This is great but to me it seems that sometimes standard python classes still seem preferable.

Perhaps it's because I'm not using it correctly but my code for a pydantic class is much longer then for a normal class. Especially if you are working with computed attributes. Then you have to start using special decorators and for every computed attribute you have to declare a function with "def ..." Instead of in an init function just being able to write attribute_3 = attribute 1 + attribute 2.

So I'm just wondering are you using pydantic for all your classes? And how do you handle computed fields in pydantic especially upon instantiation I find it hard to implement.

/r/Python
https://redd.it/1c9h0mh
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/1c9wo8r
Jobs that utilize Jupyter Notebook?

I have been programming for a few years now and have on and off had jobs in the industry. I used Jupyter Notebook in undergrad for a course almost a decade ago and I found it really cool. Back then I really didn’t know what I was doing and now I do. I think it’s cool how it makes it feel more like a TI calculator (I studied math originally)

What are jobs that utilize this? What can I do or practice to put myself in a better position to land one?

/r/Python
https://redd.it/1c9u0qf
Scaling Django Channels when calling third party api

Hey,

I want to build a Django application that calls ChatGPT API with streaming and streams the ChatGPT response to the user in real time. I found this tutorial: Building a streaming ChatGPT clone, with Django, Channels, and HTMX (youtube.com) where this guy builds what I want to achieve.

My concern is he is using django-channels without async and calling the api like this:

class ChatConsumerDemo(WebsocketConsumer):
def connect(self):
self.user = self.scope"user"
self.messages =
if self.user.isauthenticated:
self.accept()
else:
self.close()

def disconnect(self, close
code):
pass



/r/django
https://redd.it/1c9o5j2
I suck at frontend, UI/UX, is there a GUI html drag and drop designer?

I'm learning Django, with htmx and alpine. But my sites are ugly, designing the site is, I think, the hardest bit about web dev. Django is awesome and I'm getting the hang of forms, models, etc, but man designing a good looking site is hard.

I think It would help me to have a kind of drag and drop UI designer, much like you can do it with android studio (I just tried it briefly).

I looked around and found bootstrap studio, which may be what I want but I'm not sure if the sites you do there are easy to set up with Django templates.

Do you know other alternatives? FOSS would be awesome.


/r/djangolearning
https://redd.it/1c9yy10
Help comunicating templates

I am inheriting from two html files una using extends (layout.html) and the other one using include, in this one i have a component, how can i make that when you click on a button in the component it chages the layout.html (i want to change the color of a element to make a notification)

/r/flask
https://redd.it/1ca1u9j
DRF JWT authentication with django-allauth Social logins

I want the social login of django-allauth to return a JWT in the response (Generated by me, not the social account provider's token). And also to redirect to a custom URL instead of the default "/accounts/profile" since I'm using this for a flutter mobile app.
I've tried using the signals "pre\_social\_login" and "social\_account\_added" but they never triggered.
I also couldn't do it with overriding the views.
Do you know of a better way or maybe there's something wrong with my implementation?
Here's the signal code:

@receiver(pre_social_login)
def generate_social_jwt(request, sociallogin, **kwargs):
user = sociallogin.user
refresh = RefreshToken.for_user(user)
logger.info(f"(PRE_LOGIN) Social JWT generated for user {user.username}")
return Response(
{"refresh": str(refresh.token), "access": str(refresh.access_token)}
)
pre_social_login.connect(generate_social_jwt)





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