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
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/1euyfi6
How do I make my application interactive while being able to bundle my JavaScript

So far my Django app was just basic CRUD but now my front end displays a form and the form has a table. With a button I can delete rows and add rows. This might sound simple but I’m horribly lost. I want to use the JavaScript to populate the form, even when the template is populated by Django. But now how to I pass values from Django to the front end so my JavaScript can use it. Do I have to check if a variable is set in local storage or something?

/r/django
https://redd.it/1euzrsy
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/1euvt6o
Any good tutorials on Django channels ?

Can anybody tell me or suggest any tutorials or methods that you used to study django channels

/r/djangolearning
https://redd.it/1evam2q
Hype About .NET

Microsoft puts in their landing page that .NET-based web servers can handle 7 million requests making it the fastest web server out there. What is your opinion on this? Personally, I'm attracted towards it, however the development experience is pure shit compared to Python (not talking about writing actual program, but about setting up environments, hot reloading, memory consumption etc.).


Why Django is underperforming except for the reason that Python is an interpreted language? Can me make it match the speed of .NET?



PS: Django is the best framework out there that provides the right balance between abstraction and ease-of-use and its my most favorite framework.

/r/django
https://redd.it/1ev7kux
I made a Spotify Genre Tracker with the goal of broadening my music taste.

# What My Project Does


Recently I've noticed that I spend way too much time listening to the same playlists/genres over and over again so with the goal of expanding my music knowledge I've decided to make this program that keeps track of the listening time for all the genres in Spotify.

It works by having two threads, one for the cli and user input and another that constantly pings the Spotify API for the currently playing song and keeps track of the listening time in an sqlite database.


# Target Audience

This project is meant for anyone that has a hard time finding new music genres to listen to. It is by no means production ready but if I see people enjoy it I might setup a website for it and make it public.


# Comparison

As far as I'm aware there aren't any projects like this one. The one's available out there keep track of all your stats but none give you a set goal or have the option to track the listening time for a given genre.

Any comments/recommendations are welcome. Hope it helps someone learn more about music!

Here's the repo for anyone that wants to check it

