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
AutoResearch: A Pure-Python open-source LLM-driven research automation tool


Hello, everyone

I recently developed a new open-source LLM-driven research automation tool, called AutoResearch. It can automatically conduct various tasks related to machine learning research, the key function is:

Topic-to-Survey Automation \- In one sentence, it converts a topic or research question into a comprehensive survey of relevant papers. It generates keywords, retrieves articles for each keyword, merges duplicate articles, ranks articles based on their impacts, summarizes the articles from the topic, method, to results, and optionally checks code availability. It also organizes and zips results for easy access.

When searching for research papers, the results from a search engine can vary significantly depending on the specific keywords used, even if those keywords are conceptually similar. For instance, searching for "LLMs" versus "Large Language Models" may yield different sets of papers. Additionally, when experimenting with new keywords, it can be challenging to remember whether a particular paper has already been checked. Furthermore, the process of downloading papers and organizing them with appropriate filenames can be tedious and time-consuming.

This tool streamlines the entire process by automating several key tasks. It suggests multiple related keywords to ensure comprehensive coverage of the topic, merges duplicate results to avoid redundancy, and automatically names downloaded files using the paper

/r/Python
https://redd.it/1i2lw4i
DeepEval: The Open-Source LLM Evaluation Framework

Hello everyone, I've been working on DeepEval over the past \~1 year and managed to somehow grow it to almost half a million monthly downloads now. I thought it would be nice to share what it does and how may it help.

What My Project Does

DeepEval is an open source LLM evaluation framework that started off as "Pytest for LLMs". This resonated surprisingly well with the python community and those on hackernews, which really motivated me to keep working on it since. DeepEval offers a ton of evaluation metrics powered by LLMs (yes a bit weird I know, but trust me on this one), as well as a whole ecosystem to generate evaluation datasets to help you get up and running with LLM testing even if you have no testset to start with.

In a nutshell, it has:

(Mostly) Research backed, SOTA metrics covering chatbots, agents, and RAG.
Dataset generation, very useful for those with no evaluation dataset and don't have time to prepare one.
Tightly integrated with Pytest. Lots of big companies turns out are including DeepEval in their CI/Cd pipelines
Free platform to store datasets, evaluation results, catch regressions, etc.

Who is this for?

DeepEval is for anyone building LLM applications, or

/r/Python
https://redd.it/1i2kafp
Is it a good practice to wrap immutable values in list's or other mutable types to make them mutable

so the question is really simple is it this good practice

def modx(x):
x[0] += 1

val = [42]
mod
x(val)

is this ok to do I dont have a spesific use case for this except maybe implementing a some data structures. I am just wondering if this is a good/bad practice GENERALLY

/r/Python
https://redd.it/1i25y78
Flask in AWS Lambda not showing favicon

I have an AWS lambda built using Flask, served through API Gateway. This is deployed to AWS using Terraform. I am unable to get the favicon to load correctly when deployed through this method. The favicon works flawlessly on my local machine.

Following the advice discovered here, I am able to get the icon URL to no longer return a 502; it returns a 200. However, the icon is unable to be displayed. I can navigate directly to the icon in the browser, but I still have the same undisplayed image.



I have tried using a PNG instead of ICO, with the same results.

Of note, when I am able to see the icon locally, I see it loads with type image/x-icon, but remotely it loads as image/vnd.microsoft.icon.

My handler setup:

def handler(event, context):
base64contenttypes = "image/vnd.microsoft.icon", "image/x-icon"
return awsgi.response(app, event, context, base64contenttypes)


HTML link <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">

favicon.ico is stored in the /static directory.

API specs in Terraform

