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
Python as a Configuration Language Using Starlark

I wrote an article about how Pythonic syntax (using Starlark) helps avoids many of the configuration related challenges seen with YAML and other such languages. Let me know any feedback.

/r/Python
https://redd.it/1o8gd22
Automating your heating with Octopus Energy AGILE tariff

Hi all, I've just made a Python tutorial for how you can automate your electric heaters during the Agile Energy Plunge Pricing, in the UK.

Effectively, we're automatically switching on our smart plugs (electric radiators), when the price of electricity is negative. This results in consistent credit back every time there's an Octopus Energy Plunge Pricing, plus a nice warm home.

You just need Tapo smart plugs and a Raspberry pi.

https://youtu.be/ch-9DpZL6Vg

code:

https://github.com/yojoebosolo/AutoHeating/

Hope it's helpful to some of you.

/r/Python
https://redd.it/1o86j5t
D For people who work (as PhD students) in Mila, Quebec, what your experience have been like?

You may know that Mila in Quebec is opening applications for PhD students recently, and I am considering for applying. I have searched relevent key words here, but it seems that there are not so many recent posts on studying and working experience at Mila, so I was wondering how do you like your experience here and/or in Montreal in general? For instance, how do you like your work-life balance, Montreal's winter/weather aspects, supervisors? To be more specific, I am interested in DL/LLM theory, AI / foundational models for (formal) math (e.g., Goedel-Prover-V2), and/or post-training.

Thank you!

/r/MachineLearning
https://redd.it/1o81qlw
Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1o8meso
TOML is great, and after diving deep into designing a config format, here's why I think that's true

Developers have strong opinions about configuration formats. YAML advocates appreciate the clean look and minimal syntax. JSON supporters like the explicit structure and universal tooling. INI users value simplicity. Each choice involves tradeoffs, and those tradeoffs matter when you're configuring something that needs to be both human-readable and machine-reliable. This is why I settled on TOML.

https://agent-ci.com/blog/2025/10/15/object-oriented-configuration-why-toml-is-the-only-choice

/r/Python
https://redd.it/1o8ors4
Can’t get Django emails to send on Render

I’ve been working on a Django project and I’m currently in the final phase (deployment). I’m trying to deploy it for free on Render for demo purposes, but I can’t get emails to send.

I first tried using Gmail with an app password for authentication, but it didn’t work. Then I switched to SendGrid, but the emails still don’t go through.

Has anyone run into this on Render or found a reliable way to get email working for a Django app in a free deployment?

/r/django
https://redd.it/1o8hndt
Made A Video Media Player that Plays Multi-Track Audio with Python

# Crusty Media Player

I made a media player that was built to be able to take Multi-Track Video Files (ex: If you clip Recordings with separate Audio Tracks like System Audio and Microphone Audio) and give you the ability to play them back with both tracks synced without the use of an external editing software like Premiere Pro! And it's Open Source!

# What This Project Does.

It utilizes ffmpeg bundled in to rip apart audio tracks from multi-tracked video media and PyQt6 to build the application and display video media.

GitHub <---- Repo Here

Crusty Media Player v0.1.1 <---- First Downloadable Release Here

# Why Did I Make This?

It's simple really lol. I like clipping funny and cool parts of when my friends and I play video games and such. I also like sometimes editing the videos as a hobby! To make the video editing simpler I have my recording settings set to record two tracks of audio, my system audio, and my microphone audio separate. The problem lies in that, if I ever want to just pull up a clip to show a friend or something, with any other media player I've used I am only able to select one track or the other! I have to open Premiere

/r/Python
https://redd.it/1o8pn4t
Sanguine — Local Semantic Code Search, No Cloud, No APIs

What My Project Does:
Sanguine is a CLI tool that indexes your code across multiple repos and languages using Tree-sitter. It allows you to search for code by meaning, not just keywords. For example:

