pythondaily | Education

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

Subscribe to a channel

Python Daily

First Django Project: Confused About User Registration with Multi-Tenancy

Good evening everyone.
I'm developing a project in Django (it's my first one), and I'm a bit confused about the user registration and login system.

The idea is to have a landing page that includes a form to register both the user and the company, with the following fields:
Username, email, password and company name

This part is already done and working — it saves the data to the database and correctly creates the link between the user and the company.

However, I'm not sure if this is the best approach for user management in Django, since the framework provides a specific library for handling users and authentication.

This project uses a multi-tenant architecture, and that’s what makes me question the best way to implement user registration.

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

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

Python Daily

User cant be fetched from the frontend even when logged in

Hi everyone. I am building a fullstack app using Django Rest framework and React. I have setup a backend view to send the username of the current user

@api_view(["GET"])
@permission_classes([AllowAny])
def request_user(request):
    print(request.user)
    if request.user:
        return Response({
            "username": str(request.user)
        })
    else:
        return Response({
            "username": "notfound"
        })

And i am fetching its using axios at the frontend

const api = axios.create({
    baseURL: import.meta.env.VITE_API_URL,
    withCredentials: true,  // This is crucial
    headers: {
        'Content-Type': 'application/json',
    }
});

This is my home component (api is imported from above)

