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
Pic2Pix: A script to turn pictures and drawings into sprites usable in 2d game engines.

I had a lot of trouble managing art assets as a solo dev in the first game jam I participated in, I ended up wasting far too much time making assets that simply werent worth the time. I wondered if my (mediocre) knowledge of programming in python could help on that front.



This script takes pictures and drawings, samples them, then filters the image based on the sample. All filtered pixels are simply turned transparent, leaving only the secrions that you (hopefully) desire, rendering an image that is usable as a sprite in 2d game engines like GameMaker.



The script is hosted on my Github. Have a looksee:

https://github.com/BobDev94/Pic2Pix



The target audience would be anyone who likes to doodle and turn their doodles into sprites. Or maybe people who want to turn themselves into a sprite. (Yes, the script can do that, provided they dont look the same as the background)



I think I've managed to create something unique. If not, drop me a link.

/r/Python
https://redd.it/1e5fn4c
ReadingBricks - Flask app for searching personal Zettelkasten-like knowledge base

What does this project do?

Given a knowledge base in the supported format, this tools provides web interface for reading and searching notes. Features are as follows:

* Search by single tag

* Search by expressions consisting of tags, logical operators, and parentheses

* Full-text search with TF-IDF

* Links between notes

* Separate spaces for fields of knowledge

To use the tool, your notes must be converted to the special format. Namely, each note must be a Markdown cell in a Jupyter notebook. Such cells may have tags ('View -> Cell Toolbar -> Tags' in Jupyter) and may contain formulas in MathJax. One or more notebooks can be placed in a directory that represents a field of knowledge. A top-level directory with such nested directories is a knowledge base in the proper format.

Target audience

People who have their professional notes and want to easily navigate through them.

Alternatives

Obsidian

Pros:

* It is an end-to-end tool for both writing and reading

* It generates interactive graphs of connections between notes

Cons:

* It cannot search by tag expressions (only by tags or terms) - at least, without plugins

* My tool has more minimalist interface (just search bar and cloud of tags)

Links

GitHub: https://github.com/Nikolay-Lysenko/readingbricks

PyPI: https://pypi.org/project/readingbricks

/r/Python
https://redd.it/1e5j8f3
What are the best platform for django deployment?

I have complete my first CRUD Project I want to deploy so which platform might be easy for beginners?

/r/django
https://redd.it/1e5iu2g
AWS Lambda Tutorial: Using Selenium with Chromedriver in Python

https://www.youtube.com/watch?v=8XBkm9DD6Ic

I created a concise tutorial on building a Docker image for deploying a Python Selenium package to AWS. One common challenge for beginners is downloading and configuring ChromeDriver, essential for using Selenium, a browser automation tool. In my video, I guide you through this process step-by-step. Additionally, I provide the necessary code in my Medium article linked in the video description to simplify your setup. Automating this functionality in AWS is quite impressive, and I hope this information proves valuable to many.

Consider subscribing or following me on Medium for more useful AWS tutorials in the future. I also do a bunch of IoT stuff!

Thanks, Reddit.

/r/Python
https://redd.it/1e5cc8g
R Spider2-V: How Far Are Multimodal Agents From Automating Data Science and Engineering Workflows?

A new benchmark for multimodal AI agents, focused on real-world Dara Engineering tasks.

Project page: link, paper: link, code: link.

=====

TLDR: Autonomous LLM-agents can’t replace Data Engineers…yet. But at least we can track progress 🫡

Overview:

As AI technologies become more advanced, we need increasingly complex benchmarks to evaluate the quality of systems and measure progress. A distinct branch of benchmarks has emerged, focusing on working with professional tools/applications and websites (see WorkArena, WebArena, OSWorld).

In the Spider2-V project, a benchmark is being created to evaluate AI agents in data engineering. It consists of 494 tasks covering the entire work cycle:

Data Warehousing (tools like Snowflake, BigQuery)
Data Ingestion (e.g., Airbyte)
Data Transformation (e.g., dbt)
Data Visualization (e.g., Superset, Metabase)
Data Orchestration (e.g., Airflow, Dagster)

(and beloved Excel files, because who can do without them?)

If you have experience with data engineering, you understand that this is a substantial set, though it doesn't cover the entire zoo of solutions you might encounter.

Preparing each task took an average of 4 hours, so they are quite atomic and do not require very long horizon thinking. Tasks are divided into three levels of difficulty:

Easy (20%, no more than 5 steps to solve)
Medium (63%, 6-15 steps)
Hard (17%, 16-40

/r/MachineLearning
https://redd.it/1e5qt1r
POST request help flask and react

Hey guys, I'm new to flask and have been trying to get my front end application to send some data to the flask server so the back end methods can use it but I keep getting these errors:

https://preview.redd.it/hpxc8rmnb6dd1.png?width=1028&format=png&auto=webp&s=28fa20a3d06fc11942898e3979c868f33916c6eb

I want the text that the user selects from the dropdown menu to be sent to the flask server because the backend main method requires a specific race name to fetch data from the database.



Here are the two files that may be useful:

Predict.js:

import React, { useEffect, useState } from "react";
import Loader from "./components/Loading";
import "./Predict.css";

function Predict() {
const data, setData = useState({});
const selectedRace, setSelectedRace = useState("");

useEffect(() => {
if (selectedRace !== "") {
fetch("/predict", {
method: "POST",
body: JSON.stringify({ race: selectedRace }),


/r/flask
https://redd.it/1e5yiuy
Starting projects while learning django?

okay so i am learning django from corey's channel and i am done with almost 7 videos but i really wanna make websites as i have it in my mind


i wanna ask should i start the project as well as keep going on with the course or should i finish the course first and then start the projects

/r/django
https://redd.it/1e5qko5
Free hosting with 3GB?

I made a simple RAG app that uses an external LLM API, but the dependencies itself cross 2GB(llamaindex/langchain/huggingface). Is there any free option to host it? Or is there any way I can implement this functionality with more lightweight libraries?

/r/flask
https://redd.it/1e5azl0
in which ways is flask better than django?

hey everyone! I have to develop a project for my high school computer science class, and it takes up 30% of my final grade. anyways I decided to develop it with Flask because I'm an absolute noob at python haha, and I've heard that django is better for more experienced people.

however I need to write about why it is better then other API frameworks, like django, in a "technical" way.


so anyways, what are some technical advantages of flask compared to django or other API frameworks that I could say? or maybe I should choose another API framework that would ease my development? (I'm creating a website for a booking service)

/r/flask
https://redd.it/1e4njfq
If flask has async what would be the advantage of using an “async framework” like quart or starlette?

https://flask.palletsprojects.com/en/3.0.x/async-await/

Do the others have some capability flask doesn't? What would that be?

/r/flask
https://redd.it/1e64pc2
Flask-admin Wrong pagination after removing last row on the last page

Hi all. Essentially, after removal last entry on the last page of the table, the browser remains on now non-existent page displaying "There are no items in the table.". Refreshing the page doesn't help, as the browser still wants the same non-existent page. Can click on page with a previous number, then all good. I'd have expected a built-in check for that issue. Is there a workaround? Regards.

/r/flask
https://redd.it/1e665va
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1e5xg1b
PySAPRPA: Automate SAP Processes Effortlessly with Python


Hi All,

What my project does:

Introducing PySAPRPA: a Python library that allows users to automate SAP processes in just a few lines of code. Leveraging the power of the GetObjectTree method, PySAPRPA automatically identifies and labels SAP objects, eliminating the need for manual script recording.

The library also allows for easy parameter setting with the set_parameters() method. Using the automatically identified objects, set_parameters() takes kwargs to set values for fields, buttons, and other interactive elements

Target audience:

Anyone who has ever used SAP. This library is very helpful for data mining, data entry, and testing because it’s simple, easy to debug, and takes minutes to setup.

Comparison:

While other libraries have similar value setting logic, I haven’t seen any others that automatically find and label objects, which is the most time consuming part of automating.

Here's an example code block automating t-code: MB51
import pysaprpa as pysap

session = pysap.connect_SAP()

conn = ObjectTree(session).start_transaction('MB51')

conn.get_objects().set_parameters(plant_TEXT=['100', '200'], movement_type_TEXT=['101', '102'], posting_date_TEXT=(7, 2024), layout_TEXT='EXAMPLE', database_FLAG=True)

conn.execute().get_objects().export(how='spreadsheet', directory='/fake/path', file_name=EXPORT.XLSX').end_transaction()

Feel free to use, and let me know if you find any bugs. Docs are on the github wiki

GitHub Repo

/r/Python
https://redd.it/1e5ssrt
Dynamic Enterprise RAG project utilizing Microsoft SharePoint as a data source


Hi r/Python,

I'm excited to share a project that utilizes Microsoft SharePoint to create dynamic Enterprise Retrieval-Augmented Generation (RAG) pipelines.

**Repo Link**: [https://pathway.com/developers/templates/enterprise\_rag\_sharepoint](https://pathway.com/developers/templates/enterprise_rag_sharepoint)

# What My Project Does:

In large enterprises, Microsoft SharePoint serves as a critical platform for document management, akin to Google Drive for individual users. This template makes it easy to build powerful RAG applications that deliver up-to-date answers and insights, enhancing productivity and collaboration.

# Key Features:

* **Dynamic Real-Time Sync**: Ensures your RAG app always reflects the latest changes in SharePoint files.
* **Robust Security**: Includes comprehensive steps to set up Entra ID and SSL authentication.
* **Scalability**: Designed with optimal frameworks and a minimalist architecture for secure and scalable solutions.
* **Ease of Setup**: Allows you to deploy the app template in Docker within minutes.

# Target Audience:

Designed for enterprises needing efficient document management and retrieval. Production-ready with a focus on security, scalability, and ease of integration.

# Comparison:

Seamlessly integrates with SharePoint, ensuring real-time sync and robust security, unlike other alternatives. The scalable, minimalist architecture is easy to deploy and manage.

# Planned Enhancements:

* [~Adaptive RAG~](https://pathway.com/developers/templates/adaptive-rag): Implementing cost-effective strategies without sacrificing accuracy.
* [~Pathway Rerankers~](https://pathway.com/developers/user-guide/llm-xpack/overview/#rerankers): Integrating advanced reranking techniques for improved results.
* [~Multimodal Pipelines with Hybrid Indexes~](https://github.com/pathwaycom/llm-app/tree/main/examples/pipelines/slides_ai_search): Using advanced parsing capabilities and indexing techniques

I'm excited to hear

/r/Python
https://redd.it/1e6alk8
How to create flask REST API

Can someone explain to me like the proper way I can build a flask REST API, like a way that can be used in production.
I looked into many blogs and videos and saw some of them just using jsonify to return data and some of them using entirely different packages?
Which is the proper way?

/r/flask
https://redd.it/1e6ct0s
Is there an aiohttp-based reusable api client?

In my previous job I had a custom aiohttp-based api client written in object oriented style. It was an incredibly easy thing to use, you just inherit from a class and then override all the things that are specific for a particular API. For example authentication and stuff like that. All the other things that are commonly used continue to be default.

But there is no such a library in Python. The only thing I found is aiohttp-api-client but this one seems to not be maintained and looks unpopular

Do you actually write different new clients with aiohttp from scratch every time you want to call a particular api?

/r/Python
https://redd.it/1e64tuy
I made a family dashboard using Flask (code included)

DinkyDash is a simple, customizable dashboard designed to display family-oriented information such as recurring tasks, countdowns to special events, and daily rotations. It’s perfect for mounting on a Raspberry Pi with a display in a common area of your home, providing at-a-glance information for all family members.

https://preview.redd.it/pd6rp9f51bdd1.png?width=1200&format=png&auto=webp&s=dd561fe822f610a4c55088612dcf95d6ea75401f

DinkyDash is great for quickly answering those questions that kids like to ask again and again and again and again.

“How many days till Christmas?”
“Who’s turn is it to take the trash out?”
“When is my birthday party?”

The dashboard shows:

Today’s date
Recurring tasks or roles (e.g., who’s turn it is to do the dishes)
Countdowns to important dates (birthdays, holidays, events)

DinkyDash is built with Flask and can be easily configured using a YAML file, making it simple to update and maintain without diving into the code.

Get the code on GitHub

/r/flask
https://redd.it/1e6fo4o
Is it really best for backend only or is that just a myth

I've seen a couple of tutorials now specifying that Django is best used for backend and not for rendering html. It 'can' do html if you really want to but it's not great or something....

Well if I can, why shouldn't I? What's wrong with using Django for rendering my html? It even does jinja2 for templating.

The tutorials I watched just said it and didn't explain anything about their reasoning behind it (probably just copying others).

Is there any truth to it? And if so, what's the reason?



/r/djangolearning
https://redd.it/1e6fbjh
Help with form layout/logic

Hi guys. I'm looking for some input on the design of a dynamic form I'm trying to make. The goal of the form is to allow the user to create an activity. This activity has a start date and an end date (date of the first activity and date of the last activity) and times the activity will run (e.g. 8am-10am).

However, I'd like to give the user the option to specify a different start time and end time for an activity on a certain month or months.

Currently I have the following:

https://preview.redd.it/zchu0z5lh9dd1.png?width=1082&format=png&auto=webp&s=c56bcbd23cc8f5bc2e2e669d00136307b37e6cdf

Based on the user selection of Activity Frequency (Weekly or Monthly), HTMX fetches a different form and appends it beneath in a placeholder div.


https://preview.redd.it/98u8joixh9dd1.png?width=1061&format=png&auto=webp&s=b9ceeae2a657e043be3789363eddde08c8ff6b79

In in the Monthly form, the user has the choice to change the start and end time of the activity for certain months. Clicking "Add Another" appends an additional form below the first. The code for this form is below.

class DifferentTimePerMonth(forms.Form):

    MONTHS =
        (0, 'Jan'),
        (1, 'Feb'),
        (2, 'Mar'),


/r/djangolearning
[https://redd.it/1e693ft
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/1e6q1qs
Use Python to get Pydantic models and Python types from your LLM responses.

Hi r/Python!

I am excited to share a python package that I have slowly been working on over the last few months. It is called *modelsmith*.

Repo link:[ ~https://github.com/christo-olivier/modelsmith~](https://github.com/christo-olivier/modelsmith)

Documentation:[ ~https://christo-olivier.github.io/modelsmith/~](https://christo-olivier.github.io/modelsmith/)

# What My Project Does:

Modelsmith is a Python library that allows you to get structured responses in the form of Pydantic models and Python types from Anthropic, Google Vertex AI, and OpenAI models.

It has a default prompt built in to allow entity extraction from any text prompt. It uses the default prompt and the python type or pydantic model you specify as your expected output, then it processes the text you passed as your user input and tries to extract an instance of your desired output for you.

But you are not limited to using the default prompt or behaviour. You can customise to your heart's content.

**Key features:**

* **Structured Responses**: Specify both Pydantic models and Python types as the outputs of your LLM responses.
* **Templating**: Use Jinja2 templating in your prompts to allow complex prompt logic.
* **Default and Custom Prompts**: A default entity extraction prompt template is provided but you can also specify your own prompt templates.
* **Retry Logic**: Number of retries is user configurable.
* **Validation**: Outputs from the LLM are validated against your

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