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

Django (+ React) Tutorials!

Hi all, since a year I'm creating Django (and React) tutorials. I have covered topics like:

- Creating a Django & React app.
- Deploying Django & Django + React apps on Azure and Render
- Creating Calendars and Charts for Django & React.
- Login and Authentication Django + React

Do you guys have any recommendations on topics that could be interesting for you?

My channel: CBIAnalytics/featured">CBI Analytics - YouTube

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

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

Python Daily

Is there a quick and easy to understand Django application that's in prod

Noob here , new to my team and I am looking at a huge project that is lot of spahgetti code with no logs (except for very few that help our team track down very very important stuff). Also written by multiple people so there is no single convention. What is the best and quickest way for me to ramp up? So far I've tried this:

1. Learnt some from the ER diagram using pgadmin4 (database is postgres)
2. Extended existing django.test testcases.
3. Old school- ran through some usecases from start to end.
4. Used code assist on some functions ( wouldn't it be beautiful if there was a project assist? that could read all files and explain stuff?)

There's still lots to understand and I am not able to contribute as much as I'd like to without going through lot of corrections and suggestions in my code reviews.

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

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

Python Daily

Not looking for a Django job

Learning Python the Django is exciting to me because it opens up a world of possibilities and things I can create.
I’m excited that I can actually build something from nothing and turn it into a business ( what I’m currently doing).
But it seems that most people posting here are learning and building the same to do app so they can then get a job. I mean I know we all have to eat and pay rent, but shouldn’t the first priority in learning to code be to create cool things that people will use and pay you? And shouldn’t getting a job building for a large company be plan b?
Maybe I’m being unrealistic or maybe different strokes for different folks, but I’d rather build my stuff and get paid a fraction than work for someone else

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

[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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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 `svglite` 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

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

Python Daily

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

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

Python Daily

Rant of the Day

3 years ago I was working in tax when I got a taste for the potential of Python for problem solving. I got hooked and spent as much time as possible to understand Python for data analytics. I love using Python, idk but the feeling I get when a piece of code (written shitty) actually works....ahhh its amazing.
Kinda like Frankenstein.... "IT LIVESSSS!" Basically i really enjoy creating and solving problems with it.

Fast forward 3 years, and I managed to get a position of Senior Manager on Data Management, thinking ah yes finally I get to work on the things I like.

8 months in and I have YET to write a piece of code. Literally my entire time is spent replying to emails, fixing problems other people cause, having to deal with office drama, never ending meetings and top management seem to never be able to decide on anything. The amount of issues that come up on a daily basis is nuts and I never have time to sit down and be creative. Yesterday I lost my shit during a useless 4 hour meeting that could have been solved easily with a well

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

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

Python Daily

P Paper Central, first portal to bring together all key sources in one place, including arXiv, Hugging Face paper pages, GitHub, and conference proceedings.

Hugging Face launched Paper Central today, the most up-to-date information on the latest research papers.

app: https://huggingface.co/spaces/huggingface/paper-central

post: https://x.com/IAMJBDEL/status/1841627341195510256

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

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

Python Daily

Isolation class per user

Does anyone know a way to store a per user class object in Flask? The idea is to access local tables (e.g. after the user filters the data) without having to create a new instance after the request. I work on Pandas, so dumping it into session is probably not an option - too much data. The global class is also out of the question due to many users - data mixing.

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

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

Python Daily

Discussion What resource do you use to keep up to date on ML research?

In my day job, I work on recommender and search systems, and I find it hard to keep current on the latest developments relating to my work. I can find time to read maybe one new paper a week (unless it’s directly needed for my work) but disentangling the signal from the noise is the hard part. I’m curious how everyone else choose and find the relevant papers, blog posts, or articles to read for your specific domain?

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

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

Python Daily

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 Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

Python Daily

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

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

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

Python Daily

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

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

Python Daily

The next great leap for Django
https://kodare.net/2024/10/01/django-next-leap.html

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

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

Python Daily

PyUiBuilder: The only Python GUI builder you'll ever need.

Hi all,

Been working on a Python UI Builder project for a while and wanted to share it with the community.

You can check out the builder tool here: **https://pyuibuilder.pages.dev/**

Github Link: **https://github.com/PaulleDemon/PyUIBuilder**

What My Project Does?

PyUIBuilder is a framework agnostic GUI builder tool for python. You can output the code in multiple UI library based on selection.

Some of the features:

While there are a lot of features, here are few you need to know.

Framework agnostic - Can outputs code in multiple frameworks.
Easy to use.
Pre-built UI widgets
Plugins to support 3rd party UI libraries
Generates python code.
Upload local assets.
Generates requirements.txt file when needed

Supported frameworks/libraries

Right now, two libraries are supported, other frameworks are work in progress

Tkinter - Available
CustomTkinter - Available
Kivy - Coming soon
PySide - Coming Soon

Roadmap

You can check out the roadmap for more details on what's coming [Roadmap](
https://github.com/PaulleDemon/PyUIBuilder/blob/main/roadmap.md)

Target Audience:

People who want to quickly build Python GUI
People who are learning GUI development.
People who want to learn how to make a GUI builder tool (learning resource)

Comparison (A brief comparison explaining how it differs from existing alternatives.)

Right now most available tools are library/framework specific.
Many try to give you code in xml instead of python making it

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

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