> sanguine search "parse http headers"
will find the actual functions that perform that task. It integrates with Git (optional post-commit hook) to keep the index up to date. Everything runs locally — no servers, no APIs, no telemetry.


Link:
https://github.com/n1teshy/sanguine

Would love your feedback.

/r/Python
https://redd.it/1o8un9r
Tkinter freezing after successfully executing the code. Have to force quit the kernel and restart everytime on mac m1.



/r/JupyterNotebooks
https://redd.it/1o8rufk
Turn on Wi-Fi via browser in 7 lines?

What My Project Does

The mininterface project creates dialogs that work everywhere, ex. in the browser.

Here is the app that checks the Wi-Fi status and then turns it on/off. By default, it raises a desktop window with the confirmation dialog. See it here: https://imgur.com/a/20476ZN

#!/usr/bin/env python3
from subprocess import checkoutput, Popen
from mininterface import run

cmd = "nmcli", "radio", "wifi"
state = check
output(cmd, text=True).strip() # -> 'enabled' / 'disabled'

m = run() # shows the dialog
if m.confirm(f"The wifi is {state}. Turn it on?"):
Popen(cmd + ("on",))
else:
Popen(cmd + ("off",))#!/usr/bin/env python3

However when you put the interface="web" parameter in the run function or when use launch the file with the MININTERFACE_INTERFACE=webenvironment variable set like this:

$ MININTERFACE_INTERFACE=web ./wifi.py

