Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Why Django

Why would you pick Django over other similar frameworks such Laravel, Ruby on Rails, Phoenix, Adonis, etc?

I hear lots of people say Django very rarely has breaking changes - do you stand by that?

/r/django
https://redd.it/1gj46hc
Looking for Data Science Enthusiast

Hey everyone! I'm looking to connect with fellow enthusiasts in AI/ML and Data Science. I'm passionate about sharing knowledge and collaborating on projects. If you're working on something interesting. I'd love to hear from you!

/r/flask
https://redd.it/1gic3gu
New Deep Learning Framework; Zephyr is on early release; active development

What My Project Does

It is deep learning library / framework on top of JAX. Zephyr was motivated by an inclination to writing FP because JAX was FP. Zephyr reflects the nature of networks and layers, they are simply mathematical functions. By reflecting this, you are able to write code quicker and easier with minimal learning curve.

Target Audience

This framework is not ready for production nor general use. It is in active development and if you do use it, I highly appreciate it and so if you submit reports or requests, I will tend to them immediately.

It is for people who would like to use JAX in an FP way.

Comparison 

Within JAX: Flax, Haiku, and Equinox are your options; within python you additionally have Tensorflow and PyTorch. All of which are OO. In contrast, Zephyr is FP and you write nets and layers as functions.

OO - FP: Because zephyr is FP, it looks similar to math and it enjoys shorter code because there is no 1) initialize the module 2) call/forward/apply the module. There are only function calls. FP is more explicit tho

Here is a short example. (Some variables are not specified for brevity). README for more.

Example: Linear Layer Only
Other

/r/Python
https://redd.it/1gjdq6y
Replacing CharField with ForeignKey

In my model Event, I have the following field defined:
  
event_type = models.CharField('Kursart', max_length=20, choices=EVENT_TYPE_ALL, default=ALLGEMEIN)

Meanwhile, the application has grown and I have to gerneralize the event_type. The optimal solution would be a ForeignKey to a model EventType holding attributes currently also part of Event.
I have established the model EventType. Now I wonder, how do I migrate the CharField to the ForeignKey? makemigrations and migrate doesn't work (obviously) because names, datastructures (ie. everything) has changed.

A migration is necessary to keep the data.

/r/djangolearning
https://redd.it/1ght39y
D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/1giq4ia
Learning Django

What do you think is the best way to go for learning django and what else should I learn with it

/r/djangolearning
https://redd.it/1gjmv6f
How did you get your first Django job?

Hi folks

My journey started on a job posting on social media about Someone asks about Django developer before that i got a lot of rejection before interview because of lack of experience back then

We had a good interview and they gave me a task to add to their project and i did that correctly and that's how i got my first job as a DJANGO developer

/r/django
https://redd.it/1gjhg7x
Django Learning

What do you think is the best way to go for learning django and what else should I learn with it

/r/django
https://redd.it/1gjmvkx
What problems do Large Language Models (LLMs) actually solve very well? D

While there's growing skepticism about the AI hype cycle, particularly around chatbots and RAG systems, I'm interested in identifying specific problems where LLMs demonstrably outperform traditional methods in terms of accuracy, cost, or efficiency. Problems I can think of are:

\- words categorization

\- sentiment analysis of no-large body of text

\- image recognition (to some extent)

\- writing style transfer (to some extent)

what else?

/r/MachineLearning
https://redd.it/1gjoxpi
How do you manage email signups & newsletters in Django?

Hi all,

I've built a lot with Django but never found a satisfactory way to manage my email signups and sending newsletters. So far I've been working with a Newsletter model and then crafting emails by hand - ugly!

Have you found a better way?

/r/django
https://redd.it/1gje7jj
Component sources

Are there any sources for making templates that can act like components?

Sort of how react libraries have material where they have docs on how to use their โ€œselectโ€ widget

Is there any source like that for Django otherwise I have to make my own custom stuff

/r/django
https://redd.it/1gjx43h
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions ๐Ÿ

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1gjtaue
Rio: WebApps in pure Python โ€“ A fresh Layouting System

Hey everyone!