function Home() {
    const [user, setUser] =

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

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

Python Daily

[P] Hill Space: Neural networks that actually do perfect arithmetic (10⁻¹⁶ precision)

/r/MachineLearning
https://redd.it/1ly146y

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

Python Daily

[P] rowdump - A Modern Library for Streaming Table Output

I've just released **rowdump**, a lightweight, zero-dependency Python library for creating formatted table output with streaming capability and ASCII box drawing.

# What My Project Does

rowdump provides structured table output with immediate row streaming - meaning rows are printed as soon as you add them, without buffering data in memory. It supports:

* **Streaming output** \- Rows print immediately, no memory buffering required
* **ASCII box drawing** \- Beautiful table borders with Unicode characters
* **Custom formatters** \- Transform data (currency, dates, etc.) before display
* **Flexible column definitions** \- Configure width, type, truncation, and empty value handling
* **Multiple output options** \- Custom delimiters, output functions, and header separators

​

from rowdump import Column, Dump

# Create a table that streams output immediately
dump = Dump(ascii_box=True)
columns = [
Column("name", "Name", str, 15),
Column("age", "Age", int, 3),
Column("city", "City", str, 12),
]

dump.cols(columns) # Prints header immediately
dump.row({"name": "Alice", "age": 30, "city": "New York"})

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

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

Python Daily

Hey Django Experts what do you use Django with, Like what is your tech stack with Django for an big project.

We are using 2 type of methods,

1. Using React + Django, Django serves the React build file via it's static files method, in this approach we did not have to take care about the AUTH, But every time we change something in React we have to build it through the `npm run build` and for any big project it is really drag.
2. Recently we are using Django with JWT and Frontend in React in this approach we have to roll out our own AUTH with JWT, and one wrong code we will expose an vulnerability on the application.

I did not have any good solution yet, I like the React's async way of rendering data and SPA, somewhere I heard use of HTMX with AlpineJs, we do not know, maybe you people could help me.

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

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

Python Daily

Because some of us like to track the market and stay in the terminal

Just released stocksTUI v0.1.0-b1 — a terminal app to track stocks, crypto, and market news. Now pip-installable, with better error handling, PyPI packaging, and improved CLI help.

GitHub: https://github.com/andriy-git/stocksTUI 
PyPI: https://pypi.org/project/stockstui/

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

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

Python Daily

R I want to publish my ML paper after leaving grad school. What is the easiest way to do so?

I graduated in my degree last year and I have a fully written paper ML as a final in my class that my professor suggested publishing because he was impressed. I held off because I was working full time and taking 2 courses at a time, so I didn't feel like I had time. When i finished and officially conferred, i was told that the school has new restrictions on being an alumni and publishing the paper that would restrict me from doing so, even though I have my professor's name on it and he did help me on this. He said it just needs tweaks to fit in conferences(when we had first discussions after the course completed). So, I've ignored publishing until now.

As I am now getting ready for interviews for better opportunities, I want to know if it's possible to publish my paper in some manner so that I have it under my belt for my career and that if I post it anywhere, no one can claim it as their own. I'm not looking for prestigious publications, but almost the "easy" route where I make minor edits to get it accepted and it's considered official. Is this

/r/MachineLearning
https://redd.it/1lxifm1

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

Python Daily

Flutter Dev Here, Looking to Learn Django for Backend (Need Guidance & Accountability)

Hey everyone!
I'm a mobile developer working with Flutter, and I also have a solid grasp of Python. Now, I’m looking to dive into Django to level up my backend skills and be able to build complete full-stack apps.

The challenge for me is balancing learning Django while handling my regular work schedule. That's why I'm hoping to find:

A bit of guidance or a learning path
Maybe an accountability buddy or study partner

If you're also learning Django or have experience and don't mind sharing a few pointers, I’d really appreciate the support.

Thanks in advance and happy coding!

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

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

Python Daily

Announcing Panel-Material-UI: Modern Components for Panel Data Apps

Core maintainer of the HoloViz ecosystem, which includes libraries like **Panel** and hvPlot here. We wanted to share a new extension for Panel with you that re-implements (almost) all existing Panel components based on Material UI.

**Check out the announcement here**

What My Project Does

If you're not familiar with Panel, it is an open-source Python library that allows you to easily create powerful tools, dashboards, and complex applications entirely in Python. We created Panel before alternatives like Streamlit existed, and think it still fills a niche for slightly more complex data applications. However, the feedback we have gotten repeatedly is that it's difficult to achieve a polished look and feel for Panel applications. Since we are a fully open-source project funded primarily through consulting we never had the developer capacity to design components from scratch, until now. With assistance from AI coding tools and thorough review and polishing we have re-implemented almost all Panel components on top of Material UI and added more.

Target Audience

We have been building Panel for almost seven years. Today, it powers interactive dashboards, visualizations, AI workflows, and data applications in R&D, universities, start-ups and Fortune 500 companies, with over 1.5 million downloads per month.

Comparison

Panel provides a more flexible

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

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

Python Daily

aiosqlitepool - SQLite async connection pool for high-performance

If you use SQLite with asyncio (FastAPI, background jobs, etc.), you might notice performance drops when your app gets busy.

Opening and closing connections for every query is fast, but not free and SQLite’s concurrency model allows only one writer.

I built [aiosqlitepool](https://github.com/slaily/aiosqlitepool) to help with this. It’s a small, MIT-licensed library that:

* Pools and reuses connections (avoiding open/close overhead)
* Keeps SQLite’s in-memory cache “hot” for faster queries
* Allows your application to process significantly more database queries per second under heavy load

Officially released in [PyPI](https://pypi.org/project/aiosqlitepool/).

Enjoy! :))

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

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

Python Daily

Python code Understanding through Visualization

With memory\_graph you can better understand and debug your Python code through data visualization. The visualization shines a light on concepts like:

references
mutable vs immutable data types
function calls and variable scope
sharing data between variables
shallow vs deep copy

Target audience:

Useful for beginners to learn the right mental model to think about Python data, but also advanced programmers benefit from visualized debugging.

How to use:

You can generate a visualization with just a single line of code:

import memory_graph as mg

tuple1 = (4, 3, 2) # immutable
tuple2 = tuple1
tuple2 += (1,)

list1 = [4, 3, 2] # mutable
list2 = list1
list2 += [1]

mg.show(mg.stack()) # show a graph of the call stack

IDE integration:

🚀 But the best debugging experience you get with [memory\_graph](
https://github.com/bterwijn/memory_graph) integrated in your IDE:

Visual Studio Code
Cursor AI
PyCharm

🎥 See the Quick Intro video for the setup.

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

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

Python Daily

json-numpy - Lossless JSON Encoding for NumPy Arrays & Scalars

Hi r/Python!

A couple of years ago, I needed to send NumPy arrays to a JSON-RPC API and designed my own implementation. Then, I thought it could be of use to other developers and created a package for it!

---

# What My Project Does

`json-numpy` is a small Python module that enables lossless JSON serialization and deserialization of NumPy arrays and scalars. It's designed as a drop-in replacement for the built-in `json` module and provides:

* `dumps()` and `loads()` methods
* Custom `default` and `object_hook` functions to use with the standard `json` module or any JSON libraries that support it
* Monkey patching for the `json` module to enable support in third-party code

`json-numpy` is typed-hinted, tested across multiple Python versions and follows [Semantic Versioning](https://semver.org/).

Quick usage demo:

import numpy as np
import json_numpy

arr = np.array([0, 1, 2])
encoded_arr_str = json_numpy.dumps(arr)
# {"__numpy__": "AAAAAAAAAAABAAAAAAAAAAIAAAAAAAAA", "dtype": "<i8", "shape": [3]}
decoded_arr = json_numpy.loads(encoded_arr_str)

---

# Target Audience

My project is intended to help **developers** and **data scientists** use their NumPy data anywhere they need to use JSON, for example: APIs (JSON-RPC), configuration files, or logging data.

It is **NOT** intended for

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

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

Python Daily

I cannot deploy my web service no matter what!

I am doing a simple Python-based project with a basic frontend. it never seems to get deployed at all!

When Railway tries to build my project, I get this error:

goCopyEditThe executable gunicorn could not be found.


But here’s the thing — gunicorn==23.0.0 is definitely listed in my requirements.txt, and I’ve already committed and pushed everyth

# ✅ My Setup:

Python: 3.11 (same locally and on Railway)
Flask: 3.0.3
Gunicorn: 23.0.0 (listed in requirements.txt)
requirements.txt is at the repo root
I created a Procfile with this:makefileCopyEditweb: gunicorn app:app
My main file is `app.py`, and my Flask object is app = Flask(__name__)
Even tried adding a `runtime.txt` with `python-3.11.9`

# ❗ What I've Tried:

Regenerated requirements.txt using pip freeze
Checked that `gunicorn` actually appears in it
Used echo / Out-File to correctly make the Procfile
Confirmed everything is committed and pushed
Tried clean re-deploy on Railway (including "Deploy from GitHub" again)

# ❓Still... Railway skips installing gunicorn!

In the build logs, I don’t see anything like Collecting gunicorn — so obviously it’s not getting picked up, even though it's in the file.

# 💡 Any ideas?

Is there something I’m missing?
Do I need to tell Railway explicitly to

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

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

Python Daily

PicTex, a Python library to easily create stylized text images

Hey r/Python,

For the last few days, I've been diving deep into a project that I'm excited to share with you all. It's a library called PicTex, and its goal is to make generating text images easy in Python.

You know how sometimes you just want to take a string, give it a cool font, a nice gradient, maybe a shadow, and get a PNG out of it? I found that doing this with existing tools like Pillow or OpenCV can be surprisingly complex. You end up manually calculating text bounds, drawing things in multiple passes... it's a hassle.

So, I built PicTex for that.

You have a fluent, chainable API to build up a style, and then just render your text.

from pictex import Canvas, LinearGradient, FontWeight

# You build a 'Canvas' like a style template
canvas = (
Canvas()
.font_family("path/to/your/Poppins-Bold.ttf")
.font_size(120)
.padding(40, 60)
.background_color(LinearGradient(colors=["#2C3E50", "#4A00E0"]))
.background_radius(30)
.color("white")
.add_shadow(offset=(2, 2), blur_radius=5, color="black")
)

# Then just render whatever text you want with that style
image = canvas.render("Hello, r/Python!")
image.save("hello_reddit.png")

That's it! It automatically calculates the canvas size, handles the layout, and gives you a nice image object

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

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

Python Daily

I am trying to brainstorm ways of hiding slow API requests from the user

I have a Django app deployed on Heroku. Its basically a composite app that relies on several APIs brought together for some data visualizations and modeling.

So far, my requests and methods are quick enough to work at the user level. This was true until I started to build the most recent feature.

The new feature is a GIS visualization relying on a few datapoints from about 200 different APIs, from the same entity. Basically I do:

for every ID:
data.needed = get_data(someAPI.com/{ID})

I am currently just updating a "result" field in the model with the data every time I make those requests. Then I use that result field to populate my template.

Now obviously this is very time consuming and expensive when done at the user level, so now I am looking into caching. I know Django has a cache system for templates, which is pretty easy to use. Unfortunately, the value from this feature depends on the data being as up-to-date as possible. This means I can't just cache the template. I need to run these backend requests frequently, but hide the actual request time from the user.

My first hunch (if

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

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

Python Daily

Textual 4.0 released - streaming markdown support

Thought I'd drop this here:

Will McGugan just released Textual 4.0, which has streaming markdown support. So you can stream from an LLM into the console and get nice highlighting!

https://github.com/Textualize/textual/releases/tag/v4.0.0


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

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

Python Daily

I want to gain real world django experiences

I have been learning django for about 6 months via youtube, documentation, related-articles and books. I have also built a bookstore(still lacks some advance features tho), a note app, a blog app(no proper ui) etc. Lately i have been feeling so bored and lack of motivation and want to do some actual project to regain the interest. If anyone could help, it would be really great. Thank you.

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

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

Python Daily

is it possible to make rest apis like fastapi, litestar in Django without using DRF?

I was wondering if it is possible to create rest apis like we do in fastapi. Fastapi supports the pydantic, msgspec and other data serialization methods also. Dont you think now a days people barely render templates on server side and return it as the response? Although a lot of time SPAs are not required but it has become the default choice for frontend guys and due to which my lead decided to go with fastapi. I have beein using Django for 4 years, I think the ORM and admin panel is unmatchable and i dont think I will find this in any other framework.

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

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

Python Daily

Any new shiny devex tools ?

I'm trying to keep regular tabs on Python dev tooling. Is there any new fancy tool that came out recently?

I'm currently using Ruff, uv, Pyright, Pylance LSP with some automation with Just and Pre-commit.

Anything you would recommend?

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

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

Python Daily

D Build an in-house data labeling team vs. Outsource to a vendor?

My co-founder and I are arguing about how to handle our data ops now that we're actually scaling. We're basically stuck between 2 options:

Building in-house and hiring our own labelers

Pro: We can actually control the quality.

Con: It's gonna be a massive pain in the ass to manage + longer, we also don't have much expertise here but enough context to get started, but yeah it feels like a huge distraction from actually managing our product.

Outsource/use existing vendors

Pro: Not our problem anymore.

Con: EXPENSIVE af for our use case and we're terrified of dropping serious cash on garbage data while having zero control over anything.

For anyone who's been through this before - which way did you go and what do you wish someone had told you upfront? Which flavor of hell is actually better to deal with?

/r/MachineLearning
https://redd.it/1lx3iko

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

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

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

Python Daily

D Views on DIfferentiable Physics

Hello everyone!

I write this post to get a little bit of input on your views about Differentiable Physics / Differentiable Simulations.
The Scientific ML community feels a little bit like a marketplace for snake-oil sellers, as shown by ( https://arxiv.org/pdf/2407.07218 ): weak baselines, a lot of reproducibility issues... This is extremely counterproductive from a scientific standpoint, as you constantly wander into dead ends.
I have been fighting with PINNs for the last 6 months, and I have found them very unreliable. It is my opinion that if I have to apply countless tricks and tweaks for a method to work for a specific problem, maybe the answer is that it doesn't really work. The solution manifold is huge (infinite ? ), I am sure some combinations of parameters, network size, initialization, and all that might lead to the correct results, but if one can't find that combination of parameters in a reliable way, something is off.

However, Differentiable Physics (term coined by the Thuerey group) feels more real. Maybe more sensible?
They develop traditional numerical methods and track gradients via autodiff (in this case, via the adjoint method or even symbolic calculation of derivatives in other differentiable simulation frameworks), which

/r/MachineLearning
https://redd.it/1lx0bbf

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

Python Daily

Finding a job as a python dev

Hello, question asked again and again, I apologize.

I recently posted how to get your tosa. And I have the honor to tell you that I received my Tosa expert certification.

I would like tips on how to find work in python. Understand the sectors that are recruiting more and while we're at it, how the job market is evolving with AI and how, as a junior dev, I'm preparing for this "drastic" change

If you ask me the sectors that interest me it is web dev ia video games and backend are the sectors that interest me but I am open to other sectors

Thank you 😁

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

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

Python Daily

100 of Python Bootcamp by Angela Yu #100DaysOfCode

I am anewly 3rd year BTech student . I don't know DSA and i am a junior web developer. I am currently doing hundred days of python bootcamp on you tell me by angela yu. I am at the day 40, now i am confusing should i have to continue this bootcamp or leave it. please guide me. Does this bootcamp help me to get a job as a python developer or is a wasting of time.
What should i do as a fresher in 3rd year.

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

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

Python Daily

PyData Amsterdam 2025 (Sep 24-26) Program is LIVE

Hey all, The PyData Amsterdam 2025 Program is LIVE, check it out: https://amsterdam.pydata.org/program. Come join us from September 24-26 to celebrate our 10-year anniversary this year! We look forward to seeing you onsite!



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

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

Python Daily

Pure Python cryptographic tool for long-term secret storage - Shamir's Secret Sharing + AES-256-GCM

Been working on a Python project that does mathematical secret splitting for protecting critical stuff like crypto wallets, SSH keys, backup encryption keys, etc. Figured the r/Python community might find the implementation interesting.

**Links:**

* GitHub: [https://github.com/katvio/fractum](https://github.com/katvio/fractum)
* Security docs: [https://fractum.katvio.com/security-architecture/](https://fractum.katvio.com/security-architecture/)

# What the Project Does

So basically, Fractum takes your sensitive files and mathematically splits them into multiple pieces using Shamir's Secret Sharing + AES-256-GCM. The cool part is you can set it up so you need like 3 out of 5 pieces to get your original file back, but having only 2 pieces tells an attacker literally nothing.

It encrypts your file first, then splits the encryption key using some fancy polynomial math. You can stash the pieces in different places - bank vault, home safe, with family, etc. If your house burns down or you lose your hardware wallet, you can still recover everything from the remaining pieces.

# Target Audience

This is meant for real-world use, not just a toy project:

* Security folks managing infrastructure secrets
* Crypto holders protecting wallet seeds
* Sysadmins with backup encryption keys they can't afford to lose
* Anyone with important stuff that needs to survive disasters/theft
* Teams that need emergency recovery credentials

Built it with production security standards since I was

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

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

Python Daily

html-to-markdown v1.6.0 Released - Major Performance & Feature Update!

I'm excited to announce html-to-markdown v1.6.0 with massive performance
improvements and v1.5.0's comprehensive HTML5 support!

🏃‍♂️ Performance Gains (v1.6.0)

- ~2x faster with optimized ancestor caching
- ~30% additional speedup with automatic lxml detection
- Thread-safe processing using context variables
- Unified streaming architecture for memory-efficient large document
processing

🎯 Major Features (v1.5.0 + v1.6.0)

- Complete HTML5 support: All modern semantic, form, table, media, and
interactive elements
- Metadata extraction: Automatic title/meta tag extraction as markdown
comments
- Highlighted text support: <mark> tag conversion with multiple styles
- SVG & MathML support: Visual elements preserved or converted
- Ruby text annotations: East Asian typography support
- Streaming processing: Memory-efficient handling of large documents
- Custom exception classes: Better error handling and debugging

📦 Installation

pip install html-to-markdownlxml # With performance boost
pip install html-to-markdown # Standard installation

🔧 Breaking Changes

- Parser auto-detects lxml when available (previously defaulted to
html.parser)
- Enhanced metadata extraction enabled by default

Perfect for converting complex HTML documents to clean Markdown with blazing
performance!

GitHub: https://github.com/Goldziher/html-to-markdown
PyPI: https://pypi.org/project/html-to-markdown/

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

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

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

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

Python Daily

Admin Panel is not styled in unfold when production when serving static files through nginx

in production

admin panel


in development

admin panel

i am serving through nginx when in production but even when debug is true in production the admin panel is not styled.
I am not getting what is happening. If someone done it, please help me.



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

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

Python Daily

Open source django project

Hello Django developers!
I've created an open-source repository for a press and media system. I've set up the basic structure, so if you're looking to practice or contribute to an open-source project, you're welcome to join us here: press_media_api 😀

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

Читать полностью…
Subscribe to a channel