/r/Python
[https://redd.it/1evbgzb
Local to Live Question

I'm considering starting a bigger project than I'm used to. I've flipped through a lot of tutorials but haven't found a solid answer to a question I have.

Most of my projects have just been php and sql based. I just have the files on a webhost and it's live.

Can I do that with Django? It seems like a way different process to go live with Django. I was considering starting with a Django boilerplate.

/r/django
https://redd.it/1evd7gh
Django project links.

I’ve been doing django for couple of weeks. Gained basic knowledge now I want to test it and learn advance concepts by doing and tinkering. Can you guys please provide me some git repo based on django projects?Tnx…

/r/django
https://redd.it/1evp5mh
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/1evnvtp
Checks before deploying an app

I know of CSRF for forms and debug set to false and allowed hosts to my domain name. is there anything more? specially security wise.

/r/django
https://redd.it/1ev6xf1
Pro tips for matplotlib figures to really feel right in LaTeX publications

I wrote up some tips that I think will help academics, or anybody else who happens to use matplotlib to make figures that end up in LaTeX documents. A long time ago I was a layout/typography nerd, so I've been trained to be anal, hence the tips below!
https://duetosymmetry.com/code/latex-mpl-fig-tips/

/r/Python
https://redd.it/1evp7ip
I Created the Definitive AUTOMATIC Shiny Hunter for Pokémon BDSP in Python

What My Project Does: 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.

I also want to know what do you think about it: Is it fair to use it in singleplayer? And multiplayer?

Target Audience: All Pokémon BDSP gamers.
Comparison: As far as I know, nobody did this before.

📽️ Youtube: https://www.youtube.com/watch?v=84czUOAvNyk
🤖 Github: https://github.com/Dinones/Nintendo-Switch-Pokemon-Shiny-Hunter

/r/Python
https://redd.it/1evng2g
I built a Python Front End Framework

This is the first real python front end framework you can use in the browser, it is nammed PrunePy :

https://github.com/darikoko/prunepy

# What My Project Does

The goal of this project is to create dynamic UI without learning a new language or tool, with only basic python you will be able to create really well structured UI.

It uses Pyscript and Micropython under the hood, so the size of the final wasm file is bellow 400kos which is really light for webassembly !

PrunePy brings a global store to manage your data in a crentralised way, no more problems to passing data to a child component or stuff like this, everything is accessible from everywhere.

# Target Audience

This project is built for JS devs who want a better language and architecture to build the front, or for Python devs who whant to build a front end in Python.

# Comparison

The benefit from this philosophy is that you can now write your logic in a simple python file, test it, and then write your html to link it to your data.

With React, Solid etc it's very difficult to isolate your logic from your html so it's very complex to test it, plus you are forced to test your

/r/Python
https://redd.it/1evuzem
Making a windows desktop app using pygame: how bad of an idea is it?

I haven't found anyone asking this question, everything seems suitable to make nice desktop apps but I found no mentions of anyone doing it so I'm assuming it's a bad idea but I have no clue why that would be the case

/r/Python
https://redd.it/1evv8no
Why Signals are bad?

I went through some blogs, talking about optimizing performance of Django application and almost every blog mentioned avoid using signals. But none of the authors explained why.

/r/django
https://redd.it/1evvaeu
trying to set up a virtual environment on a linux and windows machine multiple times but failed.

i have a flask project (can't share the github repo because it is private) and I've tried setting it up on my fedora linux machine. the os by default had python 3.12 and I can't remove it because some core packages depend on it. I'm trying to set up a project with pipenv and after I run pipenv install, I get multiple resolution failures and in the error logs, I see that it is picking up some resolverdotpy files from my python3.12 directory.
i have tried specifying the python version as pipenv --python 3.8 install, but no luck. what can I do?

/r/flask
https://redd.it/1evrl3n
Question about transforming code into a web application

Good morning. I had written a large Python code (>500 lines) for a project, and was trying to make a self serve web application for this in Flask. I got the "hello world" and stuff down in flask, but now I am having trouble understanding how to move forward...do I simply copy paste my code into the main() function in app.py? Because I tried a test code like that (Just one input and an output) and the website didn't display anything.

Tl;dr: Trying to make a massive python code into a Flask web app, did the "hello world" code, not sure how to proceed.

/r/flask
https://redd.it/1ew2tkb
If you could go back and give your beginner Django self one piece of advice, what would it be?

For the seasoned Django developers out there - as you look back on your own journey, what's one insight or lesson you wish you had known when you were just starting out?

I'm a junior Flutter developer who is excited to dive into backend development with Django. As someone new to the field, I'm keen to learn from the experienced Django developers in this community.

Looking back, is there anything in particular you would have approached differently in learning and using the Django framework? What's one piece of advice you wish you could give your beginner self?

I'm especially interested in any insights on:

- Key concepts or techniques that were game-changers in your Django journey

- Resources (books, tutorials, projects) you found invaluable as a beginner

- Common beginner pitfalls to avoid or best practices to adopt early on

- Aspects of Django that were challenging to grasp at first but clicked later on

/r/django
https://redd.it/1ew0i59
Has there ever been a proposal for a zero-argument form of `slice()`?

I'm studying Pandas multi-indexing, which uses `slice(None)` [in some spots](https://pandas.pydata.org/docs/user_guide/advanced.html#using-slicers) and it seems ugly so I started wondering the title.

e.g.

dfmi.loc["A1", (slice(None), "foo")]

vs

dfmi.loc["A1", (slice(), "foo")]

Obviously, five extra keystrokes is not a big deal and this is a relatively niche usage, but I don't see any logical reason [`slice`](https://docs.python.org/3/library/functions.html#slice) shouldn't have a zero-argument form. I mean, the syntactic form, `:` doesn't have any value attached to it, so why should the callable form?

As of now, it mostly follows [`range`](https://docs.python.org/3/library/functions.html#func-range)'s signature, requiring either `stop` or `start, stop, step`.

---

**Edit:** NVM, I just realized you can use a convenience object like Pandas [`IndexSlice`](https://pandas.pydata.org/docs/reference/api/pandas.IndexSlice.html), which gives you syntactic sugar for this ***and*** more complicated indexing.

>>> idx = pd.IndexSlice
>>> idx[:]
slice(None, None, None)
>>> idx[:, ...]
(slice(None, None, None), Ellipsis)

Thus:

dfmi.loc["A1", (idx[:], "foo")]
# or
dfmi.loc["A1", idx[:, "foo"]]

All `IndexSlice` does is expose `__getitem__`:

> class _IndexSlice:
> def __getitem__(self, arg):
> return

/r/Python
https://redd.it/1ew3kvm
dont know how to fix it Errno 2

hello guys
im some kind of self-taught-programming-student (or whatever) like probably yall have been and im stucked AGAIN with something i rly dont know how to fix.

this problem ocurred when i was starting to practice django framework, reading the documentation and watching some videos to help me.

but then, this happened

https://preview.redd.it/kp4pv3k76ijd1.png?width=694&format=png&auto=webp&s=b0cc328f00079cbef08d3c3e5f7d6845ca302935

and the reason idk how to fix it is because there actually IS a file named manage in that folder/directory as you guys can see

https://preview.redd.it/acsq6dhe6ijd1.png?width=798&format=png&auto=webp&s=f6f08f7a6e781191ea51c803fb76bb980028d5dc

can someone help a rookie? D:

/r/djangolearning
https://redd.it/1evml07
Do you guys hardcode your backend auth?

So, I'm working on this non-profit project and have just finished the login and registration pages and APIs. I still need to deal with JWT and enhance security. My question is whether you guys hardroll the backend or do u use services like Firebase. However, Firebase is quite expensive, and since it's a non-profit project, I don't have enough funds to support it (I'm using SQLite for the db 💀). I don't anticipate having more than 5,000 users, and I find SQLite easy to use and flexible for starting out. If the user base grows, I can migrate to another database.

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