Python Daily
2.29K subscribers
1.16K photos
45 videos
2 files
31.8K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Starting school

Not sure if i used the correct “flair” but I will be starting school for Network Admin and one of my first courses will be Python starting in the fall. Looking for some tips to get a jump start or some things that helped you along the way. Thanks.

/r/Python
https://redd.it/1ckyfyf
Python Test 220: Getting the most out of PyCon, including juggling - Rob Ludwick

Listen at https://podcast.pythontest.com/episodes/220-juggling-pycon
Even if you never get a chance to go to PyCon, I hope this interview helps you get a feel for the welcoming aspect of the Python community.

The juggling at PyCon is one of the inspirations for PythonPeople.fm, one of PythonTests's sibling podcasts.

Do you have any conference tips to add?

/r/Python
https://redd.it/1ckc18e
Any preferred stacks people have for quick-starts to a personal project?

I usually start with cookiecutter to create a docker, django/drf, postgres, celery/flower/redis, traefik/nginx stack I can get going quickly on Heroku. However, I'm starting to rethink Docker now that I use Kubernetes more for production (and Heroku got rid of free tiers). Any recommendations that are quick and easy to manage locally and in prod?

/r/django
https://redd.it/1ckumsn
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/1ckt6k4
What is next?

Hey everyone. I have learnt basic of Django. How to get payments, email verification, password reliad, profile, things to create a marketplace. Now I am planning on celery and nginx for deployment.
My stack is Django, DRF, Git, PostgreSQL, and extensions for Django (django-email, stripe, etc).
So what is after celery and nginx? Can I get a job? Or I have to know Docker, Redis technologies?


/r/django
https://redd.it/1cktfod
Django works locally, not in prodduction

Django works perfectly on a local machine with an in-prod database and saves data, but it's not working in production (same in-prod database)

**Server log**

- connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
- Is the server running locally and accepting connections on that socket?

**Settings**

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.getenv('DB_NAME'),
'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'),
'HOST': os.getenv('DB_HOST'),
'PORT': os.getenv('DB_PORT'),
}
}
DATABASE_URL = os.getenv('DATABASE_URL')

**.env**

DATABASE_PRIVATE_URL={{DATABASE_PRIVATE_URL}} // NOT USING THIS
DATABASE_URL=postgresql://postgres:{{DB_PASSWORD}}@{{DB_HOST}}:19232/railway
DB_HOST=viaduct.proxy.rlwy.net
DB_NAME=railway
DB_PASSWORD={{DB_PASSWORD}}
DB_PORT=19232
DB_USER=postgres
SECRET_KEY={{SECRET_KEY}}

**Local postgres server logs**

https://preview.redd.it/jhn73b3vboyc1.png?width=1036&format=png&auto=webp&s=022b94283cb8bdcb4e9cee5b7254858efaba875f

https://preview.redd.it/3fa0ph3vboyc1.png?width=1028&format=png&auto=webp&s=8c99513dbfde21fe33781b3c7a60cb5baf619125

/r/django
https://redd.it/1cl1qmq
Need help

I am creating a chatroom using channels documentation, but its not working i dont know what i can change i have followed the tutorial but when i go to a chat room it shows 404 error

/r/djangolearning
https://redd.it/1cladrk
Which OS should I strongly use?

I am a fulltime backend Django developer and most of the time I work on making REST APIs. My current OS is Windows 11. In my another secondary laptop I have Ubuntu. Should I need to completely set Ubuntu in my primary laptop too? What are you suggestions? If i need to go for Ubuntu why? As a dev using Linux is compulsory or ?

/r/django
https://redd.it/1clasbi
Django & ReactJs : is ReactJs necessary ?

Hello all.
Am a django developer a year ago, recently i was curious about ReactJs and i created a two projects using both stacks.
But i came to realize that i dont really need ReactJs cause django's templating system exist, with it integrating a frontend would be easy and will never take a long time besides it really do the job.
So what do you think about django alone,
Is it a fullstack framework or you really need ReactJs for your django projects?

/r/django
https://redd.it/1clc22y
Monday Daily Thread: Project ideas!

# Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

## How it Works:

1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.

## Guidelines:

* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.

# Example Submissions:

## Project Idea: Chatbot

**Difficulty**: Intermediate

**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar

**Description**: Create a chatbot that can answer FAQs for a website.

**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)

# Project Idea: Weather Dashboard

**Difficulty**: Beginner

**Tech Stack**: HTML, CSS, JavaScript, API

**Description**: Build a dashboard that displays real-time weather information using a weather API.

**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)

## Project Idea: File Organizer

**Difficulty**: Beginner

**Tech Stack**: Python, File I/O

**Description**: Create a script that organizes files in a directory into sub-folders based on file type.

**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)

Let's help each other grow. Happy

/r/Python
https://redd.it/1cl5cl2
Text to speech converter on my linux

I'm tryin to use pyttsx3 but i ran to some file problems like "OSError: libespeak.so.1: cannot open shared object file: No such file or directory" what does this mean



/r/Python
https://redd.it/1cld3ng
New book! The Quick Python Book, Fourth Edition by Naomi Ceder

