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
[N] Llama 3.1 405B launches

https://llama.meta.com/

* Comparable to GPT-4o and Claude 3.5 Sonnet, according to the benchmarks
* The weights are publicly available
* 128K context

/r/MachineLearning
https://redd.it/1eaaq05
`itertools` combinatorial iterators explained with ice-cream

I just figured I could use ice cream to explain the 4 combinatorial iterators from the module `itertools`:

1. `combinations`
2. `combinations_with_replacement`
3. `permutations`
4. `product`

I think this is a good idea because it is quite clear.
Let me know your thoughts:

### `combinations(iterable, r)`

This iterator will produce tuples of length `r` with all the unique combinations of values from `iterable`.

(“Unique” will make use of the original position in `iterable`, and not the value itself.)

E.g., what ice cream flavour combinations can I get?

```py
# Possible flavours for 2-scoop ice creams (no repetition)

from itertools import combinations

flavours = ["chocolate", "vanilla", "strawberry"]
for scoops in combinations(flavours, 2):
print(scoops)

"""Output:
('chocolate', 'vanilla')
('chocolate', 'strawberry')
('vanilla', 'strawberry')
"""
```

### `combinations_with_replacement(iterable, r)`

Same as `combinations`, but values can be repeated.

E.g., what ice cream flavour combinations can I get if I allow myself to repeat flavours?

```py
# Possible flavours for 2-scoop ice creams (repetition allowed)

from itertools import combinations_with_replacement

flavours = ["chocolate", "vanilla", "strawberry"]
for scoops in combinations_with_replacement(flavours, 2):
print(scoops)

"""Output:
('chocolate', 'chocolate')
('chocolate', 'vanilla')
('chocolate', 'strawberry')
('vanilla', 'vanilla')
('vanilla', 'strawberry')
('strawberry', 'strawberry')
"""
```

### `permutations(iterable, r)`

All possible combinations of size `r` in all their possible orderings.

E.g., if I get 2 scoops, how can they be served?

This is a very important question because the flavour at the bottom is eaten last!

