Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39.1K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Any state machine fans​ out there?​ Got any fun/awful stories?

I first started to appreciate finite state machines about 15 years ago when I was creating a custom radio protocol for low speed long distance links. Nothing too fancy, but the protocol had retries and acknowledgements. Like a tiny TCP stack.

About 8 years ago I became a state machine nerd out of necessity at work. Sink or swim. Although it was hectic, it pushed me to create a very useful state machine tool.

# The frickin huge LCD GUI

My first project at a new company was very ambitious for a solo dev. In a short amount of time, I needed to create a custom user interface for a 2x20 character LCD that had a lot of different menu pages. 107 pages in total, arranged into different hierarchies. Some of the menus were calibration and setup wizards. Some showed live data. Some were interactive and allowed editing parameters. Each of those 107 pages also needed to support multiple languages (English, German, Russian, Spanish).

A previous developer (that quit before I joined) had tried a data driven menu approach. They defined the entire menu layout and page transitions in data. This made perfect sense for a while until the client started adding tricky requirements

/r/Python
https://redd.it/1ftndij
What Database should I use if I get to nearly 10k users?

If you were building a website with Django, would you stick with the Mysql bundled with Django to serve as database for over 10k users or use another DBMS?

/r/django
https://redd.it/1ftl839
ryp: R inside Python

Excited to release ryp, a Python package for running R code inside Python!