it starts listening on the HTTP port 64646. That way, you can turn on/off the Wi-Fi status (or do anything else, it's up to you to imagine all the possibilities) remotely.

Target Audience

Even though opening a port needs a security

/r/Python
https://redd.it/1o8yhuk
Looking for developers

Hi Django community. I’m looking for a freelance developer or two to help me rewrite the backend of an application I have been building. I have a degree in computer science, but have never worked as a professional developer, let alone a Django developer. I have built my proof of concept in Django, and now I am looking to hire a Django expert to help me rewrite my project. My goal here is to get professional input on my architecture, as well as to hopefully learn some do’s and don’ts about enterprise level Django. There is budget and I intend to pay fair market rate, I’m not asking for any favors, just looking for the right person. Send me a message if you are interested.

/r/django
https://redd.it/1o8c307
I was tired of writing CREATE TABLE statements for my Pydantic models, so I built PydSQL to automate

Hey,

I'd like to share a project I built to streamline a common task in my workflow. I've structured this post to follow the showcase rules.

What My Project Does:

PydSQL is a lightweight, no dependencies besides Pydantic utility that converts Pydantic models directly into SQL CREATE TABLE statements.

The goal is to eliminate the manual, error-prone process of keeping SQL schemas synchronized with your Python data models.

For example, you write this Pydantic model:

Python

from pydantic import BaseModel
from datetime import date

class Product(BaseModel):
productid: int
name: str
price: float
launch
date: date
isavailable: bool

And PydSQL instantly generates the corresponding SQL:

SQL

CREATE TABLE product (
product
id INTEGER,
name TEXT,
price REAL,
launchdate DATE,
is
available BOOLEAN


/r/Python
https://redd.it/1o9756d
If starting from scratch, what would you change in Python. And bringing back an old discussion.

I know that it's a old discussion on the community, the trade of between simplicity and "magic" was a great topic about 10 years ago. Recently I was making a Flask project, using some extensions, and I stop to think about the usage pattern of this library. Like you can create your app in some function scope, and use current_app to retrieve it when inside a app context, like a route. But extensions like socketio you most likely will create a "global" instance, pass the app as parameter, so you can import and use it's decorators etc. I get why in practice you will most likely follow.


What got me thinking was the decisions behind the design to making it this way. Like, flask app you handle in one way, extensions in other, you can create and register multiples apps in the same instance of the extension, one can be retrieved with the proxy like current_app, other don't (again I understand that one will be used only in app context and the other at function definition time). Maybe something like you accessing the instances of the extensions directly from app object, and making something like route declaration,

/r/Python
https://redd.it/1o98n90
I built a SaaS boilerplate repo in Django that covers everything I would want as a SaaS founder about to build a SaaS!

Thought I'd share with the community my SaaS boilerplate written in Django for the backend and NextJS for the frontend

Tech Stack & Features:

– Frontend: Next.js

– Backend: Django

– Frontend Hosting: Vercel

– Backend Hosting: Render

– Database: PostgreSQL

– Auth: Google Auth

– Payments: Stripe

– Styling: ShadCN + Tailwind CSS

– AI-generated marketing content (OpenAI)

– Social media posting to Reddit & X from dashboard

– Emails via Resend

– Simple custom analytics for landing page metrics

saasboiler.io

/r/django
https://redd.it/1o9b6xw
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1o9h81g
De-emojifying scripts - setting yourself apart from LLMs

I am wondering if anyone else has had to actively try to set themselves apart from LLMs. That is, to convince others that you made something with blood, sweat and tears rather than clanker oil.

For context, I'm the maintainer of Spectre (https://github.com/jcfitzpatrick12/spectre), a Python program for recording radio spectrograms from software-defined radios. A long while ago, I wrote a setup script - it's the first thing a user runs to install the progam. That script printed text to the terminal indicating progress, and that text included emoji's ✔️

Certainly! Here’s a way to finish your post with a closing sentiment that emphasizes your personal touch and experience:

Markdown

I guess what I'm getting at is, sometimes the little details—like a hand-picked emoji or a carefully-worded progress message—can be a subtle but honest sign that there's a real person behind the code. In a world where so much content is generated, maybe those small human touches are more important than ever.

Has anyone else felt the need to leave these kinds of fingerprints in their work?


/r/Python
https://redd.it/1o9ar5b
Passing the CSRF Token into a form fetched from Django when the Front-End is in React

This is a reddit post about POSTS not being read. Ironic.
Backstory: A Rollercoaster
What am I posting? A sign-up form. A sign-up from I got from Django.

Good news! As Django is the source of my sign-up form, I can add {% csrf_token %} to the template, and have Django handle the rest.
Bad News: My front end is in React, and not in Django. Therefore, the form POST is handled with Javascript, which views {% csrf_token %} as an error.
Good News! The Django documentation has a page on acquiring the csrf token programmatically in javascript: The Django Documentation has a page on csrf token management.
Bad news: Now what? I'm relying on the form to create the POST request, and not manually creating a fetch() object. Forms don't allow me to neatly edit the POST headers.
Good news: From Googling, I found This Blog Post, which suggests that I could add a hidden <input> tag for sending the csrf token. Even better, I checked the DOM, and voila! I have a idden input element with the csrf token.
Bad News: Doesn't work. Perhaps what I presumed was the CSRF

/r/djangolearning
https://redd.it/1o977gw
2-step Process to Upload a File to Azure Storage Blob without Involving the Back-end to Proxy the Upload: Problems Faced

So there is this 2-step upload process I've implemented to store files in my Django back-end backed by Azure Storage Account blobs:
1. Request an upload SAS URL from back-end: The back-end contacts Azure to get a SAS URL with a UUID name and file extension sent by the user. This is now tracked as a "upload session" by the back-end. The upload session's ID is returned along with the SAS URL to the user.
2. Uploading the File and Registration: The front-end running on the browser uploads the file to Azure directly and once successful, it can register the content. How? It sends the upload session ID returned along with the SAS URL. The back-end uses this ID to retrieve the UUID name of the file, it then verifies that the same file exists in Azure and then finally registers it as a Content (a model that represents a file in my back-end).

There are three situations:
1. Upload succeeded and registration successful (desired).
2. Upload failed and registration successful (easily fixable, just block if the upload fails).
3. Upload succeeded but registration failed (problematic).

The problem with the 3rd situation is that the file remains in the Blob Storage but is not registered with the

/r/djangolearning
https://redd.it/1o963yi