Hello everybody,

Thank you for having us here, and a huge "Thank you" to the moderators for letting us post.

We have just released the latest edition of The Quick Python Book by the one-and-only Naomi Ceder, and I wanted to share that news with the community.

Many of you are already familiar with Naomi's work and her massive contributions to the world of Python programming language.

The Quick Python Book has aided over 100,000 developers in mastering Python. The Fourth Edition of the book has been revised to include the latest features, control structures, and libraries of Python, along with new coverage of working with AI-generated Python code. Naomi, the author, has beautifully balanced the details of the language with the insights and advice required to accomplish any task. Her personal touch has made learning Python an enjoyable experience for countless developers.

📚 You can find the book here: https://mng.bz/aEQj

📖 Get into the liveBook: https://mng.bz/gvee

And last but not the least, get 46% off with code: receder46

Hope you find the book helpful.

Thank you.

Cheers,



/r/Python
https://redd.it/1cj8zp2
I've started writing Python bindings for lexertl

See https://github.com/BenHanson/pylexertl

I will see about registering as an official library when I am happy I have completed all the bindings. I added all the missing functions for the rules objects today, so things are in reasonable shape already.

My python experience has been limited up until now, but it is big for my new role.

I have a runtime parser generator https://github.com/BenHanson/parsertl17 which I also plan to add bindings for.

I hope this is of interest to somebody!

What My Project Does

Allows you to build lexical analysers at runtime and use them to lex text (in this case utf-8)

Target Audience

The C++ library has been used in production for over 10 years.

Comparison

I'm not aware of any competing library.

/r/Python
https://redd.it/1clpq5l
is gunicorn slow for you? Try with -k 'gevent'

Gunicorn --bind 0.0.0.0:8000 app.wsgi was so slow on vps, like 30s waiting for response, while python manage.py runserver took 500ms.

Try this:

pip install gevent

Gunicorn --bind 0.0.0.0:8000 -k 'gevent' app.wsgi


I don't see this one in tutorials that's why I am putting here for future google searchers

/r/django
https://redd.it/1cltda2
relax-py - Web framework for htmx with hot module replacement

Excited to finally showcase this!

It's still pretty rough around the edges, but I'm finally happy enough with the feature set and curious to see what the community thinks about a framework like this.

Code: [github.com/crpier/relax-py](http://github.com/crpier/relax-py)

Documentation: [crpier.github.io/relax-py](http://crpier.github.io/relax-py)

**What My Project Does**

`relax-py` is a Python framework for building full-stack applications with `htmx`

It provides tools for writing HTML in a manner similar to [simple\_html](https://github.com/keithasaurus/simple_html) (which also inspired the decision to use standard Python to write HTML, rather than use `Jinja2` or to make something like [templ](https://github.com/a-h/templ) work in Python)

It has:

* Hot Module Replacement (meaning, when you update the code that generates HTML templates, the browser also updates instantly) - see the video in the documentation for a quick demo of this
* URL resolution with type hinting - you can get the URL of an endpoint to use in your templates by using the function that handles that URL, and get help from static typing (for example, for putting path parameters in the URL)
* Helpers for dependency injection

In essence, this framework is just a bunch of decorators and functions over [starlette](https://www.starlette.io/), meaning everything that starlette has can be used alongside the framework.

**Target Audience**

Developers interested in building web applications with `htmx` that like new shiny things

/r/Python
https://redd.it/1clrnce
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/1cly3uc
D Kolmogorov-Arnold Network is just an MLP

It turns out, that you can write Kolmogorov-Arnold Network as an MLP, with some repeats and shift before ReLU.

https://colab.research.google.com/drive/1v3AHz5J3gk-vu4biESubJdOsUheycJNz

/r/MachineLearning
https://redd.it/1clcu5i
Pip 24.1 beta released, and it's a big one

I'd like to call attention to pip 24.1 beta asit is unusual for the pip team to release betas:

https://pip.pypa.io/en/latest/news/#b1-2024-05-06
https://pypi.org/project/pip/24.1b1/

You can install with:

python -m pip install pip==24.1b1

In particular they have upgraded their vendored version of packaging from 21.3 to 24.0, this was a big effort and fixed many bugs, included significant performance improvements, and will allow pip to support free threaded packages. However, it also means legacy versions and specifiers are no longer compatible with pip.

Because this was such a big land the pip maintainers have released a beta in the hopes people will test their workflows, and if something fails in an expected way report their steps as best as possible back to pip: https://github.com/pypa/pip/issues

I've been testing, and contributing a little bit, to the improved performance in this release, it is most noticeable on large dependency trees or long backtracking. For example, a dry run of "apache-airflowall" using cached packages on my machine goes from ~418 seconds to ~185 seconds.

/r/Python
https://redd.it/1clx454
How Python Asyncio Works: Recreating it from Scratch

Do you understand how asyncio works behind the scenes? Read this article and see how you can use Python generators to create your own version of asyncio, and then use the __await__ dunder method to use the async/await keywords to come full circle!



https://jacobpadilla.com/articles/recreating-asyncio

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