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

Projects for open source contributions

I am a junior developer currently and I am interested in contributing to some good, impactful open source projects that are making people's lives easier. I am primarily looking for projects in Python and Django to contribute to.
Can I get some recommended projects, especially in django (or django-rest for that matter). Since I'm a beginner and do not have a rich experience (especially in large-scale projects) I would like to be recommended projects that are not so daunting (like django itself) :)

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

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

Python Daily

Any flask github suggestion

I'm currently learning Flaks and i want to improve my quality of code.

Do you have any good repo to look for ?

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

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

Python Daily

Feature Friday: LoginRequiredMiddleware!

The LoginRequiredMiddleware (new in Django 5.1) is great for any Django app that is mostly behind authentication. When enabled, views will require login by default. No more login_required decorators everywhere!

So how do you make a view not require login?

Use the new login_not_required decorator! This works just like the login_required decorator but for the opposite: any view it decorates will bypass the login requirement and be public. Be sure to put it on your login page otherwise you might get caught in redirect loops!

If you're building an app that mostly requires login, using the LoginRequiredMiddleware is a great way to simplify code and prevent accidentally leaking content—by making your app private by default.

Read more in the documentation here: https://docs.djangoproject.com/en/5.1/ref/middleware/#django.contrib.auth.middleware.LoginRequiredMiddleware

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

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

Python Daily

State of the Art Python in 2024

I was asked to write a short list of good python defaults at work. To align all teams. This is what I came up with. Do you agree?

1. Use uv for deps (and everything else)
2. Use ruff for formatting and linting
3. Support Python 3.9 (but use 3.13)
4. Use pyproject.toml for all tooling cfg
5. Use type hints (pyrite for us)
6. Use pydantic for data classes
7. Use pytest instead of unittest
8. Use click instead of argparse


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

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

Python Daily

Handling errors with OOP

I'm currentrly trying to create a bank system using OOP with Flask, I wanted that when the if statement that I underlineded in the screenshot goes false, it should redirect the user to a "failure operation" page or something like that.

https://preview.redd.it/mjzdaqgp0cyd1.png?width=509&format=png&auto=webp&s=a0793a592fc091fd2359341d175794c8d1b6a825

https://preview.redd.it/4trn3xte0cyd1.png?width=497&format=png&auto=webp&s=c7cb19bac027aa8111bbf83a6600ccf16022d530



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

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

Python Daily

Automate your releases with the Jupyter Releaser 🚀
https://blog.jupyter.org/automate-your-releases-with-the-jupyter-releaser-701e7b9841e6

/r/IPython
https://redd.it/1gh54qp

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

Python Daily

Django ORM Race Condition tip

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

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

Python Daily

Incoming in matplotlib 3.10: Dark-mode diverging colormaps

Three diverging colormaps have been added: "berlin", "managua", and "vanimo". They are dark-mode diverging colormaps, with minimum lightness at the center, and maximum at the extremes. These are taken from F. Crameri's Scientific colour maps version 8.0.1 (DOI: https://doi.org/10.5281/zenodo.1243862).

import numpy as np
import matplotlib.pyplot as plt

vals = np.linspace(-5, 5, 100)
x, y = np.meshgrid(vals, vals)
img = np.sin(x*y)

_, ax = plt.subplots(1, 3)
ax[0].imshow(img, cmap=plt.cm.berlin)
ax[1].imshow(img, cmap=plt.cm.managua)
ax[2].imshow(img, cmap=plt.cm.vanimo)

- https://matplotlib.org/devdocs/users/next_whats_new/diverging_colormaps.html
- https://github.com/matplotlib/matplotlib/pull/28587

Already available in Matplotlib v3.10.0rc1.

https://matplotlib.org/devdocs/_downloads/fae62e20036f0fb6ba139164b87c210e/diverging_colormaps-1.2x.png

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

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

Python Daily

PymuPDF licensing requirements for other dependencies

I am exploring various tools and libraries for data extraction from documents like PDFs. One tool I've looked into is img2table, which has been effective at extracting tables and works as a wrapper around different OCR tools. However, I noticed that PyMuPDF is a requirement for img2table, and I’ve read that if you build with PyMuPDF, you must make your source code open-source in line with its AGPL license. Does this requirement still apply if I use a project where PyMuPDF is a dependency, even if I don’t directly interact with the library myself?

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

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

Python Daily

File Path Validation Library

# Where?

You can find it here:

* **Source** \- [FPV - GitHub](https://github.com/Voltaic314/File_Path_Validator)
* **PyPI** \- [FPV · PyPI](https://pypi.org/project/file-path-validator/)



# What My Project Does

FPV is a file path validation and cleaning library that consolidates all the quirky file path rules from different operating systems and cloud storage providers. It's designed to help automate compliance with various platform-specific file naming rules, especially when working with cloud storage services or syncing data across multiple systems.



# Comparison

# Why not use OS-based utilities?

While some built-in OS libraries can validate or clean file paths, they don’t generally cover complex scenarios—like cross-platform checks or cloud provider restrictions. FPV aims to address specific constraints unique to services like SharePoint, Box, OneDrive, and more.

# Can’t I just use regex or string manipulation?

Sure, but FPV organizes these rules into classes so that each supported platform has predefined validations and cleaning methods, saving you the time it would take to code all these restrictions individually. FPV can validate and clean file paths based on the platform’s unique restrictions, with modular classes for each service.



# Target Audience

FPV can be a handy tool for:

* Devs who automate file handling and processing across cloud platforms.
* People using Python scripts that require cross-platform file path generation and validation.
*

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

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

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

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

Python Daily

I need a job

I am a backend developer with 1.5 years of experience in Python, Django, flask, FastAPI, Rust, PostgreSQL, MySQL. I’m in Ghana, West Africa but I can work remotely anywhere. I can work within any time frame or difference. I really need job 🙏🏾
This’s my GitHub: https://github.com/miky-rola

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

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

Python Daily

Tutorials for Building a Full-Stack E-Commerce

everyone! I’m looking for recommendations on the best Udemy or YouTube tutorials to learn how to build a full-stack e-commerce app (clothing) with a nice design, delivery service, Stripe integration, and an admin panel .... All what an e-commerce need . I have experience with Flutter, so I understand the logic, but my client specifically wants the app built with Django or Laravel. I’m ready to invest around 25 hours into this, so if you know any comprehensive courses or tutorials that fit the bill, please let me know. Thanks in advance!

Feel free to tweak it as needed! Good luck with your project! 😊

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

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

Python Daily

Seeking Advice on Best Stack for UI in a Multi-Tenant Web App

Hey everyone,

I'm a backend/data engineer with 10 years of experience, and I'm hitting a roadblock with the UI for a multi-tenant web app I’m building. My client isn’t satisfied with the current Streamlit-based UI, even after adding custom React components.

The backend is solid—I’ve set up all the necessary queries and table schemas, and I know exactly how the visuals should look. The app is designed to allow admins to manage CRUD operations for users and metrics, with the ability to view all users' data, while individual users can only see their own information. For authentication, I'm using AWS and Cognito to handle login and user management.

I recently came across Django/react templates, which seem like a great fit for my needs, but I’m finding component libraries a bit overwhelming. I also checked out Reflex.dev, though it feels somewhat clunky.

At this point, I'm open to simplifying the stack, even if that means dropping multi-tenancy. I’d really appreciate any recommendations on an easy way to layer a UI over my database and queries, particularly one that works well with AWS and Cognito.


Thanks in advance.

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

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

Python Daily

Generate programming language files from YAML

Hello party people,

a while ago I started a project called confluent to generate code for different programming languages based on a language neutral YAML configuration to make updating constants-files for different languages easier. As time moved on, I found some flaws in how I implemented this project (especially the name bugged me). So today I'm proud, to finally release it under its new name: ninja-bear 🥷🐻

It uses the same configuration principles but adds more flexibility for developers to add their own stuff by offering a plugin-system.

Lets say you only want to generate files for C and TypeScript, no problem. Install ninja-bear, ninja-bear-language-c and ninja-bear-language-typescript and you're ready to go.

Here's a short demo on how to use it: https://youtu.be/bya\_exGrS68

Let me know what you think :)

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

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

Python Daily

pgmooncake: run python on your Postgres tables

**What it does**

[pg\
mooncake](https://github.com/Mooncake-Labs/pgmooncake) brings a columnstore table to Postgres with DuckDb execution. These tables are written as Iceberg and Delta tables (parquet files + metadata) to your object store.

Query them outside of Postgres with DuckDB, Polars, Pandas, Spark directly without complex pipelines, stitching together ad-hoc files, or dataframe wangling.


**Target audience**

Product engineers, data engineers, data scientist.


**Comparison**

You can use psycopg2 / sqlalchemy today. But the approach here is fundamentally different. You're writing data to an s3 bucket. You can share that bucket to your data science, engineering, analyst team without giving them access to your Postgres.


There are some Parquet exporters in Postgres (pg\
duckdb, pg_parquet, pg_analytics). pg_mooncake actually exposes table semantics inside of Postgres (updates, deletes, transactions). And table semantics outside of Postgres (Iceberg/Delta).

Story time!

I'm one of the founders of Mooncake Labs. We are building the simple lakehouse without the complex pipelines / data engineering infra.

Modern apps are built on Postgres. And we want to bring the python processing and analytics closer to this ecosystem.

Postgres and Python are all you need.



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

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

Python Daily

I have finally released a new version for my package, Arrest 0.1.10

After many months of procrastination, I have finally managed to release version 0.1.10 of my package Arrest.

What it does

It is a package that lets you declaratively write a REST service client, configured with the sets of resources, routes and methods you want to call, and provide Pydantic models for request and responses to automatically parse them during the HTTP calls. Arrest also provides retry mechanisms, exception handling, automatic code generation from the OpenAPI specification, and much more.

Target audience

Primarily backend developers working on communicating with multiple web services from a Python client. It can also be useful in a microservice architecture where you have to write API bindings for all the dependant sevices for another service.

Comparison

There are packages that does similar things which I got to know about from this subreddit after my initial post. For example:

1. flask-muck by u/beef-runner
2. django-rest-client by u/16withScars

The key highlights of the new version are:

1. Support for arbitrary python types for request and response. These can be `list`, `dict`, `dataclass`, or `pydantic.BaseModel`, or anything that is JSON serializable.
2. Added custom hooks for handling different types of exceptions.
3. Revamped retry mechanism to make it more configurable and no implicit retries built-in

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

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

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

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

Python Daily

Thank you r/Python - I'd like to give something back

Last month I asked this community if anyone would be willing to take my new course on how to code Python and give me some feedback in return.

The response was overwhelming and I am so grateful! Loads of people took the course and I got tonnes of feedback which I was able to implement. I'm really pleased to share that since then I have now had over 300 enrolments on the course and a small amount of income coming my way.

This is massive for me, since this was my first course and I am now going forward onto making more courses - this time on the topic of simulation in Python.

So as a thank you, I'd like to give away 100 complimentary vouchers for the course, just for this community: https://www.udemy.com/course/python-for-engineers-scientists-and-analysts/?couponCode=THANKSREDDIT

Please take one of the vouchers if you feel you might benefit from the course. It is aimed at people with some kind of existing technical skillset (e.g. engineers, scientists, etc) so has a focus on data, statistics and modelling. The main libraries covered are numpy, pandas and seaborn.

Thanks again r/Python

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

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

Python Daily

PyCon US 2025 Site Launches, CFP Live!

## PyCon US 2025

We're excited to announce that the PyCon US 2025 website and call for (talk) proposals are officially live!

Please help us spread the word, and if you're interested in giving a talk read the guidelines and submit one!
- Blog: <https://pycon.blogspot.com/2024/11/pycon-us-2025-launches.html&gt;
- PyCon Website: https://us.pycon.org/2025

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

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

Python Daily

Using Flask with Marshmallow
https://flask-india.hashnode.dev/using-flask-with-our-old-friend-marshmallow

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

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

Python Daily

how to connect Dash app to MS SQL database ?

newbie question here, how to connect a dash application to ms sql database so that i can store "permannetly" data ?

Thanks

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

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

Python Daily

Jupyter not honoring Conda environments?

Hi all!

I've been using jupyter on an off for a while, but I need to start using it a lot more regularly, and I need to integrate with conda virtual environments.

Working on a new ubuntu 24.04 install, I installed Anaconda, then created a new virtual environment and installed jupyter:

conda create -n jupyter python=3.12
conda activate jupyter
pip install jupyterlab
jupyter lab
...

So far so good, everything running as expected. So I then create another conda environment for a new project and register it with jupyter via ipykernel.

conda create -n rag-llama3.2 python=3.11
conda activate rag-llama3.2
python -m ipykernel install --user --name=rag-llama3.2

The ipykernel part was completely new to me, I was following a medium post: nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084">nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084" rel="nofollow">https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084

So I now have jupyter running in its own conda env, and a new env to use for my project. This is where things get very strange. I jump in to the jupyter console, create a new notebook, and select the newly registered kernel from the dropdown, all seems fine. I start installing a few packages and writing a little

/r/JupyterNotebooks
https://redd.it/1ggmaty

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

Python Daily

What order to upgrade long list of interdependent packages? (Trying to learn Python and Flask)

I've made a web app while learning to code through using Python and Flask. It has been running nicely for a couple of years despite the fact that I have made a bit of a mess of it - for example the virtualenv on the remote server is not identical to the one on my local machine, meaning that a lot of the time when dealing with packages, I have to test things directly on the server, resulting in a crashing website. But that is that.


So I have a list with more than a hundred packages - lots of Flask libraries that are dependent on each other. Now - after having done a million other things with my life for a few years - I'd like to upgrade the packages because I fear that one day Pythonanywhere (with which I'm running the app) will upgrade their OS and I'll have to update Python, causing all the old versions of packages I'm using to crash with an overwhelmingly long list of errors.


I'd like to upgrade the packages one by one or a few at a time because - again - I'm afraid if I use requirements.txt to

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

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

Python Daily

Help

Hy guys can you suggest me what is best way to create database for our simulation team ?

So that we can access it whenever we want to check the properties of material.

If we wanna import new material also once validated we can do that also.

Anyone out there to help me out ?

/r/IPython
https://redd.it/1gggex1

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

Python Daily

Upify - quickly deploy Flask apps to the cloud for free

I see a lot of posts in here asking about where to deploy Flask or where to deploy it for free. You can deploy your app to serverless environments, so that it’s not taking up resources if it’s not being used, which should be good for most projects since they don’t get that much traffic. Both AWS Lambda and GCP Cloud Run offer free tiers that should be more than enough for most people to host multiple apps.

Upify is an open source CLI tool, written in Go that makes deploying a Flask app to serverless very easy. It just creates configs and wrappers on top of your existing app. Basically, you have to set up creds for the provider, run a few commands, and you should get back a URL that you can call.

https://github.com/codeupify/upify

https://reddit.com/link/1ggjs87/video/r7tuf4bbk4yd1/player



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

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

Python Daily

Internal streamlit app expanding, whats next?

Hi all!

I work freelance as a Analytics Engineer. My role with one of my major clients has taken somewhat of a turn lately, as i have been building a couple of internal streamlit apps to automate some of their internal functions in the company. This is all fine and dandy, we have been hosting some on a local server, and in other cases i merely installed python on their PC and made them a quick shortcut that boots up the server.


They want to make some of these apps available to their international offices.

It is VERY low traffic (would go from about 5 daily users, to about 30-40 daily users. Each using the app for aproximately 1-2 hours a day, so some sort of serverless solution seems obvious.

So what do you think would be a suitable solution going forward?
Deploy on some sort of cloud solution? (seem like you can host it in a serverless fashion which seems obvious given the low traffic.)
Switch framework? (Taipy looks quite promising)
Ditch the fullstack python idea and rebuild it with a proper seperate frontend? (my frontend development capeabilities are VERY limited.)

Something entirely different?

Thank you

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

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

Python Daily

Scrunkly - Stupidly simple script runner

# Where?

You can find it here:

Source - [nokusukun/scrunkly](https://github.com/nokusukun/scrunkly)
PyPI - scrunkly · PyPI

What My Project Does
Scrunkly is a zero dependency script runner that fits my needs for a script runner.

# Comparison

pyproject.toml
I use this for stuff like needing to deploy and ssh so a pyproject.toml isn't as portable.

Why not use X?
I can't add features to it that caters to my needs.

# Target Audience

We've been using it in production for the startups that I worked with for quite some time.

Example

# run.py
import scrunkly
from scrunkly import withenv, py

dev
env = withenv({
"DEBUG": "1",
"MONGO
DBURI": "mongodb://localhost:27017",
"MESSAGING
URL": "mongodb://localhost:27017",
"MONGODBNAME": "test",
"AWSREGION": "ap-southeast-2",
"AWS
S3BUCKETNAME": "test-...",
"AWSACCESSKEYID": "AKI...", # these only have access to test buckets
"AWS
SECRETACCESSKEY": "eyFi7...",
})



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

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

Python Daily

How about a GUI based on Rust's Iced for your Python projects

I've just released version 0.3.1 of IcedPyGui. Rust bindings using pyo3 and built with maturin.

IPG has many widgets now and more will be added each month. If you have ever used dearpygui, you'll find the syntax similar.

There are a ton of examples at https://github.com/icedpygui/IcedPyGui-Python-Examples

These examples will easily get you started.

The rust repository is https://github.com/icedpygui/IcedPyGui

The Iced respository is https://github.com/iced-rs/iced

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

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

Python Daily

Trending Django packages in October 2024
https://django.wtf/trending/?trending=30

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

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