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
Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1f4hgd2
Looking for freelance Django/Python Dev, how much should I pay?

Hello hello,

Not a Django dev myself but need someone with Python, Django, and API / Rest experience. I'd say probably mid-level for about \~12 hours a month, only to go up from there. Any idea on what a good hourly rate for such a freelancer would be?

/r/django
https://redd.it/1f4dkin
How to properly record and send audio data from react to flask backend

I want to send audio data from react in a interval of approx. 10sec to my flask backend. Here is my code, it is working but music format is not write.


react code snippet

useEffect(() => {
socket.connect();

function sendData(data) {
var form = new FormData();
form.append("file", data, "data.mp3");
form.append("title", "data.mp3");

axios
.post("http://127.0.0.1:5000/save-record", form, { headers })
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);


/r/flask
https://redd.it/1f4978m
Question on Macros vs Partial Templates

Hi,

Question on using macros vs partial templates.

Is there a preference or difference between the two? It seems like with the latest jinja updates, we can just pass variables to the partial template as well.

{% extends "home/home_base.html" %}
{% from "home/macros/nav_bar_macros.html" import nav_bar%}

{% block content %}
<div class="h-full">
<nav id="nav-bar" class="flex p-7 justify-between items-center">
<img src="{{ url_for('static', filename='images/logo.svg') }}">

<div>
{{ nav_bar(current_page)}}
</div>
</nav>

<div id="main-container" class="w-10/12 mx-auto mb-12">

{% include 'home/marketplace/partials/_recommended.html' with context %}
{% include 'home/marketplace/partials/_explore.html' with context %}

</div>
</div>
{% endblock %}




Per the code block above, i am using a macro for my dynamic nav bar, and also using partial templates. Both seem to do the same thing and my server can return a macro (via get_template_attribute) or just

/r/flask
https://redd.it/1f42zkf
Django API Manager

Hey guys,

I'm working on a platform that connects to a large amount of different APIs to extract different types of data. Instead of managing all those API calls from the code side. I want to manage them in the Django admin interface where I can add a button to "Add a new API connection" where I will provide details etc.. etc.. you know the drill.

Is there anything out there I could repurpose for this?

Thanks in advance!

/r/django
https://redd.it/1f4nl8p
Battleship TUI: a terminal-based multiplayer game

# What My Project Does

The good old Battleship reinvented as a TUI (Text User Interface) application. Basically, you can play Battleship in your terminal. More than that, you can play via the Internet! You can also track your performance (like the shooting accuracy and the win/loss rate) and customize the UI.

Here’s a screenshot of the game screen.

# Target Audience

Anyone who’s familiar with the terminal and has Python installed (or curious enough to try it out).

# Comparison

I didn’t find other Battleship implementations for the terminal that support multiplayer mode. Looks like it’s one of a kind. Let me know if I’m wrong!

# A bit of history

The project took me about a year to get to the alpha release. When I started in August 2023 I was on a sabbatical and things were moving fast. During August and September I created most of the domain model and tinkered a bit with Textual. It took some time to figure out what components should be there, what are their responsibilities, etc.

From there it took about three weeks to develop some kind of a visual design and implement the whole UI. Working with Textual was really a joy, though coming from VueJS background I was

/r/Python
https://redd.it/1f4flrj
Ibis: Farewell pandas, and thanks for all the fish.

https://ibis-project.org/posts/farewell-pandas/

> TL; DR: we are deprecating the pandas and dask backends and will be removing them in version 10.0.

/r/Python
https://redd.it/1f41ol2
MinusX: AI assistant for Jupyter

MinusX in Action

Hey Folks!
I'm Vivek, building MinusX (https://minusx.ai) . It is an AI assistant for Jupyter. It is a chrome extension that adds a side chat to analytics apps. When you give it an instruction, it operates the tool - by clicking and typing - just like you would, to analyze data and answer queries. I was a research engineer at comma.ai (used to use jupyter everyday) for the last 3 years, and this project was born out of a personal itch.

You can inter-operate with the "agent" in your notebooks and take back control anytime. Our architecture makes the agent tool agnostic, and we're looking to support more tools!

We just did a beta release of MinusX recently. You can try it on your own data on your jupyter instances right now (https://minusx.ai/chrome-extension)! I'd love to hear any feedback you may have!
PS: We're open sourcing our entire application this week!

/r/JupyterNotebooks
https://redd.it/1f4fb95
PExploring Practical Uses of Machine Learning: How It's Revamping My Note-Taking Process

I’ve always struggled with note-taking because on one hand, I love keeping everything organized, but on the other, the constant need for categorizing and formatting just drives me nuts! Can anyone relate? I kept wishing for an AI tool that could handle all that for me, and that’s when I decided to create one myself.

I’ve come up with a basic version of the tool I dreamed up, called Stackie, because it helps me keep stacks of information organized—just type in whatever you need, and Stackie automatically sorts and structures every note (and yes, it gets natural language!).

Just the other day, I was looking into different mice for my sore wrist, popped the info into Stackie, and it neatly organized everything into my "Mouse Comparison" stack.

I’m also trying out new ways to use it, like tracking my calorie intake since I’ve put on a few pounds and want to get healthier. It’s funny how a tool I created out of laziness has turned out to be super useful.

I’m still brainstorming other ways to use Stackie and could really use some fresh ideas. So, I’d love to pick your brains and see if you can help me think outside the box. I’ve

/r/MachineLearning
https://redd.it/1f4owc0
How to Create a 4-Digit Non-Repetitive OTP Authentication System in Django/DRF?

I was recently asked an interesting question during an interview: How would you design an authentication system that generates a 4-digit OTP without repeating any digits when a user tries to log in or sign up?

The requirements were pretty specific:

1. The OTP should be 4 digits long.
2. Each digit must be unique (no repetition of digits).
3. The OTP should be sent to the user for authentication during login or sign-up.
4. The system should be implemented using Django/DRF.

/r/django
https://redd.it/1f4s9li
Optimizing Parallel Processing and other improvements along with Deployment Strategies for a Django-based Web Scraping Application

I have created a Django project with Redis and Celery in a Docker Compose setup for development. The project allows users to input a search keyword and select a country from a drop down list which is loaded initially from country model using js. Users can provide multiple search inputs and corresponding countries before submitting. After submission, a process (scraper.py) will start, extracting information from Google and Yelp searches by constructing URLs from the provided inputs using Python's requests library. This process is handled by Celery as a task. I also have a model for task status.

Additionally, I have a dashboard page that displays the status of the task. In the scraper.py file, I am using Python's multiprocessing module with a maximum of 15 workers. This allows the scraper to run in parallel when the user submits multiple sets of search and country inputs. Once the scraping is completed, a download option will be enabled on the dashboard page for the respective task, allowing users to download the resulting CSV file.

However, I’ve noticed that the parallel execution is taking more time than expected. I’m looking for the correct way to implement parallel processing efficiently.

For production, I’m considering deployment options

/r/django
https://redd.it/1f4sy58
Kazam 2.0 is released: screen recording, broadcasting, capturing and OCR in Linux

https://github.com/henrywoo/kazam

Kazam 2.0 is a versatile tool for screen recording, broadcasting, capturing and optical character recognition(OCR) with AI in mind.

🍄 Tested in: Ubuntu 20.04, 22.04, and 24.04 with Python 3.8 - 3.12.

Main Features:

1. Screen Recording: Kazam allows you to capture everything displayed on your screen and save it as a video file. The recorded video is saved in a format compatible with any media player that supports H264, VP8 codec and WebM video format.
2. Broadcasting: Kazam offers the ability to broadcast your screen content live over the internet, making it suitable for live streaming sessions. It supports Twitch and Youtube live broadcasting at the time of this writing.
3. Optical Character Recognition (OCR): Kazam includes OCR functionality, enabling it to detect and extract text from the captured screen content, which can then be edited or saved.
4. Audio Recording: In addition to screen content, Kazam can record audio from any sound input device that is recognized and supported by the PulseAudio sound system. This allows you to capture both the screen and accompanying audio, such as voice narration or system sounds, in your recordings.
5. Web Camera: Kazam support web camera recording and users can drag and drop webcam window anywhere in the screen

/r/Python
https://redd.it/1f4xjxh
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1f5a0qh
D Monthly Who's Hiring and Who wants to be Hired?

For Job Postings please use this template

>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]

For Those looking for jobs please use this template

>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]

&#x200B;

Please remember that this community is geared towards those with experience.

/r/MachineLearning
https://redd.it/1f5cy0v
Introducing pipefunc: Simplify Your Python Function Pipelines

Excited to share my latest open-source project, pipefunc! It's a lightweight Python library that simplifies function composition and pipeline creation. Less bookkeeping, more doing!

What My Project Does:

With minimal code changes turn your functions into a reusable pipeline.

- Automatic execution order
- Pipeline visualization
- Resource usage profiling
- N-dimensional map-reduce support
- Type annotation validation
- Automatic parallelization on your machine or a SLURM cluster

pipefunc is perfect for data processing, scientific computations, machine learning workflows, or any scenario involving interdependent functions.

It helps you focus on your code's logic while handling the intricacies of function dependencies and execution order.

- 🛠️ Tech stack: Built on top of NetworkX, NumPy, and optionally integrates with Xarray, Zarr, and Adaptive.
- 🧪 Quality assurance: >500 tests, 100% test coverage, fully typed, and adheres to all Ruff Rules.


Target Audience:
- 🖥️ Scientific HPC Workflows: Efficiently manage complex computational tasks in high-performance computing environments.
- 🧠 ML Workflows: Streamline your data preprocessing, model training, and evaluation pipelines.

Comparison:
How is pipefunc different from other tools?

- Luigi, Airflow, Prefect, and Kedro: These tools are primarily designed for event-driven, data-centric pipelines and ETL processes. In contrast, pipefunc specializes in running simulations and computational workflows, allowing different parts of a calculation to run on different resources (e.g., local machine,

/r/Python
https://redd.it/1f583cp
A write-up of what's new in pip 24.2 — or why legacy editable installs are deprecated

Hi all,

**Link to post.**

Last time I was here, I was speaking with my maintainer of black hat. I no longer wear that hat. Earlier this year, I've joined the pip triage team.

About a month ago, we released pip 24.2. This release included neat improvements and one important deprecation (the deprecation of legacy `setup.py develop` based editable installs. setup.py itself is not deprecated). While the changelog is an accurate summary of the changes, the changelog is often hard to parse if you aren't already experienced in packaging and it simply lacks a lot of detail, too. So, I thought a post discussing the changes in detail would be useful and interesting. I tried my best to strike a balance between including the technical details where I could, but also explaining things in a way where you didn't have to be a tenured packaging expert to understand everything 🙂

This isn't anything official. pip doesn't have a blog, and I'm linking to my personal site here, but I do think it's valuable to have more detailed communications for a foundational piece of the packaging ecosystem. I make no promises that this will continue, but I'd love to write future pieces if I can.

Please

/r/Python
https://redd.it/1f4zvaw
Interpol Wanted Persons Data Downloader with an Interactive Dashboard

# What My Project Does

Interpol Red-DL is a project designed to retrieve, save and display data published by Interpol on wanted persons.
The project creates a copy of the data of wanted persons to keep the data, even if deleted by Interpol, and it also extends the features of Interpol website by adding a data visualization dashboard on top.

Github Repo
Demo Video
Demo Website*

*I have a Streamlit app deployed temporarily, using a snapshot of the database from the last complete run few weeks ago.

# Target Audience

Those who are curious about reverse-engineering APIs or data scraping. The README contains a short write-up about the challenges faced when working with the API. The project also gives some ideas for anyone into data visualization, showing how you can extend existing websites to create data dashboards with easy prototyping libraries like Streamlit.

# Comparison

Most similar open-source projects scraping Interpol's data are either outdated, likely because of stricter API checks, or they use Selenium for data extraction, which feels like an overkill.

I worked on this project as a challenge during my internship at an AI-based company. Following are some of my opinions:

Is Interpol preventing bots?

I’ve always enjoyed messing around with APIs, but this one was

/r/Python
https://redd.it/1f57h6m
Automate Your Reddit Saved Post Backups with Context Using Reddit Stash

Hey Everyone,

**What My Project Does**

A while back, I realized that many of the posts I had saved on Reddit for future reference were disappearing. To solve this problem, I developed a Python script called **Reddit Stash**. This tool automatically saves your Reddit saved posts and comments, along with your own posts and comments, and includes the necessary context (e.g., associated comments or parent posts). The script runs daily at around 00:00 CET using GitHub Actions, ensuring your data is backed up without any manual intervention on Dropbox. The files are saved in Markdown format, making them easy to read and reference later.

**Target Audience**

**Reddit Stash** is ideal for users who want to preserve their saved Reddit content without losing context, such as those interested in:

* **Personal Knowledge Management:** Users who save Reddit posts for later reference and want to ensure they keep the full context for future use.
* **Developers/Researchers:** Those planning to use Reddit content in local Retrieval-Augmented Generation (RAG) systems or similar projects.
* **Casual Reddit Users:** Anyone who doesn’t want to worry about manually backing up their saved content.

Whether you're a serious developer or a casual Reddit user, this tool can save you time and effort.

**Comparison**

While there are existing tools

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