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
How can I remove CKEditor buttons on my page?

I'm trying to configure the flask ckeditor by removing some buttons and also to style it a bit. Right now I have this snippet in my html file:

<div class="mb-3">
{{ form.body.label(class="form-label") }}
{{ form.body(class="form-control") }}
</div>

At the end I have:

{{ ckeditor.load() }}
{{ ckeditor.config(name='body') }}

I'd like to remove the 'About CKEditor' button, is there a way to do this without custom js scripts? Is there a way to customize the color of the editor, its border etc..

/r/flask
https://redd.it/1k9yl09
'Django Spellbook' - Markdown Content Management System (my first library)

I wanted to show off the Django Library I've been working on!

https://preview.redd.it/n9rzz0rbrlxe1.png?width=1036&format=png&auto=webp&s=9bad311c3ff9dde10761a59732223bdb646b4b96

Django Spellbook extends Django's templating and rendering capabilities with a focus on markdown-based content. It transforms markdown files into fully-rendered Django templates with auto-generated views and URLs, eliminating boilerplate code while maintaining Django's flexibility.

This website is powered by Django Spellbook: https://django-spellbook.org/

Here is the github: https://github.com/smattymatty/django\_spellbook (Stars are appreciated!)

I hope you like it I made it because I write a lot of markdown, and wanted a way to mix Django template language with simple markdown in a way where non-coders can contribute styled and user friendly interfaces for their content.

If you try the library, please report any bugs, issues, or feature requests! I plan on working on this for a while, I would like it to become a respected open-source library in the Django framework :)

/r/django
https://redd.it/1k9zwt3
Flask-based via telegram bot

I have built a secure and scalable Flask-based platform that integrates with a Telegram bot to streamline photo uploads into an online album.
Users can seamlessly create categories and assign photos directly through the bot interface.
All interactions are safeguarded with a robust authentication flow, requiring username, password, and TOTP (Time-based One-Time Password) verification to ensure high-level security and user integrity.

Any more features or ideas you can suggest for me?

/r/flask
https://redd.it/1k88wu1
D IJCAI 2025 Paper Result & Discussion

This is the discussion for accepted/rejected papers in IJCAI 2025. Results are supposed to be released within the next 24 hours.

/r/MachineLearning
https://redd.it/1k9twhg
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/1kaagpl
Clean method for ORM

Hello People,
I just picked up a ticket in which there appears to be DB savings in the clean() method of a model. I’ve never seen this before and I think it’s probably not good practice as clean() should be validating data only and not actually saving anything to the DB.

My question, how do you go about updating an attribute from another model?

Such as ModelA gets updated. So we have to update ModelB timestamp.
I was thinking of using a postsave() but unsure.


Context:

Model1:
Cost Model

def clean():
cost.account.timestamp =
timezone.now()
cost.account.validated
save()

Model2:
Account Model




/r/django
https://redd.it/1ka6ht5
Looking for Django project

Hey everyone!
I'm planning to start a Django project and I'm looking for some cool and interesting project title ideas. It can be anything—web apps, automation tools, dashboards, or something creative! If you have any suggestions or ideas, please drop them here.
Would love to hear your thoughts!

/r/djangolearning
https://redd.it/1k6bu2v
lblprof: Easily see your python code’s performance, Line by Line