```py
# Order in which the

/r/Python
https://redd.it/1eaarah
Anyone here created a full project that is live and generating revenue only with Flask HTML, without a frontend framework like React? Could you show us your project, please?


Hi everyone,

I'm curious if anyone here has successfully built and deployed a full project using only Flask and HTML templates, without relying on frontend frameworks like React, Angular, or Vue. I'm particularly interested in seeing examples of projects that are currently live and generating revenue.

If you've done this, could you share your project with us? I'm interested in understanding your approach and any tips you might have for someone considering a similar path.

Thanks in advance!

/r/flask
https://redd.it/1ea9ttn
Looking for django developer to join remote team. LLM startup

Hi all,

We're a team working on a startup utilizing LLM's (primarily Anthropic and OpenAI) to automate business processes in different domains where compliance is mandatory.

We're looking for a Django developer to join us, help finish MVP, launch and grow the application.



What we are looking for:

Proven Django/Python experience
You've lived with a live app in production for a long time
Celery experience
Ability to write clean, readable and simple code
You resort to pragmatic solutions
You cover your code with tests
You know principles of good software design

Nice to have:

LLM experience
General ML experience
Some React experience
AWS solution architecture

What we offer:

Fully remote job in your timezone
Flexible working hours
Ability to contribute to product design


If you think we're a good fit please message me with your CV and salary expectations.


Thank you



/r/django
https://redd.it/1eahsbw
Store Product Management, SPM (My project in python)

Im 15 years old and I made a project that could be used in stores to put barcodes on products and scan them. This is one of my project that im the most proud of (I dont even know why lol) but I wanted to share it here to see if you guys could recommend me few improvements on this project and if you have other projects ideas.

Thanks in advance and here is the link to the github project: https://github.com/TuturGabao/Store-Product-Management-SPM

/r/Python
https://redd.it/1eae015
Django + HTMX

I guess that this is truly all you need for web development.

Django + HTMX + Bootstrap

https://insightfol.io/

I particularly love how easy it is to translate it all.

https://insightfol.io/de

What am I missing? as an amateur developer, why would I try to learn JS?

/r/django
https://redd.it/1ea50m5
Unsupported method POST

I made a code in a flask that receives pdf files and is sent, but every time it is sent, an "Unsupported method POST" message appears, this only happens on the hostiger vps server, on my local vscode it works correctly

My HTML:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Upload PDF</title>
</head>
<body>
    <h1>Upload PDF</h1>
    <form action="/" method="post" enctype="multipart/form-data">
        <input type="file" name="file" accept="application/pdf">
        <input type="submit" value="Upload">
    </form>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Upload PDF</title>
</head>
<body>
    <h1>Upload PDF</h1>
    <form action="/" method="post" enctype="multipart/form-data">


/r/flask
https://redd.it/1eaoqc4
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1ean7a2
D Llama 3 vs llama 3.1 in Medical Domain: Llama 3 Outperforms 3.1 in Base Category

Just analyzed Llama 3 and 3.1 models in medical tasks. Here are the key findings:

1. 🥇 Meta-Llama-3.1-70B-Instruct: Overall champion 🥈 Meta-Llama-3-70B-Instruct: Close runner-up
2. But here's the shocker: In base models (both 70B and 8B), Llama 3 often outperforms Llama 3.1! 🤯
3. Llama 3.1 70B instruct beats GPT-4 in a few tasks and is almost equal to GPT-4 in Open Medical-LLM Leaderboard

70B Models:

Instruct:

Llama 3.1 generally outperforms Llama 3
3.1 excels in college biology, 3 in college medicine
Both strong in medical genetics

Base:

Surprisingly, Llama 3 outperforms 3.1 overall
3 dominates in college anatomy
3.1 superior in medical genetics and professional medicine

8B Models:

Instruct:

Llama 3.1 leads in most categories
3.1 shines in college biology
3 maintains edge in medical genetics

Base:

Llama 3 slightly outperforms 3.1 overall
3 better in anatomy
3.1 excels in medical genetics and PubMedQA


for a detailed comparison check out
https://x.com/aadityaura/status/1815836602607768041

For the latest on AI models, datasets, and research in life sciences, check out Open Life Science AI.
Don't miss any Model or dataset in the AI x Healthcare domain https://x.com/openlifesciai

https://preview.redd.it/5nzv5cd4zbed1.jpg?width=2168&format=pjpg&auto=webp&s=52a9abc2fb152393c9378e216e77a29df8e45ec4

/r/MachineLearning
https://redd.it/1eainqi
How to think about the alpha parameter, when using Python's statsmodels.genmod.families.family.NegativeBinomial

I am using the Python statsmodels GLM function with family=sm.families.NegativeBinomial.

class statsmodels.genmod.families.family.NegativeBinomial(
link=None
alpha=1.0
check\_link=True
)

I want to learn what I should think about and how I should think when setting the alpha value.

Should I use a value for alpha that:
a. Gets the ratio Df Residuals / Pearson chi2 as close as possible to one?
b. Maximizes Log-Likelihood
c. Is a "compromise" between a and b?
d. Something else?

Thanks!

Here is documentation:  https://www.statsmodels.org/devel/generated/statsmodels.genmod.families.family.NegativeBinomial.html#statsmodels.genmod.families.family.NegativeBinomial

/r/pystats
https://redd.it/1eaac20
Streamlit or grade.io for Python web project

I struggle to decide between streamlit and grade.io for a little Python project I am running. I basically only need a few input and output fields to communicate with my Python app in the background. However, since I have to start learning one of the two - which one do you think is worth the time investment more than the other? Thanks in advance.

/r/Python
https://redd.it/1eaxr6w
Django SaaS boilerplates

What are your preferred Django boilerplates and why? If they include Vuejs + Tailwind as frontend even better! Thank you

/r/django
https://redd.it/1eawesw
Rio: WebApps in pure Python – Technical Description

Hey everyone!

Last month we recieved a lot of encouraging feedback from you and used it to improve our framework.

First up, we've completely rewritten how components are laid out internally.This was a large undertaking and has been in the works for several weeks now - and the results are looking great! We're seeing much faster layout times, especially for larger (1000+ component) apps. This was an entirely internal change, that not only makes Rio faster, but also paves the way for custom components, something we've been wanting to add for a while.

From all the feedback the most common question we've encountered is, **"How does Rio actually work?"**

The following topics have already been detailed in our [wiki](https://github.com/rio-labs/rio/wiki) for the technical description:

* What are components?
* How does observing attributes work?
* How does Diffing, and Reconciliation work?

We are working technical descriptions for:

* How does the Client-Server Communication work?
* How does our Layouting work?

Thanks and we are looking forward to your feedback! :)

[GitHub](https://github.com/rio-labs/rio)

/r/Python
https://redd.it/1eb2cta
Extending Zero Trust Network Access to a Private S3 Bucket using Boto3 and OpenZiti (both Python)

* **What My Project Does:** We use Boto3 (AWS SDK for Python) and the open source OpenZiti Python SDK to enable Zero Trust Network Access to a Private S3 Bucket with no inbound firewall ports, no need for sidecars, agents, or client proxies, nor any use of AWS Private Endpoints.
* **Target Audience**: Engineers and developers who need to connect distributed systems/apps to AWS S3 (though the technology can be used for many other use cases)
* **Comparison**: The company for whom we developed it previously used an AWS VPN client to connect from their robot to AWS Private S3 Bucket across the internet. Now they do not need to use a VPN, the zero trust overlay network is embedded in their Python apps running on/next to the robot. Further, they can close all inbound FW ports on AWS and only need outbound ports at source (opposed to inbound ports on both sides), no need for public DNS, L4 loadbalancers, and more.

[https://blog.openziti.io/extend-access-to-a-private-s3-bucket-using-python](https://blog.openziti.io/extend-access-to-a-private-s3-bucket-using-python)

Source code can be found here - [https://github.com/openziti/ziti-sdk-py/tree/main/sample/s3z#readme](https://github.com/openziti/ziti-sdk-py/tree/main/sample/s3z#readme)

/r/Python
https://redd.it/1eaz71k
Suggest me some paid django course

I want paid django course. I completed the basics of django and made some projects like blog, todo lists, portfolio, etc. I want to learn some advance cocepts too like middleware , rest api, signals...

Recently i learned js and postgresql too.
So suggest me some course please.

/r/django
https://redd.it/1eb4gd6
PuppySignal - An open source Pet's QR Tag

Hello everyone, this is a project I've been working on from a few years for my own-use with my pets, and this year I decided to share it with the community.

Project website: PuppySignal.com

What my project does

The functionality is pretty simple: when you log in, you create a profile for your pet, and a QR code will be generated and linked to its profile. When someone scans this code and decides to share its location, you will receive a notification on your phone with your pet's location, and the person who scanned it will see your contact information.

It consists of a few projects built with React (web and documentation), React Native (mobile), and Python for the backend (FastAPI and SQLAlchemy).

Target audience

Pet owners, but anyone could create codes and attach them to items, or whatever they want.

Comparison

Many QR pet tag alternatives already exist. The difference between them and PuppySignal is that you don't have to buy a QR tag and wait for it to be delivered. You can just clone it, self-host it, print the QR code, and attach it to your pet's collar.

Documentation: https://docs.puppysignal.com

Repository: https://github.com/FLiotta/PuppySignal

/r/Python
https://redd.it/1eb3lam
Searchable Input/Combobox For a Form

I'm trying to build a Django application using Django templates, HTMX, Tailwind and Alpine.js.

I've hit a bit of a roadblock trying to create a foreign key selection box that acts like an autocompleting text input/combobox. I want to use this method of input in many places throughout my app as I plan to use it for searching for products, for example, when creating an invoice.

I had a look at select2, and the related django autocomplete light, but struggled to get either to behave exactly in the way I was aiming for, ie as a text input box that shows the filtered options below, instead of as combobox that needs to be selected which then has a search box at the top,

I have modified an Alpine UI combobox component to pull the information from a json returning view which filters and displays the name of objects from one of my models, and then also stores the id in a hidden field on my form. I'm a worried that this method is not very robust and could be hard to test, potentially displaying one piece of data while storing the key of another.

Is there a best practice approach to creating something like

/r/django
https://redd.it/1ebfpr5
Django Docker tutorials for multiple services

I've been learning about Docker and how to deploy a Django app. I've done multiple tutorials on how to run Celery, Redis, Postgres, etc. However, none of them seem to show how to run all these services together.

Any suggestion for tutorials showing a full start to finish dockerized application and deployed with Celery, Redis and Postgres?

Thanks in advance.

/r/django
https://redd.it/1ebdvbr