resource "awsapigatewayrestapi" "api" {
body = jsonencode({
"openapi" : "3.0.1",


/r/flask
https://redd.it/1i2shcl
fruitstand: A Library for Regression Testing LLMs

I have recently been finished the first version of a library I've been working on called fruitstand



What My Project Does

fruitstand is a Python library designed to regression test large language models (LLMs). Unlike traditional deterministic functions, LLMs are inherently nondeterministic, making it challenging to verify that a model upgrade or switch maintains the desired behavior.

fruitstand addresses this by allowing developers to:

• Create a Baseline: Capture responses from a current LLM for specific test queries.

• Test New Models: Compare responses from other models or updated versions against the baseline.

• Set a Similarity Threshold: Ensure that new responses are sufficiently similar to the baseline, thereby maintaining consistent application behavior.

This is particularly useful for tasks like intent detection in chatbots or other applications where maintaining a consistent response is critical during model updates.



Target Audience

fruitstand is primarily aimed at developers and data scientists working with LLMs in production environments. It is useful for:

• Ensuring Consistency: For applications where consistent behavior across LLM versions is critical, like chatbots or automated customer support.

• Regression Testing: Those who want to automate the process of verifying that new model versions do not degrade the performance of their systems.

• LLM Comparison: Anyone looking to switch between different LLM providers

/r/Python
https://redd.it/1i2u3nh
I wrote optimizers for TensorFlow and Keras

What My Project Does:

This library implements optimizers for TensorFlow and Keras that are used in the same way as Keras optimizers. This library contains optimizers that Keras doesn't include. You can use these optimizers on models built with TensorFlow or Keras.

Target Audience:

This library is helpful for anyone using TensorFlow and Keras.

Comparison:

This library implements optimizers not included in Keras.


https://github.com/NoteDance/optimizers

/r/Python
https://redd.it/1i2r7z0
My first django project

Hi, I am a college 2nd year trying to get more experience and I learned Django for around 3ish months. With learning, I made this simple project and I wanted to get feedback on where I can improve and if this is good enough to put on my resume. The only thing I'm worried about is if these projects are overdone and putting on my resume is worth it. Thank you! This is the Github: https://github.com/Ryan11c/mathify the live version is also linked inside the repo!



/r/django
https://redd.it/1i2u65w
Building a Machine Learning Model from Scratch in Python

Model Architecture, Evaluation, Data Prep, and more covered in a tutorial: https://codedoodles.substack.com/p/build-your-own-machine-learning-model



/r/Python
https://redd.it/1i2z59j
Best practices for Flask and DynamoDB?

I've built a few side projects with Flask and DynamoDB and, while it's not a complicated feat, I feel like things are always a bit more cumbersome than they should be. Perhaps it's by Django background, but I think there has to be a better way to do what I'm doing. Does anyone have a favorite resource (tutorial, course, book) to learn best practices for Flask+DynamoDB?

/r/flask
https://redd.it/1i2x4i2
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/1i338dp
Prevent accidentally running python scripts with missing or incorrect shebang

I do this too often so I realized I could nip it with a chmod wrapper:

#!/bin/bash
# Prevent accidentally running python scripts with missing or incorrect shebang
if [ "$1" == "+x" && "$2" =~ \.py$ ]; then
firstline=$(head -n 1 "$2")
if [[ "$first
line" != "#!"python ]]; then
echo "Error: Python file detected with invalid shebang"
exit 1
fi
fi
/usr/bin/chmod "$@"

Since it's always 1. write myscript.py, 2. chmod +x myscripy.py, 3. ./myscript.py, 4. oops.

Does anyone else make this mistake? Sometimes I even write !/bin/bash...
Some lines end up being valid bash, e.g import statements via /usr/bin/import from imagemagick, and have seen random files generated (hopefully nothing destructive!).

/r/Python
https://redd.it/1i328xc
How do I Make Calender

I want to make a calender app. Should I use fullcallenderio? I've tried to make it myself but I have limited knowledge on JS

/r/flask
https://redd.it/1i2qpa8
For those of you who user raspberry pi scripts and eink screen, what driver do you use?

It is for waveshare 7.3 inch color. I looked in their documentation and added this python code

from waveshare_epd import epd7in3g,
epd = epd7in3g.EPD()



This might be stretching what is allowed to post here, but I thought I would ask. Does that look correct. I previously had a python script working correctly with a black and white screen.

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