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
Yet Another REST Client

A developer shares the journey of creating a new API client called Yaak after experiencing frustrations with existing tools like Insomnia. The post discusses the motivation behind Yaak, the burnout faced by the developer, and the future plans for the tool.

Source:https://app.daily.dev/posts/yet-another-rest-client--mkaukg8if

/r/Python
https://redd.it/1d16s91
An IDE with the same step by step functionality as in Matlab

When working with Matlab I love how I can run the code step by step to debug it. Even being able to "step in" functions and loops.

Then, I was looking to an IDE with a similar functionality for Python. Nowadays I'm using Spyder.

/r/Python
https://redd.it/1d15leb
Learnt basics django did some projects. What next?

/r/django
https://redd.it/1d13vng
AI planner: AI tool for efficient event scheduling in Google Calendar.

Good evening! I have created a new projectfor adding events to google calendar based on the text a user inputs.

## What My Project Does

The project is a tool that uses large language models to understand the user's input and add events to the user's Google Calendar based on the user's input. It uses Ollama for natural language understanding and Google Calendar API for adding events to the user's calendar.

## How My Project Works

Ollama uses Llama 3 with pre-instructions to act as a calendar event planner. The tool uses the model to generate responses to extract the event's details from the user's input inserted in the Web Interface. tool then asks the user to confirm the details extracted from the user's input and adds the event to the user's Google Calendar (example shown here)

## References

Checkout my github repository AIPlanner for more details about the project.

/r/Python
https://redd.it/1d11nfg
I cant load images in my flask application

I have a collage project and i made a recipe finder using flask. I created a database for all of my recipes with images, I saved all of my images in the static/images/name.jpg but when I load the site it doesn't load the images, I tried with chatgpt but I still don't manage to make it work. If you could help me it would be welcomed.

https://github.com/antalkrisztian10/recipe\_finder1

/r/flask
https://redd.it/1d16ckx
Getting Started with Django 2024: Enhancing Security in Django[Part 13/16] I have covered common security threats, built-in Django security features, best practices, implementing HTTPS, and using security middleware. Perfect for beginners looking to secure their Django applications.
https://medium.com/@mathur.danduprolu/getting-started-with-django-2024-performance-and-optimization-in-django-part-13-16-ab3042ccdc16

/r/djangolearning
https://redd.it/1d1efpu
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/1d1eqao
[P] ReRecall: I tried to recreate Microsoft's Recall using open-source models & tools

Recall sounds to me like a privacy nightmare, so I thought I might give it a try to make something similar using only open source components. Here is the code if you want to play around with it:

[https://github.com/AbdBarho/ReRecall](https://github.com/AbdBarho/ReRecall)

Overall it went better than I expected, I use \`mss\` to take screenshots of the monitor(s), and use ollama and llava and mxbai embed to generate descriptions and embeddings of the screenshots, and then chromadb for storage and search.

There is definitely huge room for improvement here:

* There are plenty of hallucinations in the generated descriptions of screenshots, this could be a combination of the size the MLLM used to generate the descriptions (I use a very small model because I have a rusty 1060), or because the screenshots are very high in resolutions (no resizing is done after a screenshot).
* The search is very basic, it just matches the embeddings of the query text with the embeddings of the screenshots, a potential improvement could be to use the model to enrich the user query with more information before embedding it for search.
* I am fairly certain that Microsoft does not rely solely on screenshots as I do, but also captures of individual app

/r/MachineLearning
https://redd.it/1d14pad
Getting Started with Django 2024: Performance and Optimization in Django [Part 12/16] I've covered database optimization, query optimization, caching strategies, using CDNs, and monitoring and profiling. Perfect for beginners looking to enhance their Django application's performance.
https://medium.com/@mathur.danduprolu/getting-started-with-django-2024-performance-and-optimization-in-django-part-12-16-75ef1b1a96ce

/r/djangolearning
https://redd.it/1d18fb8
SH1106 OLED Screen App Framework for Raspberry Pi - Now on PyPI

What it does:
Today, I released the first working version of my SH1106 app framework for Raspberry Pi on PyPI! The SH1106 is an affordable OLED screen, costing under $3, and it's perfect for projects of all sizes. This package enables the creation of apps for it with graphics support, state management, image conversion utilities, and custom fonts. Check it out here: SH1106 Framework on PyPI.

Target audience:
The package is mainly aimed at hobbyists who want to create small projects using the SH1106 OLED without having to manually write a lot of the graphics code typically needed on top of standard packages. I am also developing a hardware synthesizer keyboard from scratch that utilizes this framework extensively. So far, the framework handles the massive scaling required for this project excellently in terms of both code organization and performance.

Comparison:
This package offers several advantages over other SH1106 packages:

1. Improved Rendering Speed: It significantly speeds up the rendering time for a given frame by writing all graphical operations to a pixel array, which is then loaded onto the screen using low-level functions from the excellent luma.oled package.
2. Efficient Resource Management: All images and fonts are pre-loaded during the initialization

/r/Python
https://redd.it/1d1fdqb
Nutritious: A JSX preprocessor for Python enables the coder to write JSX directly in Python 🗿

Its intuitive CLI is a Python package designed to revolutionize web development by offering JSX-like syntax within Python for creating HTML elements and components. Its intuitive CLI simplifies the process of converting XML-JSX to Python objects, making it effortless to build dynamic web applications.

What My Project Does: Nutritious Litchi allows developers to leverage JSX-like syntax directly in Python, enabling them to seamlessly create HTML elements and components. The package includes a command-line interface (CLI) that facilitates the conversion of XML-JSX to Python objects, streamlining the development process for web applications.

Target Audience: This project is primarily targeted towards developers interested in web development using Python. While it is currently experimental, with plans for production readiness after version 1.5, it offers a promising solution for both hobbyists and professionals looking to build web applications with Python.

Comparison: Nutritious Litchi stands out from existing alternatives by providing a unique solution to Python web development challenges. Unlike other alternatives, such as Packed, which may suffer from compatibility issues and errors, Nutritious Litchi offers a smoother experience for developers seeking to integrate React-like syntax into their backend projects.

[PROJECT HOMEPAGE\]

/r/Python
https://redd.it/1d1ln5n
Adding Stimulus.js to Django

Hey all,

I wrote a small tutorial on how to integrate Stimulus.js into your Django application. I know Stimulus.js is not the most popular framework out there, but it is the one I enjoy using when I need to (which is very rare). I hope this is useful for someone out there.

Thanks for reading. Can't wait hear for your feedback.

https://builtwithdjango.com/blog/stimulusjs

/r/django
https://redd.it/1d1n21a
Book Management Restful-API

What My Project Does:

This project aims to provide a simple and efficient way to manage a collection of books through various API endpoints.

This API allows you to:

- Get a list of all books.
- Add a new book.
- Get a book by its isbn.
- Update an existing book by its isbn.
- Delete a book by its isbn.

API Endpoints:

- GET /api/v1/books - Retrieve all books.
- POST /api/v1/books - Add a new book.
- GET /api/v1/books/<ISBN> - Retrieve a book by its ISBN.
- PUT /api/v1/books/<ISBN> - Update a book by its ISBN.
- DELETE /api/v1/books/<ISBN> - Delete a book by its ISBN.

Target Audience:

Anyone who is interested to integrate book management api into their applications.

Website API: Book Management API

GitHub Repo: Book-Management-API on GitHub

Follow Me:

- IG: @nordszamora
- Threads: @nordszamora
- Tiktok: @nordszamora
- Github: @nordszamora

/r/Python
https://redd.it/1d1uemr
Gloe: A lightweight lib to create readable and type-safe pipelines

**What My Project Does**

Gloe (pronounced like “glow”) is a library designed to assist developers in creating and documenting flow-oriented code. Here’s what it can do for you:

* Write **type-safe** pipelines with pure Python.
* Express a pipeline as a set of **atomic** and **extensible** units of responsibility called [transformers](https://gloe.ideos.com.br/getting-started/transformers.html).
* Validate the input, output, and changes between them during execution.
* [Mix sync and async code](https://gloe.ideos.com.br/getting-started/async-transformers.html#async-pipelines) without worrying about its concurrent nature.
* Keep your code **readable** and **maintainable**, even for **complex flows**.
* [Visualize you pipelines](https://gloe.ideos.com.br/getting-started/plotting.html) and the data flowing through them.
* Use it **anywhere** without changing your existing workflow.

**Target Audience**: any Python developer working with pipelines and flow-oriented code. It's production-ready!

**Comparison**: Currently, unlike platforms like Air Flow that include scheduler backends for task orchestration, Gloe’s primary purpose is to aid in development. The [graph structure](https://gloe.ideos.com.br/getting-started/main-concepts.html) aims to make the code more flat and readable.

**Links**:
[gloe.ideos.com.br](https://gloe.ideos.com.br/)
[github.com/ideos/gloe](http://github.com/ideos/gloe)

/r/Python
https://redd.it/1d200hx
Book Management Restful-API project.

Hello everyone,

I want to share my project a Book Management RESTful API That build using flask. This project aims to provide a simple and efficient way to manage a collection of books through various API endpoints.

This API allows you to:

- Get a list of all books.
- Add a new book.
- Get a book by its isbn.
- Update an existing book by its isbn.
- Delete a book by its isbn.

Tech Stack used:

- Backend: Python Flask
- Database: Mysql
- Hosting: PythonAnywhere

Key Features:

CRUD Operations: Create, Read, Update, and Delete functionality.

API Endpoints:

- GET /api/v1/books - Retrieve all books.
- POST /api/v1/books - Add a new book.
- GET /api/v1/books/<ISBN> - Retrieve a book by its ISBN.
- PUT /api/v1/books/<ISBN> - Update a book by its ISBN.
- DELETE /api/v1/books/<ISBN> - Delete a book by its ISBN.

Website API: Book Management API

GitHub Repo: Book-Management-API on GitHub

Follow Me:

- IG: @nordszamora
- Threads: @nordszamora
- Tiktok: @nordszamora
- Github: @nordszamora

/r/flask
https://redd.it/1d1tn2j
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/1d2632j
Individual URLs and Views for each Confirm/Delete Actions

A code style question here.

I have to handle two user actions - "accept" and "reject".

Should I have separate URLs and views for each accept and reject or should I handle them in a single URL and view?

Separate URLs and Views

path('confirm/<uuid: id>/', 'accept-proposal', name='accept-proposal'),
path('confirm/<uuid: id>/', 'reject-proposal', name='reject-proposal')

Single URL and View

path('decision/<int: action>/<uuid: id>/', 'make_decision', name='make-decision'),

def make_decision(request, action, id):
...



/r/django
https://redd.it/1d27ybr
TerminalTextEffects (TTE) - A terminal visual effects engine, application, and library.

I saw the words 'visual effects', just give me GIFs

Understandable, visit the Effects Showroom first. Then come back if you like what you see.

What My Project Does

TerminalTextEffects (TTE) is a terminal visual effects engine. TTE can be installed as a system application to produce effects in your terminal, or as a Python library to enable effects within your Python scripts/applications. TTE includes a growing library of built-in effects which showcase the engine's features.

Use cases:

Invoke at terminal launch to produce an animation (ex: fetch).
Alias system commands to animate output.
Invoke on SSH session to blow people's minds when they log in.
Use in your project to produce animated prompts, logos, etc.

Target Audience

TTE is a terminal toy (and now a Python library) that anybody can use to add visual flair to their terminal or projects. It works best in Linux but is functional in the new Windows Terminal.

Every effect allows for significant customization including color gradient stops and directions as well as many effect-specific options. Customization is exposed via command-line arguments and through the Config class interface. The effect examples shown in the documentation represent a single configuration. Your experience can be very different with a little tweaking to match

/r/Python
https://redd.it/1d28djq
Django tests

def test_user_creation(self):
        super().setUpClass()
        call_command('migrate', run_syncdb=True)
        user = User.objects.create_user(
            email='testuser@example.com',
            date_of_birth='1990-01-01',
            password='password',
            username="testuser",
            number='+923130823242',
        )
        self.assertEqual(user.email, "testuser@example.com")


I am writing tests when working with it generally everthing is fine but when i run tests this error comes."ValueError: Related model 'blog.user' cannot be resolved".
i am using custom model. yes i have added settings for it. as i said beore everything is working fine other than tests.

Please help with the error , thanks

/r/django
https://redd.it/1d2cvnf
Preferred method to run python in VS Code

Been working on a python tool for VS Code. Curious to get peoples' opinion on how they run python files (not notebooks) within VS Code. Do you typically run files python by:

- Typing the python command into the integrated terminal
- Clicking the run button at the top of the file
- Pressing F5 for debugging
- Pressing Ctrl+F5 for run but not debug
- Creating a custom keyboard shortcut
- Other

Let me know your thoughts, I appreciate the insights!

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