Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
Perplexity Pro 1 Year Vouchers (check reviews)
Get a 1-Year Perplexity Pro Voucher for just $29 (regular price $200) through my service provider.
This includes access to advanced models like:
* Claude 3.5 Sonnet, Claude 3.5 Haiku (Opus Removed), Grok-2
* GPT-4o, o1 Mini for Reasoning & Llama 3.1
* Image generators: Flux.1, DALL-E 3, Playground v3 Stable Diffusion XL
Works globally and payments are accepted via PayPal for buyer protection.
# How It Works:
1. Join the 👉[Discord](https://discord.gg/h2HUMpKxhn) of 230+ Members
2. Pay via PayPal
3. Promo link redeemed
[Vouch from Buyers](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv38zi), [Feedback 2](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gv3g3d), [Feedback 3](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1gu0bkm), [Feedback 4](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g510cq), [Feedback 5](https://www.reddit.com/r/ChatGPTPromptGenius/comments/1g6ilkh)
/r/flask
https://redd.it/1h6glux
ProgressPal (an alternative/iteration to tqdm)
**Get ProgressPal** here is full documentation available in the Github repo: [https://github.com/levi2234/Progresspal](https://github.com/levi2234/Progresspal)
**What My Project Does** The code progress tracker called ProgressPal provides an easy to use environment for tracking python functions, iterables and logs. It tries to keep the known tqdm syntax while expanding the usability for simulataneous python runtimes such as Threads and parallel processes. ProgressPal provides an easy to access online environment which collects all progress in one place, visible from anywhere in the world. The main features included are:
* **Progress Tracking**: Track the progress of Python iterables, functions, and log messages in real-time.
* **Decentralized Monitoring**: Monitor multiple Python scripts from any device with an internet connection.
* **Collaborative Projects**: Collaborate and monitor the real-time progress of various scripts running on different devices and processes.
* **Distributed Systems**: Track progress across distributed systems for seamless monitoring and remote collaboration.
* **Function Tracking**: Track the call-count, execution time distribution, execution history, time between calls, error count, function file origin, and function name.
* **Iterable Tracking**: Track the progress of iterables and generators with a progress bar. Additionally, track the total number of iterations, current iteration, and percentage completion, time remaining, iteration execution time, and iteration rate.
* **Log Server**: Start a log server to receive
/r/Python
https://redd.it/1h6hu9s
Help us make it happen ❤️
https://www.djangoproject.com/weblog/2024/dec/04/help-us-make-it-happen/
/r/django
https://redd.it/1h6brsn
How to automatically deploy Python web application
https://quan.hoabinh.vn/post/2024/12/how-to-automatically-deploy-python-web-application
/r/django
https://redd.it/1h68xo2
Wednesday Daily Thread: Beginner questions
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1h629va
PyBox: A Browser-Based Python IDE for Coding Anytime, Anywhere
What My Project Does
PyBox is a browser-based Python IDE designed for flexibility and accessibility. With it, you can:
Write, execute, and experiment with Python code directly in your browser—no installations required
Use an integrated Bash terminal for system-level scripting.
Manage files with drag-and-drop and a file manager
Install and run packages
Visualize data using libraries like Matplotlib within the browser
Target Audience
PyBox can be useful for:
People experimenting with Python who want a simple, no-setup-required environment
Hobbyists or educators looking for a lightweight way to teach or experiment with Python code
Developers who occasionally need a quick and portable coding environment
It’s not built for large-scale production projects but works well for learning, prototyping, and scripting
Comparison
The browser-based nature of PyBox sets it apart from traditional IDEs in several ways:
1. Portability: Since everything happens in the browser, PyBox works on any device—PCs, tablets, or even Chromebooks—without worrying about installations or configurations
2. Consistency: Whether you switch from one computer to another or use a public device, the coding environment remains consistent
3. Lightweight and Accessible: All you need is a browser. No downloading or installing tools, and no lengthy setup processes
It basically combines the accessibility of Replit with the
/r/Python
https://redd.it/1h5hjmg
Fine-grained open source authorization solution (SDK for Python)
Hey, Python community! If anyone here is thinking about implementing authorization for RBAC / ABAC in your apps - feel free to check out our OSS solution: [https://github.com/cerbos/cerbos](https://github.com/cerbos/cerbos)
It’s useful if you’re dealing with complex access control scenarios and fast-growing apps, where requirements are constantly changing.
**What My Project Does:**
Cerbos PDP is an authorization solution that lets users define context-aware access control in simple, intuitive, and testable policies. Some of Cerbos PDP’s key capabilities:
* Infinitely scalable RBAC and ABAC
* Plug-and-play & language-agnostic
* Stateless design
* Self-hosted
* Centralized audit logs of all authorization requests help compliance with ISO27001, SOC2, and HIPAA requirements
**Target Audience:**
Software developers working on building authorization for apps, AI agents, and AI companions.
**Comparison**
The most common alternative to externalized authorization is the “build it yourself” approach, hard-coded authorization. Here is how our approach is different:
* Our off-the-shelf solution allows you to avoid the technical debt and developer cost of hard-coded authorization.
* Having the separation of the permissions from the code base just makes the code and the permissions more elegant (no spaghetti code).
* Permissions are centralized, so they're not tied to specific endpoints.
* Cerbos
/r/Python
https://redd.it/1h5v7n7
Made a web platform using django over the last 6 months and loved it!
Coming from python background, django seemed like the perfect choice.
There was a lot of learning along the way. This was my first ever experience in web dev, coming from a large data science background.
I rebuilt over 4 times, and changed from end 3 times from not having all the foresights such as ssr for seo.
My final stack was nuxt/vue with django and postsql, jwt deployed on a digital ocean droplet.
Any questions I’d love to answer, it’s been quite the journey.
/r/django
https://redd.it/1h5s306
Beginner Web App Deployment with Flask
I am looking to start hosting a web application of mine on an official web domain and need a little help. Right now, I have a full stack web application in JavaScript and Flask with a MySQL server. Currently, I run the website through ngrok with a free fake domain they create, but I am looking to buy a domain and run my app through that .com domain. I also have a Docker environment set up to run my app from an old computer of mine while I develop on my current laptop. What exactly would I need to run this website? I am thinking of buying the domain from porkbun or namecheap and then using GitHub and netlify to send my app code to the correct domain. Should I be using something with docker instead to deploy the app given I have a database/MySQL driven app? Should I use ngrok? Any help explaining what services and service providers I need to put in place between domain hosting and my Flask/JS app would be appreciated.
/r/flask
https://redd.it/1h53a3a
What's the cheapest way to host a python script?
Hello, I have a Python script that I need to run every minute. I came across PythonAnywhere, which costs about $5 per month for the first Tier Account.
Are there any cheaper alternatives to keep my script running? Would it be more cost-effective to run the script continuously by leaving my computer on? I’m new to this, so any advice or suggestions would be greatly appreciated. Thank you!
/r/Python
https://redd.it/1h5hikf
Feedback for project creating conversational agents using a Finite State Machine (FSM) and LLMs
Hi r/Python community!
I've been working on a project combining Finite State Machines and Large Language Models.
What My Project Does
This project provides a framework for building conversational agents using a Finite State Machine (FSM) powered by LLMs like OpenAI GPT. It aims to create structured tools like step-by-step teaching systems, customer support bots, and multi-step memory games while addressing issues like hallucinations, loss of context, and unpredictability. I have a few example usages in the repo.
Target Audience
This is currently an experimental setup, and also part of a research project I am doing for university. For now it is meant for developers and experimenters mainly. Requires an OpenAI API key (currently tested on gpt-4o-mini).
Comparison
Unlike typical LLM-based chatbots, this combines FSM with LLMs to enforce structured, predictable conversations, making it ideal for use cases requiring adherence to predefined paths.
If anyone is interested I would love to hear your feedback and thoughts! The repo is here: https://github.com/jsz-05/LLM-State-Machine
Cheers!
/r/Python
https://redd.it/1h594wc
I don't know how set SECRET_KEY
Which of the two ways is correct?
SECRET_KEY = os.environ.get('SECRET_KEY') or 'myKey'
or
SECRET_KEY = os.environ.get('SECRET_KEY') or os.urandom(24)
/r/flask
https://redd.it/1h532hk
Best practice for self deployable open source Django project
Hi all,
I am working on a simple Django app for monitoring the progress of Snakemake workflows. For context, Snakemake is a workflow manager, largely targeted towards life sciences (bioinformatics, genomics, etc). It is run on the command line and currently lacks a good way to monitor the progress of your workflows (they can run for weeks in some cases).
I have experience building Django webapps and deploying them for myself. However with this, I would like to make the whole webapp a pip installable package such that users can just install via pip and spin up the server. This is extremely important, as in order for this to be a useful tool, the barrier to entry should be very low for users with little technical experience.
I have already worked out how the workflows will communicate with the running Django server. My general idea is this:
1. User starts the server
2. User starts snakemake workflow, gives server address
3. As workflow runs user can view progress on browser
Where I have questions is how to handle deployment and migrations:
1. For the database, I'll use sqlite since thats easy and I don't expect high traffic. I'm not sure how to apply migrations to a project
/r/django
https://redd.it/1h54h76
Git and Jupyter Notebooks: The Ultimate Guide
https://www.reviewnb.com/git-jupyter-notebook-ultimate-guide
/r/IPython
https://redd.it/1h4v1n9
Better, Faster Python Projects: A Deep Dive into uv
https://www.saaspegasus.com/guides/uv-deep-dive/
/r/django
https://redd.it/1h4vak9
Frontend Options for Flask App with MongoDB
Hello r/flask,
I've been developing a Flask application that aggregates IT alerts from various sources into a MongoDB. The Flask application allows its users to view the alerts in a large table where they can filter them based on properties and timestamps. They can also assign alerts to themselves and resolve them with a specific outcome. A dashboard with a few graphs provides basic statistics to stakeholders.
So far I have only used Flask features and a few plugins (mainly flask-login, flask-mongoengine and flask-mail) for the backend, and Jinja2 templates with Boostrap 5 classes for the frontend. For the graphs I used the apache echarts JS library. I've also written some custom frontend functionality in vanilla JS, but as I'm not that comfortable with Javascript and frontend development in general, most of the functionality is implemented in the backend.
This approach has worked well so far, but I am beginning to reach its limits. For example, I want to add features such as column-based sorting, filtering and searching to the large table with thousands of IT alerts. I want to enable multiselect so that users can assign and close multiple alerts at once. A wet dream would be to dynamically add and remove
/r/flask
https://redd.it/1h6h37m
HELP What Am I Missing in Simplifying Django Development with Docker?
I inherited a Django project that runs inside Docker. I’ve managed to get it running, but I have some questions about improving the development experience.
When I write code, I like to test how functions work or behave quickly. In other projects, I simply right-click to run/debug. In Django, I’ve found the following approaches, but each has some friction:
Write a Test and Trigger Debug Inside the Pycharm IDE
This works, but it requires connecting to Docker every time or starting a test container, which feels slow for quick tests.
Write an Endpoint and Trigger it
This also works, but I haven’t found a good way to debug or set breakpoints in my IDE to start debugging there.
Use the Django Python Shell
So far, this has been the best option, but it still involves friction. I need to copy code, import a lot of libs manually, and rely on print statements, which I’m not a fan of.
What do i oversee ? How can i improve my developing experience ?
/r/django
https://redd.it/1h6ewrx
Looking for help with a Flask extension
I was looking for Flask extensions that were able to store traffic data from requests and came across flask-statistics, which is no longer maintained.
I've created somewhat of a successor called flask-traffic
I've done the majority of what I think an extension like this should look like, and I'm wondering if anyone else would like to help out?
I'm not sure if I should create a blueprint to show the traffic much like flask-statistics did, or just provide ways of accessing the data from within routes and let the user deal with the display.
Some additional tasks I can think of are; adding more Stores (Like Redis), a way to only log on specified routes (with a decorator maybe?)
I plan on handing this project over to the Pallets-Eco once it's in a state that makes sense, and works well.
/r/flask
https://redd.it/1h5zsid
Dink: a command line notifier
Hi there,
I’m Pranav, a self-taught python developer. Just wanted to share a little script I made.
What my project does:
Dink is a command line notifier. It can notify you of the completion of a command, so you don’t have to keep checking the terminal.
Target audience:
All devs.
Comparison:
This, unlike maybe a few other tools, is extremely lightweight and does not require extensive setup. All you do is install it and just put the word dink before any command you want notified about and that's it.
You can find this at https://github.com/Pranav435/dink.git
This has, in the 6 months since I made it, saved me a bunch of hours, and I hope it is equally as useful to you.
Would appreciate all feedback!
Cheers.
/r/Python
https://redd.it/1h5qv5d
How did FastAPI gain so much traction?
I am looking to understand and hopefully learn something as to how FastAPI ended up gaining so much popularity. Is there a lesson to be learned that other open source projects can implement as well. It’s actually a genuine question that I want to find answers to. Thank you!
/r/django
https://redd.it/1h5x0xv
PyCon Austria 2025
PyCon Austria will take place on April 6 and 7, 2025 in Eisenstadt, Austria. The Call for Papers is already open, so you can submit your proposals for talks and workshops. Although registration is recommended for visitors, attendance is free of charge. The conference will start with an opening party on April 5, 2025.
Website with details, registration, and sponsor information: https://at.pycon.org
Call for Papers: https://www.papercall.io/pycon-austria
/r/Python
https://redd.it/1h5ubiu
Adding multiple instances of the same product into cart
Hi guys, thanks for reading my post.
I'm currently making an Ecommerce website on Django that sells electronic devices for my university project. I chose Django as the primary framework since my teacher heavily emphasizes the interaction with databases.
Some clarification before I get to my question is that there are multiple instances of the same product stored within the database with all different IDs. For example, **If there are 5 "Laptop A"s, then all 5 of them must have different IDs**. So I've been having a lot of difficulty with the process of adding the products into the cart. Additionally, all products have attribute "Status" that indicates whether it's a new or secondhand product.
Suppose for my cart I currently have 10 instances of Laptop A.
7 of them are New and 3 of them are Secondhand.
class Product(models.Model):
id = models.IntegerField(db_column='ID', primary_key=True)
image = models.CharField(db_column='Image', max_length=255)
name = models.CharField(db_column='Name', max_length=255)
price = models.IntegerField(db_column='Price')
m_date = models.DateField(db_column='M_Date', verbose_name="Manufacture Date")
/r/django
https://redd.it/1h5n547
D Monthly Who's Hiring and Who wants to be Hired?
For Job Postings please use this template
>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]
For Those looking for jobs please use this template
>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]
​
Please remember that this community is geared towards those with experience.
/r/MachineLearning
https://redd.it/1h3u444
Are there any free hosting services for Django now?
ever since Heroku stopped offering free hosting for Django apps (RIP the GOAT), we've been left with very few good hosting services with free tiers. What is the current consensus for best free-tier hosting providers right now?
/r/django
https://redd.it/1h5ehet
Building native Python desktop application with Pyloid and Gradio
Let's build a desktop chat application that streams responses from an LLM. We'll use three key libraries that work beautifully together:
- **[Pyloid](https://github.com/pyloid/pyloid)**: Creates native desktop applications -- like Electron but with Python
- **[Gradio](https://gradio.app)**: Builds the chat interface
- **[Promptic](https://github.com/knowsuchagency/promptic)**: Handles LLM interactions
Source Code: https://github.com/knowsuchagency/pyloid-chat-demo
## Prerequisites
Before running the application, you'll need:
- An OpenAI API key ([get one here](https://platform.openai.com/api-keys))
- [uv](https://github.com/astral-sh/uv) for Python package management
- [just](https://github.com/casey/just) command runner
## The Chat Interface
First, let's create the chat interface. This is where Gradio and Promptic work together:
```python
import gradio as gr
from promptic import llm
@llm(memory=True, stream=True)
def assistant(message):
"""{message}"""
def predict(message, history):
partial_message = ""
for chunk in assistant(message):
partial_message += str(chunk)
yield partial_message
with gr.ChatInterface(
fn=predict,
title="Chat Demo",
) as chat_interface:
chat_interface.chatbot.clear(assistant.clear)
```
The code above:
- Uses Promptic's `@llm` decorator to handle LLM interactions
- Implements streaming responses using a generator
- Creates a chat interface with Gradio
- By passing `memory=True`, Promptic will manage conversation history
## Making It a Desktop App
Now, let's wrap our chat interface in a native window using Pyloid:
```python
from pyloid import Pyloid
import threading
import time
import socket
from contextlib import contextmanager
HOST = "127.0.0.1"
PORT =
/r/Python
https://redd.it/1h5a26x
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/1h59v6z
One-Click Deployment tool for Docker Apps (First Stable Release 0.2.0)
Hey Django devs! 👋
I'm excited to share Leverans, a deployment tool I've been working on that makes getting your apps online stupid simple. Here's why you might love it:
🚀 Key Features:
* Deploy ANY Docker-based app with a single command
* No vendor lock-in
* Works on minimal hardware (just 0.5 vCPU, 500 MB RAM)
* CLI-based with super simple config
* No need for SSH, external services, or complex setups
Why I built this: Deploying apps is a pain. Existing tools are either too complex or too restrictive. Leverans fixes that.
For example, this is all you need to describe a simple Django project:
\`\`\`yaml
project: django
apps:
main:
domain: [your-domain.com](http://your-domain.com)
port: 8000
volumes:
django-sqlite: /data
\`\`\`
And run the \`lev deploy\` command. And that's it, your application is online. On your own private VPS server.
Docs: [https://leverans.dev](https://leverans.dev)
GitHub Examples: [https://github.com/ethanhamilthon/leverans/tree/main/examples](https://github.com/ethanhamilthon/leverans/tree/main/examples)
This is v0.2.0 - our first stable release. Would love your feedback and a ⭐ on GitHub if you find it useful!
/r/django
https://redd.it/1h50zfj
Best practice for autocomplete on a ModelChoiceField with ~10'000 entries
Dear Django community,
I am using the modern standard of Django + HTMX + Crispy. As part of a form, I would like the user to select one of 10'000 clients. The user should type in a few letters of either the first name or the last name and then get a dropdown of matching clients and be able to click on one of them.
So far, I explored and considered the following options:
1. I could build it from scratch in pure HTMX. Would work, but it's work traveling back and forth, doesn't seemingly integrate with the rest of my form and I'd need to travel to the backend for each letter the user types.
2. I could pass the entire client list to the frontend and do in Javascript, but I don't like to code stuff in javascript.
3. I implemented this video: django-crispy-forms & ModelChoiceFields / Select2 Integration for Searchable Form Fields, which does it as a standard Django field and then puts Select2 over it. However, the page load is too slow and I don't like the dependency on jquery.
4. I considered django-autocomplete-light, however, at first sight, it seems quite heavy with dependencies on multiple libraries. Further it
/r/django
https://redd.it/1h4zbyn
Iris Templates: A Modern Python Templating Engine Inspired by Laravel Blade
What My Project Does
As a Python developer, I’ve always admired the elegance and power of Laravel’s Blade templating engine. Its intuitive syntax, flexible directives, and reusable components make crafting dynamic web pages seamless. Yet, when working on Python projects, I found myself longing for a templating system that offered the same simplicity and versatility. Existing solutions often felt clunky, overly complex, or just didn’t fit the bill for creating dynamic, reusable HTML structures.
That’s when Iris Templates was born—a lightweight, modern Python template engine inspired by Laravel Blade, tailored for Python developers who want speed, flexibility, and an intuitive way to build dynamic HTML.
# 🧐 Why I Developed Iris Templates (Comparison)
When developing Python web applications, I noticed a gap in templating solutions:
Jinja2 is great but can feel verbose for straightforward tasks.
Django templates are tied closely to the Django framework.
Many templating engines lack the modularity and extendability I needed for larger projects.
Iris Templates was created to bridge this gap. It's:
Framework-agnostic: Use it with FastAPI, Flask, or even standalone scripts.
Developer-friendly: Intuitive syntax inspired by Blade for faster development.
Lightweight but Powerful: Built for efficiency without sacrificing flexibility.
# 🌟 Key Features of Iris Templates
1. "extends" and "section" for Layout Inheritance; Create a base layout and extend it effortlessly.
2.
/r/Python
https://redd.it/1h4zfnr
ComputeLite - A true serverless tool
What My Project Does:
ComputeLite is a true serverless tool that leverages the power of WebAssembly (WASM) and SQLite OPFS to ensure that all data and code remain securely in the browser, with no server dependencies or external storage. Right now it supports Python (powered by Pyodide) and SQL( powered by SQLITE)
So you can write all your python code and use Pyodide supported or pure python packages right away in browser without any need to install anything.
Target Audience:
Students, Developers, Could be used for scripting
Comparison:
It can be compared with PyScript but user can create different models which could include scripts with relative imports and packages listed in requirements.txt file
Link: https://computelite.com/
GitHub: https://github.com/computelite/computelite
/r/Python
https://redd.it/1h4spi7