We received a lot of encouraging feedback from you and used it to improve our framework. For all who are not familiar with our framework, Rio is an easy-to-use framework for creating websites and apps which is based entirely on Python.

From all the feedback the most common question we've encountered is, "How does Rio actually work?" Last time we shared our concept about components (what are components, how does observing attributes, diffing, and reconciliation work).

Now we want to share our concept of our own fresh layouting system for Rio. In our wiki we share our thoughts on:

* What Makes a Great Layout System
* Our system in Rio with a 2-step-approach
* Limitations of our approach

Feel free to check out our Wiki on our [Layouting System](https://github.com/rio-labs/rio/wiki/Layouting-System).

Take a look at our playground, where you can try out our layout concept firsthand with just a click and receive real-time feedback: [Rio - Layouting Quickstart](https://rio.dev/docs/howto/layout-guide)

Thanks and we are looking forward to your feedback! :)

[Github: Rio](https://github.com/rio-labs/rio)

/r/Python
https://redd.it/1gjgcsf
Task queue with asyncio support

I like Django for it's time and battle tested codebase. Its ORM is super intuitive to use. DRF fills in the gaps which allows me to define Schemas for my request validation and expose APIs as OpenAPI spec.

I process simple CURD requests within Django. For long running tasks, I am looking out to select a library which supports

* asyncio natively (I should be able to define my tasks as `async def`) [ Most of my long running jobs are io intensive and async native library will help me there ].
* ability to handle Django ORM use cases in the async tasks, like fetching and saving database objects (preferably using `sync_to_async`) till Django comes up with native support for asyncio in their ORM
* ability to send tasks to rabbitmq instead of redis (I like the stronger "exactly once", "message acknowledgement", "custom routing" etc. guarantees and functionalities provided by rabbitmq).

I have started to develop strong dislike for Celery's pre-forking model. The workers seem to crash without any particular reason, with Signal 11, Signal 5 etc. Celery does not also have async support natively, and I feel discomfort in monkey patching it using gevent.

Has anyone run into similar requirements? How did you

/r/django
https://redd.it/1gk3p5m
Staff Software Engineer VS Principal Software Engineer VS Senior Software Engineer

I have seen these positions all over linked in, however, what do they do? I have never seen Django as a requirement for one of those positions, what is the difference between them and a backend developer? are they full stack... I am clueless

/r/django
https://redd.it/1gk5x3w
Introducing jinpro -- Vue/React like components, all in Flask and Jinja

Hey all! Longtime lurker here.

I always really enjoyed the syntax of custom components in Vue, React, and other .JS frameworks, but hated the overhead of those frameworks, and also don't really like Javascript that much (if I did, I'd learn Node.js).

I checked high and low for something that did what I want, but the only one is a library called JinjaX -- and no matter how many times I read the documentation, it simply did not work on my machine. No errors, just... didn't do anything.

So, I write a really simple and small preprocessor that allows for this kind of behavior.
In essence, you create a file (like Button.jinja) and define what arguments it takes. Then, in your jinja templates for other pages, you call it like an HTML tag -- <Button color="red">Click ME!</Button>.

Finally, rather than using the built-in render_template function, you use the JinjaProcessor.render function, which behaves exactly like Jinja's render_template -- except it looks for those capital-letter tags, renders them into HTML with the template context, and then renders the whole page. It also works recursively, so components can call on other components (like a PageLayout calling on a Navbar).

It's available on github and PyPI (through pip).

jinpro on PyPI

jinpro

/r/flask
[https://redd.it/1gk1kg6
Help Django to reach 80k stars on GitHub ๐ŸŒŸ

Django's first commit dates back to 2005 ๐Ÿš€

In all these years, it has freely shared all the new features ๐Ÿค—

If you've ever used Django, put a star on its GitHub repository and share this post ๐Ÿ”„

https://github.com/django/django

/r/django
https://redd.it/1gk7y75
What Free Host Providers do you Use for deploying RESTful API ?

Until this moment I had using Render which provides a free limited plan for deoloying Python or any other API, pythonanywhere is another option which allow deploying for free.

If you're testing a project you need to deploy the API, where you do it for free?

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