Hello [r/Python](https://www.reddit.com/r/Python/),

I built this small python package ([lblprof](https://github.com/le-codeur-rapide/lblprof)) because I needed it for other projects optimization (also just for fun haha) and **I would love to have some feedback on it.**

# What my project Does ?

The goal is to be able to know very quickly how much time was spent on each line during my code execution.

I don't aim to be precise at the nano second like other lower level profiling tool, but I really care at seeing **easily** where my 100s of milliseconds are spent. I built this project to replace the old good `print(start - time.time())` that I was abusing.

This package profile your code and display a tree in the terminal showing the duration of each line (you can expand each call to display the duration of each line in this frame)

Example of the terminal UI: [terminalui\_showcase.png (1210×523)](https://raw.githubusercontent.com/le-codeur-rapide/lblprof/refs/heads/main/docs/terminalui_showcase.png)

# Target Audience

Devs who want a quick insight into how their code’s execution time is distributed. (what are the longest lines ? Does the concurrence work ? Which of these imports is taking so much time ? ...)

# Installation

pip install lblprof

The only dependency of this package is pydantic, the rest is standard library.

# Usage

This package contains **4 main functions**:

* `start_tracing()`: Start the tracing of

/r/Python
https://redd.it/1ka71qs
Some security in LLM based apps

Hi everyone!

I'm excited to share a project I've been working on: Resk-LLM, a Python library designed to enhance the security of applications based on Large Language Models (LLMs) like OpenAI, Anthropic, Cohere, and others.

## What My Project Does
Resk-LLM focuses on adding a protective layer to LLM interactions, helping developers experiment with strategies to mitigate risks like prompt injection, data leaks, and content moderation challenges.

🔗 GitHub Repository: https://github.com/Resk-Security/Resk-LLM

## Motivation
As LLMs become more integrated into apps, security challenges like prompt injection, data leakage, and manipulation attacks have become serious concerns.
However, many developers lack accessible tools to experiment with LLM security mechanisms easily.

While some solutions exist, they are often closed-source, narrowly scoped, or too tied to a single provider.

I built Resk-LLM to make it easier for developers to prototype, test, and understand LLM vulnerabilities and defenses — with a focus on transparency, flexibility, and multi-provider support.

The project is still experimental and intended for learning and prototyping, not production-grade security yet — but I'm excited to open it up for feedback and contributions.

## Target Audience
Resk-LLM is aimed at:

Developers building LLM-based applications who want to explore basic security protections.

Security researchers interested in LLM attack surface exploration.

Hobbyists or students learning about the security challenges of generative

/r/Python
https://redd.it/1kahx5r
Implementing a confirmation view after a form submission

Hi everyone,

I'm very new to Django and web development. I have a simple form where a user can enter a list of data, say names. Since the user isn't savvy with SQL, I want the app to basically update some rows in our database based on the list. But before the changes are written to the database, I want there to be a view which basically shows what the user entered into the form. So here's the interface/sequence I'm trying to implement:

1. User is presented with a textbox which allows them to submit a list, eg "Bob, John"
2. Django app presents the user with a summary of the input and asks them to confirm, eg "you have entered 2 names, double check that this is correct". If the database doesn't know about Bob or John, then this is when it would notify the user.
3. The Django app performs the relevant update

I've been researching this online and I'm seeing different recommendations. The simplest solution seems to be to have a confirmation view which has a hidden input with the same data as the original form? But then wouldn't the app be processing the input data twice? Do you guys have

/r/django
https://redd.it/1kanhms
RYLR: Python Library for Lora uart modules

Hi, RYLR is a simple python library to work with the RYLR896/406 modules. It can be use for configuration of the modules, send message and receive messages from the module.


What does it do:

Configuration modules
Get Configuration data from modules
Send message
Receive messages from module

Target Audience?

Developers working with rylr897/406 modules

Comparison?

Currently there isn't a library for this task

/r/Python
https://redd.it/1kak4r7
[P] hacking on graph-grounded retrieval for SEC filings + an AI “legal pen-tester”—looking for feedback & maybe collaborators

Hey ML friends,

Quick intro: I’m an ex-BigLaw attorney turned founder. For the past few months I’ve been teaching myself anything AI/ML, and prototyping two related ideas and would love your thoughts (or a sanity check):

1. **Graph-first ingestion & retrieval**
* Take 300-page SEC filings → normalise tables, footnotes, exhibits → emit embedding JSON-L/markdown representations .
* Goal: 50 ms query latency over the whole doc with traceable citations.
* Current status: building a patent-pending pipeline
2. **Legal pen-testing RAG loop**
* Corpus: 40 yrs of SEC enforcement actions + 400 class-action complaints.
* Potential work thrusts: For any draft disclosure, rank sentences by estimated Rule 10b-5 litigation lift and suggest rewrites with supporting precedent.

All in all, we are playing with long-context retrieval. Need to push a retrieval encoder beyond today's oken window so an entire listing document fits in a single pass. This might include extending the LoCo/M2-BERT playbook potentially to pull the right spans from full-length filings (tens-of-thousands of tokens) without brittle chunking. We are also experimenting with some scaffolding techniques to approximate infinite context window. Not an expert in this so would love to hear your thoughts on best

/r/MachineLearning
https://redd.it/1kag8w2
Bring Python 3.10’s match/case to 3.7+ with patterna

# Python Structural Pattern Matching for 3.7+

Patterna is a pure Python library that backports the structural pattern matching functionality (match/case statements) introduced in Python 3.10 to earlier Python versions (3.7 and above). It provides a decorator-based approach to enable pattern matching in your code without requiring Python 3.10.

# Installation

pip3 install patterna

# GitHub, PyPI, Docs

GitHub: saadman/patterna
PyPI: patterna/0.1.0.dev1/

(Post edited for those who wants more context into the inner workings)

Wiki For those Further interested in the inner workings: https://deepwiki.com/saadmanrafat/patterna

# Usage

from patterna import match

class Point:
matchargs = ("x", "y")

def init(self, x, y):
self.x = x
self.y = y

u/match
def describe
point(point):
match point:
case Point(0, 0):


/r/Python
https://redd.it/1kardx9
Python projects for beginners

Hello,

I'm very new to Python and looking beginner friendly tasks for practice.
I don't have any idea what I could prgramm.
I know you can use Python for practically everything.
My interest is programming a calculator or a game.
I've already asked chat gpt for ideas but it gives you the codes to cooy but that's no very helpful.
Do you have any ideas which codes helped you?
Are there good sites you could recomment?

Thanks



/r/Python
https://redd.it/1kat5bh