pythondaily | Образование

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Подписаться на канал

Python Daily

Tailwind v4 problems with Flask

Hey guys I installed Tailwind v4 with CLI to work with Flask but I am having problems in that the UI does not show everything it must show (for example, colors). Anyone with the same issue? By the way v3 works fine!

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

Читать полностью…

Python Daily

ParLlama v0.3.15 released. Supports Ollama, OpenAI, GoogleAI, Anthropic, Groq, Bedrock, OpenRouter

# What My project Does:

PAR LLAMA is a powerful TUI (Text User Interface) written in Python and designed for easy management and use of Ollama and Large Language Models as well as interfacing with online Providers such as Ollama, OpenAI, GoogleAI, Anthropic, Bedrock, Groq, xAI, OpenRouter

# Whats New:

# v0.3.15

* Added copy button to the fence blocks in chat markdown for easy code copy.

# v0.3.14

* Fix crash caused some models having some missing fields in model file

# v0.3.13

* Handle clipboard errors

# v0.3.12

* Fixed bug where changing providers that have custom urls would break other providers
* Fixed bug where changing Ollama base url would cause connection timed out

# Key Features:

* Easy-to-use interface for interacting with Ollama and cloud hosted LLMs
* Dark and Light mode support, plus custom themes
* Flexible installation options (uv, pipx, pip or dev mode)
* Chat session management
* Custom prompt library support

# GitHub and PyPI

