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
Simple db-backed queue system.

I need to write a simple queue system that is REST based and with authentication. Workers can check out tasks and creator should be able to post these tasks.

I was wondering if there is a simple example out there that I can use as a starting point.

I am pretty new to Python hence my dumb questions :)

/r/Python
https://redd.it/1b65eys
D ML being unserious?

I was reading the ternary paper and it came to me how while most of the Arxiv papers are named stuff like "Probing the Information Encoded in Neural-based Acoustic Models of Automatic Speech Recognition Systems", the ternary paper was called the slightly-unserious "The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits".

There are some other unserious things that happen in ML, like the "Attention is All You Need" paper and my favourite paper name, "Loose LIPS Sink Ships: Asking Questions in Battleship with Language-Informed Program Sampling", people naming their techniques stuff like LASER and DRμGS, people naming their LLMs stuff like Nontoxic Bagel, Dolphin, and other random animals, and so on.

Amid the somewhat slow period right now, do you have any good suggestions of times where ML was quite unserious?

/r/MachineLearning
https://redd.it/1b610zm
Is it only me or Flask is easier than FastAPI?

Hello ! I started to learn about APIs and I picked FastAPI at first.
It was very easy at first, until I wanted to do things like connecting the API to a database and creating a login system. Here things started to fall apart for me. Connecting to a DB or making a login system seems a bit complicated, with so many third party dependencies and so on. I did with tutorials, but even so, it's a bit tough to understand what's going on. Probably I could come along if I'd try harder but I said I shall give a chance to Flask.
So, I tried Flask and to my surprise, the documentation is much clearer and I was able to set things up much faster than I would in FastAPI (I made a login system in 5 minutes, perhaps it's not as secured as what FastAPI would use but I need fast prototyping and works for now).
My guess is FastAPI is extremely light weight and is aimed towards more experienced develops whereas Flask has more available solutions for quick prototyping and better documentation. As people say Django is "batteries included", that's what Flask is

/r/flask
https://redd.it/1b4bxe3
I made a YouTube downloader with Modern UI | PyQt6 | PyTube | Fluent Design

# What my Project Does?

Youtility helps you to download YouTube content locally. With Youtility, you can download:


* Single videos with captions file
* Playlists (also as audio-only files)
* Video to Mp3

# Target Audience

People who want to save YouTube playlists/videos locally who don't wanna use command line tools like PyTube.

# Comparison

Unlike existing alternatives, Youtility helps you to download even an entire playlist as audio files. It can also download XML captions for you. Plus, it also has a great UI.

# GitHub

GitHub Link: [https://github.com/rohankishore/Youtility](https://github.com/rohankishore/Youtility)

/r/Python
https://redd.it/1b66726
Let’s share ideas and existing project?

I thought it would be neat if we can share tools we wish existed, or tools that we have created. Maybe someone knows an existing tool already, or someone will read your idea and feel inspired to create it!

So…

Whats a tool that you wish existed?

Are there any tools you’ve created and want to share?


/r/Python
https://redd.it/1b6i18b
Third Party API fetch in django.

What are the best ways for calling third party API in django app. What libraries should we use?

/r/djangolearning
https://redd.it/1b6i1uy
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/1b6qj7t
Video + Article Tip on how to speed up queries

Video: https://youtube.com/shorts/mewTap8ZQ6w?feature=share

Article: https://www.jetbrains.com/guide/python/tips/django-query-speed-up/

Basic tips on how to improve your database query performance.

If you enjoyed the video, please like/comment/subscribe.

I'm happy to have ideas for new tips and hear your feedback.

/r/django
https://redd.it/1b6dnfn
D Why do GLUs (Gated Linear Units) work?

Today, GLU variants, such as SwiGLU, are used very often in LLMs.

But the paper, "GLU Variants Improve Transformer" (https://arxiv.org/pdf/2002.05202.pdf), just says that "We offer no explanation as to why these architectures seem to work; we attribute their success, as all else, to divine benevolence."

I also found the explanation in the original GLU paper to be unsatisfactory. They said that it has cleaner gradient, but I thought that this issue was already solved by residual connection.

Does anyone have any theoretical or even intuitive explanation as towards why GLU is successful?

My thought process is that it allows each token to learn a transformation that is unique to themselves, which improves the expressivity of the MLP, but I'm not sure if that is reasonable.

EDIT: The Falcon technical report (link here: https://arxiv.org/pdf/2311.16867.pdf, page 14) discusses that GLU is used because it increases parameter count by 50%, saying: "Scaling-wise, GLU activations have been preferred as well, as they increase the size of the MLP (doubling its first layer), shifting more compute towards simple matrix multiplications."

However, I don't think I'm convinced that this is really the case; after all, why can't you just increase the number of neurons in the hidden layer of the MLP by

/r/MachineLearning
https://redd.it/1b6ggpz
vmn: git tag based versioning system

https://github.com/final-israel/vmn

Hello r/Python community!

I’m excited to share a project I’ve developed called vmn. It’s a git tag based versioning system that we’ve been using extensively at my company to manage our application versions. Here’s a quick overview:

What vmn Does:
vmn is a tool that simplifies version management by leveraging git tags. It’s designed to automate and streamline the process of versioning your applications, making it easier to maintain a clear and consistent version history.

Target Audience:
This project is aimed at developers and teams who use git for version control and are looking for a straightforward way to manage their application versions. It’s suitable for both production use and development environments.

Comparison:
Unlike other versioning systems that might rely on manual updates or complex configurations, vmn keeps things simple and git-centric. It’s a lightweight and easy-to-use solution that integrates seamlessly with your existing git workflow.


I would LOVE to hear your feedback and suggestions! If you have any ideas for features or improvements, I’m open to adding them.

Check it out and give it a star ⭐️⭐️⭐️

Thanks😁


/r/Python
https://redd.it/1b51puw
Need help and suggestions for Django

I want to work in pire backend stuff and have recently started with django after doing a bit of js. Now I know the basics of django and by basics I mean what each directory does and hot the request is processed and stuff. I started with a django project but eventually got overwhelmed with so many directories , html and stuff. Not the important thing is do I need a very good solid foundation of django in order to start django rest framework ( DRF)?
I mean I am a geek for backend development and I can sit hours reading the documentation but I don't wish to watch any yt playlist since it gets boring.

So to o sum up , I have 2 questions:

1) Do I need a very strong foundation on django to start DRF?

2) If I start DRF then please suggest some good articles/blogs for DRF. Also , could someone drop the link to official documentation of drf , I looked it up on web but many showed up so kinda confused.

Looking forward to hearing from y'all!



/r/django
https://redd.it/1b6w1ui
Still worth learning?

I understand its kinda weird asking on a flask sub reddit, but im wondering if flask is still worth learning because even in here it looks like fast api is preferred a lot of times. I already invested some time into learning flask and i dont want to just jump onto the next one after i just started getting the hang of this. I want to learn django too for job opportunities but im confused. Is it a good idea to keep at flask and learn other backend related technologies while at it. Like learning caching or whatever. Or should i just switch to fastapi/django. Im just confused on the direction i should take

/r/flask
https://redd.it/1b6z591
Free HTML template for a 'healthy eating' website

Which websites have good free html templates? I want to design a user profile for a 'healthy eating' website.

/r/flask
https://redd.it/1b735hz
Building a Messenger App for a Large Organization with Django and Channels

Hello everyone,

My team is going to develop an in-house messenger application for a relatively large organization (about 10k employees) and I am currently exploring the best tools and frameworks to achieve this efficiently and effectively. We have a requirement to keep Django for the backend.

I've been looking into Django Channels as a potential solution for handling real-time communications. However, I'm a bit concerned about the scalability and hardware requirements, especially since our target user base is pretty large and all of them could be online. From what I understand, Django Channels is quite powerful, but I'm worried it might be overkill for our needs and could require significant server resources. I have not found anything beyond simple tutorials, and looks like scaling Django with Channels may require quite a huge effort and hardware.

On the other hand, I stumbled upon this tutorial on Centrifugo (https://centrifugal.dev/docs/tutorial/intro) that guides through building a real-time chat application. It claims to support between 10k-100k users on hardware comparable to a single modern server machine, which sounds impressive and potentially more aligned with what we're looking for in terms of efficiency and resource management.

I'd love to hear from anyone in the community who has experience building

/r/django
https://redd.it/1b7002m
How to separate settings for prod and local

Hi, I want to conditionally set variables for settings.py like

If debug is True, database to postgresql and static media to S3. If debug is False, set database to sqlite3 and save all the static files in static media folder in django project,

In settings.py

If debug:
database: {
‘ENGINE’: ‘postgresql’
.
.
}


else:
database: {
‘ENGINE’: ‘sqlite3’
.
.
}

Is this how to do?

/r/django
https://redd.it/1b76c47
Sitcom Simulator: a tool for generating weird AI meme videos

# What My Project Does

Sitcom Simulator is a python/CLI tool that takes any text prompt (for example, "Joe Biden vs. Donald Trump: ultimate weightlifting competition") and turns it into a bizarre meme video with realistic images and voices. The tool is essentially duct tape that combines various AI tools into one unholy abomination:

* ChatGPT generates the video script.
* FakeYou generates voices for the characters.
* Stable Diffusion generates images of the characters.
* Freepd provides the background music.
* FFmpeg connects the images and voices into a movie.

# Target Audience

People who like making memes, funny videos, or weird AI "art" but are too lazy to do it manually.

The code is fairly customizable and extendable; it could probably be used as a base for many types of AI video generation projects even if your use case is somewhat different.

# Comparison

There are many AI video editing tools out there (e.g., Kapwing), almost all of which are complicated commercial products with a vague notion of improving "productivity" or whatever. In contrast, Sitcom Simulator is simple, open source, and the only AI video tool focused on humor, memes, and wasting your time with terrible brain rot.

# GitHub

Code, documentation, and example videos can all be found on GitHub:

[https://github.com/joshmoody24/sitcom-simulator](https://github.com/joshmoody24/sitcom-simulator)

/r/Python
https://redd.it/1b6z27b
Building an ERP system

Im planing to build an erp system as a service, i will be doing the hosting and everything. for actual production not just for fun and im most comfortable with python and django.
do you think python + django would work well, (since python is a slow language and django is not the fastest python framework)

And for the front end imma do it in vanilla js + tailwind.

What do you think and what do you suggest.
Can django handle it (i think yes but is it a good idea)
And is putting it on a central server better or each customer should have his own server.

/r/django
https://redd.it/1b7b56i
Reflex 0.4.0 - Web Apps in Pure Python

Hey everyone, we just released a new version of reflex and wanted to share some updates.

For those who don’t know about Reflex (we used to be called Pynecone), it’s a framework to build web apps in pure Python. We wanted to make it easy for Python developers to share their ideas without having to use Javascript and traditional frontend tools, while still being as flexible enough to create any type of web app.

Since our last post, we’ve made many improvements including:

We’ve released our [hosting service](https://reflex.dev/docs/hosting/deploy-quick-start/) . Just type `reflex deploy` and we will set up your app, and give you a URL back to share with others. During our alpha we’re giving free hosting for all apps (and always plan to have a free tier).
A tutorial on building a ChatGPT clone using Reflex.
New core components based on Radix UI, with a unified theming system.
More guides on how to wrap custom React components. We’re working now on building out our 3rd party component ecosystem.

Our key focuses going forward are on making the framework stable, speed improvements, and growing out the ecosystem of 3rd party components. We’ve published our roadmap here.

Let us know what you think - we’re

/r/Python
https://redd.it/1b7bgwn
I cannot receive my data from github oauth on my website written with Flask, how can I get it?

The codes below are my github auth codes.But I cannot get the user id, email and username data I want from github. but the data from the profile I introduced comes as follows "

{'login': 'ErhanKlnz', 'id': 105871419, 'node_id': 'U_kgDOBk94Ow', 'avatar_url': 'https://avatars.githubusercontent.com/u/105871419? v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/ErhanKlnz', 'html_url': 'https://github.com/ErhanKlnz', 'followers_url ': 'https://api.github.com/users/ErhanKlnz/followers', 'following_url': 'https://api.github.com/users/ErhanKlnz/following%7B/other_user%7D', 'gists_url ': 'https://api.github.com/users/ErhanKlnz/gists%7B/gist_id%7D', 'starred_url': 'https://api.github.com/users/ErhanKlnz/starred%7B/owner %7D%7B/repo%7D', 'subscriptions_url': 'https://api.github.com/users/ErhanKlnz/subscriptions', 'organizations_url': 'https://api.github.com/users/ErhanKlnz /orgs', 'repos_url': 'https://api.github.com/users/ErhanKlnz/repos', 'events_url': 'https://api.github.com/users/ErhanKlnz/events%7B/privacy %7D', 'received_events_url': 'https://api.github.com/users/ErhanKlnz/received_events', 'type': 'User', 'site_admin': False, 'name': 'Erhan KILNAZ', ' company': None, 'blog': '', 'location': 'Turkey', 'email': None, 'hireable': None, 'bio': 'DÜ CE', 'twitter_username': None, 'public_repos' : 3, 'public_gists': 0, 'followers': 3, 'following': 4, 'created_at': '2022-05-19T14:55:56Z', 'updated_at': '2024-02-16T13:25: 36Z'} {'access_token': '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', 'token_type': 'bearer', 'scope': 'user:email'}

https://github.com/ErhanKlnz/Cloud-Site/blob/main/app.py here my codes

/r/flask
https://redd.it/1b7jfwl