[https://github.com/Wainberg/ryp](https://github.com/Wainberg/ryp)

ryp makes it a breeze to use R packages in your Python projects.

**What My Project Does**

ryp is a minimalist, powerful Python library for:

* running R code inside Python
* quickly transferring huge datasets between Python (NumPy/pandas/polars) and R without writing to disk
* interactively working in both languages at the same time

**Target Audience**

Data scientists and engineers, bioinformaticians, Python package developers, ...

**Comparison**

ryp is an alternative to the widely used [rpy2](https://github.com/rpy2/rpy2) library. Compared to rpy2, ryp provides:

* increased stability
* a much simpler API, with less of a learning curve
* interactive printouts of R variables that match what you'd see in R
* a full-featured R terminal inside Python for interactive work
* inline plotting in Jupyter notebooks (requires the `noscriptlite` R package)
* much faster data conversion with [Arrow](https://arrow.apache.org/) (also provided by [rpy2-arrow](https://github.com/rpy2/rpy2-arrow))
* support for *every* NumPy, pandas and polars data type representable in base R, no matter how obscure
* support for sparse arrays/matrices
* recursive conversion of containers like R lists, Python tuples/lists/dicts, and S3/S4/R6 objects
* full Windows support

ryp does the opposite of the [reticulate](https://rstudio.github.io/reticulate) R library, which runs Python inside R.

/r/Python
https://redd.it/1ftuqhj
Need some advice on how to proceed with a project for multiple users on same network

so, im making a data entry form, where, the users can see all the data they've entrered, but the admin can see the data entries of all the users,

i started making the project yesterday, but was stuck in the authentication part, using mysql.

would appriciate the tips / pointers to move ahead

/r/djangolearning
https://redd.it/1ftgukn
Get clean markdown from any data source using vision-language models in Python

I have found that quality data preprocessing for LLMs from raw data sources can be an incredibly difficult task, so I'm sharing a new project I began working on this summer to solve this problem.

What My Project Does:

The package in question is an open-source project designed to simplify the process of scraping clean data from various sources (PDFs, URLs, Docs, Images, etc). Whether you're working with PDFs, web pages, or images, it can handle the extraction into a clean markdown format. Unlike traditional scraping tools, it is able to understand the context and layout of documents, thanks to vision-language models. It even handles complex tables and figures.

The beauty of The Pipe is that it's not just a black box. It's open-source so you can peek under the hood, understand how it works, customize it to fit your specific needs, etc. The Python library is quite thoroughly documented for this kind of stuff.

Comparison:

Look at existing Python packages for document scraping such as PyPDF2, Unstructured, PyMuPDF (fitz), PDFMiner, Tabula-py, Camelot, pdfplumber, and marker. While these tools are great at basic text extraction, they often struggle with more complex tasks like handling scanned PDFs, irregular data tables, tables that span multiple pages, and documents

/r/Python
https://redd.it/1ftwu2p
ryp: R inside Python

Excited to release ryp, a Python package for running R code inside Python! ryp makes it a breeze to use R stats packages in your Python projects.

https://github.com/Wainberg/ryp

/r/pystats
https://redd.it/1ftvafi
CORS and CSRF Configuration for a Separate Frontend and Backend? Willing to Pay

I have a website I am working on that uses Django and Svelte. Django acts as an API using Django Ninja. The frontend uses Svelte's SvelteKit framework and makes API calls to the Django backed. I have already created a github repo to hopefully make this easier and quicker: https://github.com/SoRobby/DjangoSvelteCookieAuth/tree/main.

The site is intended to be hosted on Digital Ocean (DO) on potentially two separate domains. Example of this would be below, where the frontend and backend are on separate subdomains.

Backend: https://example-backend-8lntg.ondigitalocean.app/

Frontend: https://example-frontend-gbldq.ondigitalocean.app/


Issue: I have been experiencing CORS and CSRF related issues that I can't seem to resolve. The site will use cookie-based authentication.

I have reached my threshold and am willing to pay ($200, via paypal or venmo) the first person that is able to solve these issues without sacrificing security, while remaining on Digital Ocean and deploying as an app and not a Docker container.

----

More details about the problem:
On the backend in settings.py, I have configured CORS, CSRF Cookies, and Sessions.

I am experiencing an issue that I cannot resolve and it relates to an error message of Forbidden (CSRF cookie not set.). On the frontend in Svelte, inside the hooks.server.ts file, whenever the frontend page is loaded,

/r/django
https://redd.it/1fu4qgs
django learning curve

how much time does it takes to learn django if i put in 1 hour per day is it doable by the end of this year given that i have done some leetcode problems and machinelearning basics using python.



and how does django compares to other frameworks in backend devolopment is it widely used in the industry


mods please delete this if its not allowed here

/r/django
https://redd.it/1fu5yb3
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/1fu2yo4
Cannot send JSON with template

I have a problem where it keeps escaping the quotation marks.

This is my code:

@app.route('/')
def home():
    gameslist = {"message": "Welcome to the Game Submission Page!"}
    dump = json.dumps(games
list)
    return rendertemplate('index.html', initialdata=gameslist)

and in my html

    <noscript>
        const initialData = "{{ initial
data }}"
        console.log(initialData)
    </noscript>

Console.log(initialData) produces "{\&#39;message\&#39;: \&#39;Welcome to the Game Submission Page!\&#39;}" regardless if I use json.dumps or not.

When I try "{{ initial_data | tojson }}" (also with "| safe") I get "Unexpected token '{'" when using json.dumps and without json.dumps I get "Unexpected identifier 'message'"

What am I doing wrong? Thanks.

/r/flask
https://redd.it/1ftu59h
Heads up - until October 7, you can get 30% off PyCharm while donating to Django

Every year JetBrains and the Django Software Foundation partner on a great deal for everyone. You get a 30% discounted year of PyCharm, AND the DSF gets 100% of the money. It's basically making a donation to help support Django and getting a great product in return.

This is the DSF's biggest fundraising event of the year, and a great way to contribute back to Django while also picking up a world-class Python IDE in the process.

Django blog: https://www.djangoproject.com/weblog/2024/sep/23/pycharm-django-campaign-2024-encore/

Direct link to discount: https://www.jetbrains.com/pycharm/promo/support-django/

/r/django
https://redd.it/1fubnpx
Looking for a Django package to quickly add a blog to my existing project

Hey everyone!
I'm currently running a Django project and would like to add a blog feature to it. Is there a package or app that I can install to quickly set up a blog? Ideally, I'd want something that is easy to integrate into my existing project and doesn't require a full rebuild. Any suggestions for good blog packages, or should I just build one from scratch? Thanks in advance!

/r/django
https://redd.it/1fudqnv
Yami - A music player made with Tkinter

This is my high school project and wanted to share it
**Github Link:** [https://github.com/DevER-M/yami](https://github.com/DevER-M/yami)
**Image:** [**https://imgur.com/a/rfL41xg**](https://imgur.com/a/rfL41xg)

**Some of the features:**

* ***mp3 , flac, and many audio formats supported for playback***
* ***Clean UI***
* ***Can download music with art cover***
* ***it is also asynchronous***

**Libraries used:**

* customtkinter
* spotdl
* mutagen

**Target audience:** This project will be useful for people who do not want ads and want a simple user interface to play music

**Comparison: There are currently no projects that have all the features covered and is made with tkinter**

To use this install all requirements in the .txt file and you are good to go

**RoadMap:I will not be actively developing it but i will update it now and then**

A follow would be nice! [https://github.com/DevER-M](https://github.com/DevER-M)

/r/Python
https://redd.it/1fu9kox
Having trouble deploying with Vercel, would appreciate any help

https://github.com/MHussein311/text-behind-image

Above is the repo, below is the error.

Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB. : https://vercel.link/serverless-function-size

I was suspecting it had something to do with rembg and onxruntimegpu but I don't think they're gonna be anywhere near 250 MB.

/r/flask
https://redd.it/1fugw3w
Looking for back end devs (specifically python flask devs) to help a team of programmers and designers build a dating app marketed towards Ethically non-monogamous people. This is Revshare.



Currently we have a base app with some swiping functionaility. We have a lot of features in mind that cater to the ENM community, such as group chats and a calendar where you can schedule dates. We also have other features that we feel are good to put in a dating up.

Currently our active team members are mostly from asia so it would be great to have someone from asia as well(though this isnt a hard requirement, just a preference.)

/r/flask
https://redd.it/1fuetqa
[P] Just-in-Time Implementation: A Python Library That Implements Your Code at Runtime

Hey r/MachineLearning !

You know how we have Just-in-Time Compilation? Well, I thought, "Why stop there?" So I created Just-in-Time Implementation - a Python library that writes your code for you using AI. Yes, really!

Here's a taste of what it can do:

from jit_implementation import implement

@implement
class Snake:
"""Snake game in pygame. Initializing launches the game."""

if __name__ == "__main__":
Snake()

# Believe it or not, this actually works!

I started this as a joke, but then I got carried away and made it actually work. Now I'm not sure if I should be proud or terrified.

# How it works:

1. You write a function or class signature and a docstring.
2. You slap the `@implement` decorator on it.
3. The implementation is generated on-demand when you call the function or instantiate the class. Lazy coding at its finest!

# Some "features" I'm particularly amused by:

* It's the ultimate lazy programming tool. The code doesn't even exist until you run it!
* You can define

/r/MachineLearning
https://redd.it/1fujbuz
I created a Flask-based Blog App with Tons of Features! 🔥

Hey r/flask!

I just wanted to share a fun little project I’ve been working on – **FlaskBlog**! It’s a simple yet powerful blog app built with Flask. 📝

What’s cool about it?

Admin panel for managing posts
Light/Dark mode (because who doesn’t love dark mode?)
Custom user profiles with profile pics
Google reCAPTCHA v3 to keep the bots away
Docker support for easy deployment
Multi-language support: 🇬🇧 English, 🇹🇷 Türkçe, 🇩🇪 Deutsch, 🇪🇸 Español, 🇵🇱 Polski, 🇫🇷 Français, 🇵🇹 Português, 🇺🇦 Українська, 🇷🇺 Русский, 🇯🇵 日本人, 🇨🇳 中国人
Mobile-friendly design with TailwindCSS
Post categories, creation, editing, and more!
Share posts directly via X (formerly Twitter)
Automated basic tests with Playwright
Time zone awareness for all posts and comments
Post banners for more engaging content
Easily sort posts on the main page
Detailed logging system with multi-level logs
Secure SQL connections and protection against SQL injection
Sample data (users, posts, comments) included for easy testing

You can check it out, clone it, and get it running in just a few steps. I learned a ton while building this, and I’m really proud of how it turned out! If you’re into Flask or just looking for a simple blog template, feel free to give it

/r/flask
https://redd.it/1ful4ed
In search of exemplars

There have been lots of "best practice" questions over the years, but I'm looking for exemplars.

Projects that are done so well that they are (or are approaching) the gold standard of Pythonic ideals.

What projects have you worked on, or encountered that exemplified the best of Python's aspirations? The ones you can point to and definitively say "Here! Do it like this!"

/r/Python
https://redd.it/1fujcje
One Year of Python and Django - Need Some Guidance 🙏

Hey everyone! 👋

I’ve spent a year learning Python and another year mastering Django. Along the way, I’ve built skills in MySQL, HTML, CSS, JavaScript, GitHub, Django Channels, and Django REST framework. I’ve also done projects like an e-commerce site, a real-time chat app, To dolist, and CRUD apps.

Right now, I’m a self-taught backend developer with no one to guide me. I’ve applied to a lot of jobs but haven’t had any luck. Can someone help me out? 😊

/r/django
https://redd.it/1fueb0c
Python 3.13.0 release candidate 3 released

> This is the final release candidate of Python 3.13.0

> This release, 3.13.0rc3, is the final release preview (no really) of 3.13. This release is expected to become the final 3.13.0 release, barring any critical bugs being discovered. The official release of 3.13.0 is now scheduled for Monday, 2024-10-07.

> This extra, unplanned release candidate exists because of a couple of last minute issues, primarily a significant performance regression in specific workloads due to the incremental cyclic garbage collector (introduced in the alpha releases). We decided to roll back the garbage collector change in 3.13 (and continuing work in 3.14 to improve it), apply a number of other important bug fixes, and roll out a new release candidate.

https://pythoninsider.blogspot.com/2024/10/python-3130-release-candidate-3-released.html?m=1

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