* PAR LLAMA is under active development and getting new features all the time.
* Check out the project on GitHub or for full documentation, installation instructions, and to contribute: [https://github.com/paulrobello/parllama](https://github.com/paulrobello/parllama)
* PyPI [https://pypi.org/project/parllama/](https://pypi.org/project/parllama/)

# Comparison:

I have seem many command line and web applications for interacting with LLM's but have not found any TUI related applications

# Target Audience

Anybody that loves

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

Читать полностью…

Python Daily

RedCoffee: Making SonarQube Reports Shareable for Everyone

Hi everyone,

I’m excited to share a new update for [RedCoffee](https://pypi.org/project/redcoffee/), a Python package that generates SonarQube reports in PDF format, making it easier for developers to share analysis results efficiently.

# Motivation:

Last year, while working on a collaborative side project, my team and I integrated SonarQube to track code quality. Since this was purely a learning-focused initiative, we decided to use the SonarQube Community Edition, which met our needs—except for a few major limitations:

* There was no built-in way to share the analysis report.
* Our SonarQube instance was running locally in a Docker container.
* No actively maintained plugins were available to generate reports.

After some research, I found an old plugin that supported PDF reports, but it had not been updated since 2016. Seeing no viable solution, I decided to build RedCoffee, a CLI-based tool that allows users to generate a PDF report for any SonarQube analysis, specifically designed for teams using the Community Edition.

I first introduced RedCoffee on this subreddit around nine months ago, and I received a lot of valuable feedback. Some developers forked the repository, while others raised feature requests and reported bugs. This update includes fixes and enhancements based on that input.

**What's new in the recent update ?**

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

Читать полностью…

Python Daily

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/1il1iwf

Читать полностью…

Python Daily

What is this blank box on the left ? this is on the documentation page of python

Can anyone tell me what is this ??

this is the link : https://docs.python.org/3.13/genindex.html



https://preview.redd.it/r5qpcg242zhe1.png?width=1857&format=png&auto=webp&s=de04daafd00403e68dc3c385d06d3ceb5229eb9c



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

Читать полностью…

Python Daily

PomdAPI: Declarative API Clients with Tag-Based Caching (HTTP/JSON-RPC) - Seeking Community

Hey everyone,

I’d like to introduce pomdapi, a Python library to simplify creating and caching API calls across multiple protocols (HTTP, JSON-RPC, XML-RPC). It features a clear, FastAPI-like decorator style for defining endpoints, built-in sync/async support, and tag-based caching.

## What My Project Does

- **Declarative Endpoints**: You define your API calls with decorators (@api.query for reads, @api.mutation for writes).
- **Tag-Based Caching**: Tag your responses for easy invalidation. For example, cache getUser(123) under Tag("User", "123") and automatically invalidate it when the user changes.
- **Sync or Async**: Each endpoint can be called synchronously or asynchronously by specifying is_async=True/False.
- **Multi-Protocol**: Beyond HTTP, you can also use JSON-RPC and XML-RPC variants.
- **Swappable Cache Backends** : Choose in-memory, Redis, or Memcached.
Effectively, pomdapi helps you avoid rewriting the usual “fetch => parse => store => invalidate” logic while still keeping your code typed and organized.

## Target Audience

- Developers who need to consume multiple APIs—especially with both sync and async flows—but want a single, typed approach.
- Production Teams wanting a more systematic way to manage caching and invalidation (tag-based) instead of manual or ad-hoc solutions.
- Library Authors or CLI Tool Builders who need to unify caching across various external services—HTTP, JSON-RPC, or even custom protocols.

## Comparison
- Requests + Manual

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

Читать полностью…

Python Daily

A Lightweight Camera SDK for Windows, macOS, and Linux

If you’re looking for a lightweight alternative to OpenCV for camera access on Windows, Linux, and macOS, I’ve created a minimal SDK called lite-camera .

Installation

pip install lite-camera

Quick Usage

import litecam

camera = litecam.PyCamera()

if camera.open(0):

window = litecam.PyWindow(
camera.getWidth(), camera.getHeight(), "Camera Stream")

while window.waitKey('q'):
frame = camera.captureFrame()
if frame is not None:
width = frame0
height = frame1
size = frame2
data = frame3


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

Читать полностью…

Python Daily

Best approach for searching and filtering data?

Hello everyone,

I'm currently developing an Angular/Django application that heavily relies on searching and filtering data. I'm trying to determine the best approach for implementing these features efficiently. Here’s how the app needs to work:

1. Users will have access to an "advanced filtering" option with almost 50 different filters.
- Many of these filters are dropdowns representing the keys of related models.
- The remaining filters are text-based, allowing users to enter keywords or phrases.

For the text-based search filters, I need to be able to handle spelling errors and find matches even when the word order differs (e.g., "large, green, and heavy" vs. "heavy, green, and large"). Also, some text inputs will need to be searched across multiple columns.

2. The app will have two search modes: first one will return only the results that match 100% of the user's filters. The other mode will need to use a scoring system, ranking results by their relevance (e.g., 100% matches first, followed by 90%, 80%, etc.).

3. The table in question has around 3.000 records.

I would love some suggestions about how to implement this, will Django filters be enough? What would be the best way to handle the weighted search? Any recommendations on handling fuzzy search

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

Читать полностью…

Python Daily

Best way to get better at practical Python coding

I've noticed a trend in recent technical interviews - many are shifting towards project-based assessments where candidates need to build a mini working solution within 45 minutes.

While we have LeetCode for practicing algorithm problems, what's the best resource for practicing these types of practical coding challenges? Looking for platforms or resources that focus on building small, working applications under time pressure.

Any recommendation is much appreciated!

(Update: removed the website mentioned, not associated with it at all :) )

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

Читать полностью…

Python Daily

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/1ik9pae

Читать полностью…

Python Daily

Handling Multiple Request of Streaming Responses for a Flask App?

Hi,

I'm using Flask for API end points. Front end is just a static site.
I'm currently just on the basic paid tier of pythonanywhere with 2 web workers.
For simple API calls, it is enough.

But currently, I'm implementing a chat gpt streaming completion which takes from 3 to 10 seconds.
With multiple requests, the third user will have to wait for the other user to finish, since there are only 2 web workers. And for the 4th user onwards, I think that would feel like an eternity lol


An obvious solution is to increase the web workers but I only have intermittent multiple request. I don't want to pay for multiple web workers that don't get used.

How do I go about this in pythonanywhere or should I just switch to a different provider? Can you recommend one that allows me to just use a web worker based on demand?

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

Читать полностью…

Python Daily

Seniors of django, how did learn the framework?

Hey everyone,

I’m 24 and trying to learn Django, but I’ve been struggling a lot. I have a background in computer engineering and some coding knowledge, but I lack job experience. Whenever I try to study or work on projects, I get tired quickly and lose focus. I also tend to underestimate my skills, which makes learning feel even harder.

On top of that, I feel really alone in this process. I don’t have a support system of people who understand what I’m going through, and I can’t use freelance platforms due to my location. All of this makes it hard to stay motivated, especially when I don’t see immediate progress.

I’m wondering if anyone has been in a similar situation. How do you push through when you feel isolated and discouraged? How do you deal with feeling like you’re not good enough, even when logically you know you’re making progress? Any tips for managing fatigue while studying?

I’d really appreciate any advice or encouragement. Thanks in advance!

P.s: I am interested in coding and developing.



/r/django
https://redd.it/1ijvisj

Читать полностью…

Python Daily

Any recommendations for an open source Flask repo using pytorch?

Hi, I'd like to play around with some open source Flask project that is using pytorch under the hood. I'm working on a build system and I'd like to test it out with apps that are huge packages like pytorch.



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

Читать полностью…

Python Daily

SEARCH YOUTUBE AND VIMEO IN ONE PLACE

# I just found this website that let you search for youtube and Vimeos videos, it rank the best videos from the two platforms based on views and quality of the content. It is cool because you search one place and get videos from two different platform

link: http://www.tubesynopsis.com

/r/django
https://redd.it/1ijnlte

Читать полностью…

Python Daily

Django Islands: A modern approach to JavaScript integration
https://blopker.com/writing/07-django-islands-part-1/

/r/django
https://redd.it/1ijd4mo

Читать полностью…

Python Daily

Sync clipboard across guest and host with both running on wayland

# What My Project Does

WayClipSync enables clipboard sharing between guest and host in wayland sessions.

# Target Audience

People who like to tinker with different virtual machines and use wayland compositors that do not automatically support the clipboard sync.

# Comparison

spice-vdagent only works on X-org. On wayland the simplest way to copy from host is xsel -ob and send to host from guest is xsel -ib. It was annoying for me to remember to use this command, so I made this.

# Note

This program requires wl-clipboard to work

Github

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

Читать полностью…

Python Daily

How to Synchronize a Dropdown and Slider in Plotly for Dynamic Map Updates?

Hi all,

I’m working on a dynamic choropleth map using Plotly, where I have:
1. A dropdown menu to select between different questions (e.g., ‘C006’, ‘C039’, ‘C041’).
2. A slider to select the time period (e.g., 1981-2004, 2005-2022, 1981-2022).

The map should update based on both the selected question and period. However, I’m facing an issue:
• When I select a question from the dropdown, the map updates correctly.
• But, when I use the slider to change the period, the map sometimes resets to the first question and doesn’t update correctly based on the selected question.

I need the map to stay synchronized with both the selected question and period.

Here’s the code I’m using:

# Define the full questions for each column
questionlabels = {
'C006': 'Satisfaction with financial situation of household: 1 = Dissatisfied, 10 = Satisfied',
'C039': 'Work is a duty towards society: 1 = Strongly Disagree, 5 = Strongly Agree',
'C041': 'Work should come first even if it means less spare time: 1 = Strongly Disagree, 5 = Strongly Agree'
}

# Combine all periods into a single DataFrame with a new column for the period
means
period1merged'Period' = '1981-2004'
meansperiod2merged['Period'] = '2005-2022'
means
period3merged'Period' = '1981-2022'

combineddf = pd.concat([meansperiod1merged, meansperiod2merged, meansperiod3merged])

# Create a list of frames for

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

Читать полностью…

Python Daily

form."field" vs models."field": Defining field parameters in a single location

I plan to pass my models to the forms.py file and I'm wondering if it's possible to define parameters for form.field & models.field in the same line? For example: I want to define required=True & blank = Flalse.

userfirstname = (???).CharField(required=True, blank=False, max_length= 40, verbose_name="First Name")



edit: had true and false reversed in first paragraph

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

Читать полностью…

Python Daily

Stuck in a Loop Learning Web Dev—Need Advice!

Hey everyone,

I’ve been learning web development, but I feel stuck in a cycle—watching tutorials, building small projects, fixing bugs, and repeating the same things daily. It feels like I’m not making real progress.

I think I’m too comfortable with what I know and struggle to push myself into bigger challenges. Has anyone else felt this way? How did you break out of the loop and level up?

Would love any advice! Thanks!

/r/django
https://redd.it/1ikr38s

Читать полностью…

Python Daily

A new type of interpreter has been added to Python 3.14 with much better performance

Summary: This week I landed a new type of interpreter into Python 3.14. It improves performance by -3-30% (I actually removed outliers, otherwise it's 45%), and a geometric mean of 9-15% faster on pyperformance depending on platform and architecture. The main caveat however is that it only works with the newest compilers (Clang 19 and newer). We made this opt-in, so there's no backward compatibility concerns. Once the compilers start catching up a few years down the road, I expect this feature to become widespread.

Python 3.14 documentation: https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-tail-call


(Sorry can't cross-post here) Original post: https://www.reddit.com/r/ProgrammingLanguages/comments/1ikqi0d/a\_new\_type\_of\_interpreter\_has\_been\_added\_to/

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

Читать полностью…

Python Daily

Terminal Task Manager Using Python

I've built a terminal task manager for programmers, that lets you manage your coding tasks directly from the command line. Key features include:

Adding task

Marking tasks as complete

Listing pending task

Listing completed tasks (filter like today, yesterday, week etc)

I am thinking about adding more features like reminder, time tracking,etc. what would you want to see in this task manager. Comment below

I'd love for you to check it out, contribute and help make it even better
The project is available on GitHub https://github.com/MickyRajkumar/task-manager

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

Читать полностью…

Python Daily

Getting information about the fields of a django rest framework view

I'm currently working in a django rest framework project in which users are able to create projects, in the project they can select certain options and assign other users as members. This works fine, but only if you assume the front end already has information about what choices the user can select in each field, including the field where they can select other users (limited to their company). Is there a easy/standard way to give this "form" information to the front end app? What fields are present and their respective types, which ones are mandatory, choices available for each field, etc? I assume there is as this information is present in the browsable API, but I'm not sure how to access it or how to limit the user choices in a given field correctly

Am I supposed to use Metadata for this? If so, how?

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

Читать полностью…

Python Daily

I have published FastSQLA - an SQLAlchemy extension to FastAPI

Hi folks,

I have published FastSQLA:

Documentation: [https://hadrien.github.io/FastSQLA/](https://hadrien.github.io/FastSQLA/)
Github repo: https://github.com/hadrien/fastsqla

# What is it?

FastSQLA is an SQLAlchemy 2.0+ extension for FastAPI.

It streamlines the configuration and async connection to relational databases using SQLAlchemy 2.0+.

It offers built-in & customizable pagination and automatically manages the SQLAlchemy session lifecycle following SQLAlchemy's best practices.

It is licenced under the MIT Licence.

# Comparison to alternative

fastapi-sqla allows both sync and async drivers. FastSQLA is exclusively async, it uses fastapi dependency injection paradigm rather than adding a middleware as fastapi-sqla does.
fastapi-sqlalchemy: It hasn't been released since September 2020. It doesn't use FastAPI dependency injection paradigm but a middleware.
SQLModel: FastSQLA is not an alternative to SQLModel. FastSQLA provides the SQLAlchemy configuration boilerplate + pagination helpers. SQLModel is a layer on top of SQLAlchemy. I will eventually add SQLModel compatibility to FastSQLA so that it adds pagination capability and session management to SQLModel.

# Target Audience

It is intended for Web API developers who use or want to use python 3.12+, FastAPI and SQLAlchemy 2.0+, who need async only sessions and who are looking to following SQLAlchemy best practices, latest python, FastAPI & SQLAlchemy.

I use it in production on revenue-making projects.

# Feedback wanted

I would love to get feedback:

Are there

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

Читать полностью…

Python Daily

Unable to understand flask

Im a beginner in computer science with some experience in pandas, matplotlib, scikit-learn and decided to learn backend.
I started a tutorial and finished it. Did the coding along with tutorial, but I couldn’t understanding why the things are happening like how is things being done under the hood like factory template, user authentication etc , especially flask-sqlalchemy.

I try to read documentation for any issue or thing i wanna implement and do. The sql-alchemy documentation is really shit and I can’t get anything out of it.
As for flask whatever i open has way too many things and everything goes side ways.

In the end i ask gpt to help me and teach me. And it kinda does work, and i understand a bit. But I don’t understand how the underlying things work.
Question is since I’ve completed the tutorial, how can i improve and learn flask very well and understand backend concepts deeply. I am thinking of doing this side by side along with my uni for next four months.

Should i just try to build different projects with the help of gpt or not. I can’t really understand.

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

Читать полностью…

Python Daily

init() takes 1 positional argument but 3 were given

Someone Help please I don't know why my code is running on Juptyer

\# DASH Framework for Jupyter

from jupyter_dash import JupyterDash

from dash import dcc

from dash import html

from dash.dependencies import Input, Output

from pymongo import MongoClient

from bson.json_util import dumps

\# URL Lib to make sure that our input is 'sane'

import urllib.parse

\#TODO: import for your CRUD module

from aac_crud import AnimalShelter

\# Build App

app = JupyterDash("ModuleFive")

app.layout = html.Div([

\# This element generates an HTML Heading with your name

html.H1("Module 5 Asssignment - Stephanie Spraglin"),

\# This Input statement sets up an Input field for the username.

dcc.Input(

id="input_user".format("text"),

type="text",

placeholder="input type {}".format("text")),

\# This Input statement sets up an Input field for the password.

\# This designation masks the user input on the screen.

dcc.Input(

id="input_passwd".format("password"),

type="password",

placeholder="input type {}".format("password")),

\# Create a button labeled 'Submit'. When the button is pressed

\# the n_clicks value will increment by 1.

html.Button('Submit', id='submit-val', n_clicks=0),

\# Generate a horizontal line separating our input from our

\# output element

html.Hr(),

\# This sets up the output element for the dashboard. The

\# purpose of the stlye option is to make sure that the

\# output will function like a regular text area and accept

\# newline ('\\n') characters as line-breaks.

html.Div(id="query-out", style={'whiteSpace': 'pre-line'}),

\#TODO: insert unique identifier code here. Please Note:

\# when you insert another HTML element here, you will need to

\# add a comma to

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

Читать полностью…

Python Daily

PyPy v7.3.18 release

>Here's the blog post about the PyPY 7.3.18 release that came out yesterday. Thanks to @matti-p.bsky.social, our release manager! This the first version with 3.11 support (beta only so far). Two cool other features in the thread below.

https://pypy.org/posts/2025/02/pypy-v7318-release.html

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

Читать полностью…

Python Daily

DjangoMatrix.com - A project I've built in couple of weeks

Hey guys,

just wanted to share with you a project I've built with Django in the last couple of weeks.

The project is about being a one-stop-shop for everything related to Django packages, versioning, compatibilities etc.

You can find more detailed information on the r/Django post I've posted a while ago.

Given that it is open-source, you can scour trough the code and maybe get an "Aha!" moment.
(I'm not saying this is the perfect codebase (or project) I've built, but rather one that I've managed to build and deploy in very little time, and hoping if it gets some traction - we can do many, many improvements!)

p.s. All contributions are welcomed! Feel free to make a PR or report an Issue in the Github repository.

Check it out:
👉 DjangoMatrix.com
👉 GitHub Repository

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

Читать полностью…

Python Daily

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/1ijhini

Читать полностью…

Python Daily

What kind of security are you implementing for your Django REST API application?

Hi, I am working on a project. I use Next.js for the frontend and Django for the backend. I use AWS for all the hosting. My question is: what kind of security measures are you using for the Django application? I am reading about OWASP; you can check the link here: OWASP website.

I use 'Ratelimit' for some of my forms.

https://preview.redd.it/acqw9878gkhe1.png?width=1078&format=png&auto=webp&s=6ef9b85ac21b425a0657b2d016742ad56000308d



/r/django
https://redd.it/1ijaaij

Читать полностью…

Python Daily

Any convention on project structure?

Hey guys!

I've just started to implement an API service with Flask. I saw some project structures on the web. However, there is no consensus as far as I see if I am not wrong. Is there any Flask project directory structure by convention like Django?

Could you please share your suggestions for both a small project with a couple of models and endpoints and a larger project that needs different blueprints?

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

Читать полностью…
Подписаться на канал