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
Discussion Are there specific technical/scientific breakthroughs that have allowed the significant jump in maximum context length across multiple large language models recently?

Latest releases of models such as GPT-4 and Claude have a significant jump in the maximum context length (4/8k -> 128k+). The progress in terms of number of tokens that can be processed by these models sound remarkable in % terms.

What has led to this? Is this something that's happened purely because of increased compute becoming available during training? Are there algorithmic advances that have led to this?

/r/MachineLearning
https://redd.it/1c7pzf0
Hiring a Django back-end only dev

I have minimal experience with Django although I am able to recognize core functions due to some experience with Flask. I also have some experience with html/css/vanilla js.

I am have been in talks with a good backend Django developer who has minimal knowledge of FE development. Although I am confident I could develop the solution myself, I do not currently have the skills to develop at the speed that is required to produce an MVP.

However, my doubts stem from this developer's lack of experience with FE work. I thought I could just slap on a pre-built template like Metronic after the back-end views and models are complete but I am realizing this will still require a ton of work to configure, remove unused code, add graphs, tables etc etc. Am I overreacting or would it be smart to just hire another FE developer to assist with this or hire someone who has experience with both Django BE and Django templates?

​



/r/django
https://redd.it/1c833hd
Ruff 0.4.0 just dropped, with a faster parser and a new language server

Release notes here, seems to be a 20-40% improvement around the board.

This version features a new hand-written parser (rather than a generated one) that is much faster and offers better error messages. It also comes with a new rust-native language server inspired by rust-analyzer, that is multithreaded. I think they’re challenging Pylance’s throne, wouldn’t be surprised if the team goes after type checking next.

/r/Python
https://redd.it/1c7v2ax
FastAPI vs Flask vs Django

/r/flask
https://redd.it/1c82000
Project: An Interactive Python Dashboard For Data Storytelling UN Food Security

Python’s Plotly Dash is a powerful tool for creating interactive data visualizations. As a Comp Sci professor, I use it extensively for interactive dashboards.

Its usefulness lies in its ability to create web-based applications directly from Python code, without the need for additional web development skills.
Using UN food security data, let me show you an example of how you can create an interesting and useful Python Plotly dashboard that tells a data story using:

* **A bubble chart:** with variable-sized markers, a bubble chart can represent the severity of undernourishment within a given country. Each bubble visually represents the scale of undernourishment.
* **A horizontal bar chart:** with its rigid organized structure, a horizontal bar chart provides a clear ordered list that emphasizes the 10 most undernourished countries by percentage of population.
* **A dropdown menu:** by Year, allowing the user to see the changing story over a period of time.

These two data visualizations offer a dual perspective on the global picture of undernourishment: one that is geographically broad and another that is focused and comparative.

***Here's a step-by-step project on how to put this all together.***

FREE ARTICLE:

[https://johnloewen.substack.com/p/combining-data-visuals-an-interactive](https://johnloewen.substack.com/p/combining-data-visuals-an-interactive)

​

​

/r/Python
https://redd.it/1c7tkg1
Anaconda install taking a long time. Frozen?

Hello,

Trying to do a little training course and it has me installing Anaconda. It has been on Setting up Base environment for over an hour now. Last step reads "preparing transaction...working...done"

And it has not moved. Looking in task manager every now and then the cpu% goes up to like .5% then back down on the installer. 2 _conda remain at 0%

Have never had an issue installing anything before

/r/Python
https://redd.it/1c88588
Please link me some flask website examples.

I am trying to wrap my head around flask's capabilities. I am looking for live examples of websites using flask mostly by itsself with html/css but without javascript or with hardly any javascript or any other programing languages besides python. Huge bonus points if the code is open source.

/r/flask
https://redd.it/1c8aysj
Connecting Django to an existing database

Hey, so i want to create a simple web-ui for an existing database. It's a Flask page now but for learning purposes I want to move it to Django and now I'm stuck on 1 little thing. That database. It already exists and has quite a bit of data and no id column (as I know Django creates one). It also gets filled with more data by another program.

I'm not sure where to start with this as it would be very nice if it didn't ruin the existing database..

I don't mind reading documentation but I just don't really know what to look for so some key words or functions or whatever to search for would be very helpful already.

I can't be the only one wanting to do this.

/r/djangolearning
https://redd.it/1c86aec
FastAPI vs Flask vs Django

/r/django
https://redd.it/1c81zc3
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/1c8bxz5
Been stuck on an error for a couple of days now - "AttributeError: 'NoneType' object has no attribute

Hello all,

I'm - trying to - make a website that incorperates a flask to do list app.
Following this tutorial.

Everything has gone fine but I'm about 13mins in video 5. I'm at the point of POST to my mongodb but get an error. I understand the something isn't defined correctly but the code is the same the video and his adds to the db just fine?

The error

My code

Any help is really appreciated

/r/flask
https://redd.it/1c82l6u
stuck on this site can’t be reached when entering 127.0.0.1:5000.

/r/flask
https://redd.it/1c7sdqs
Unable to send request to containerized flask app

Code for app.py -

from flask import Flask, redirect, urlfor, rendertemplate, request, jsonify
import random
import os
import time
from datetime import datetime
from flasksqlalchemy import SQLAlchemy
from langchain
googlegenai import ChatGoogleGenerativeAI
from langchain
core.messages import HumanMessage, SystemMessage


app = Flask(name)
app.config"SQLALCHEMY_DATABASE_URI" = 'sqlite:///test.db'

db = SQLAlchemy(app)

os.environ"GOOGLE_API_KEY" = ""

class Data(db.Model):
id = db.Column(db.Integer, primarykey=True, autoincrement=True)
request = db.Column(db.Text, nullable=False)
response = db.Column(db.Text)
date
time = db.Column(db.DateTime, default=datetime.utcnow)
# action = db.Column(db.String(80))

def repr(self):
return '<UserData %r - %r>' % (self.request, self.datetime)

@app.route("/", methods = ["POST", "GET"])
def home():

if request.method == "POST":
json = request.get
json()

if json and "query"in json:
question = json'query'

model = ChatGoogleGenerativeAI(model="gemini-pro", convertsystemmessagetohuman=True)
resp = model(



/r/flask
[https://redd.it/1c7tk65
Can I build a News API ?

So guys, this is my first time building an API. So my question is: is it possible and easy to build a small news API? If yes, where can I can the articles that I should put in the database ?

/r/django
https://redd.it/1c8l4xq
[D] A slide which makes you feel old

/r/MachineLearning
https://redd.it/1c8kuef
How do you implement replies comments ?

I'm in the process of building a blog site and trying to implement replies on comments. Example: post -> comment on post -> comment on comment. What is the process of implementing it on models? Any suggestion or help will be greatly appreciated. Thank you very much. Here are some sample scripts.

&#x200B;

models.py

class Post(models.Model):
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
topic = models.ForeignKey(Topic, on_delete=models.CASCADE, null=True, blank=True)
title = models.CharField(max_length=100)
author = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, related_name='posts')
image = models.ImageField(
default="post_images/default.webp",
upload_to="post_images",
null=True, blank=True
)
content = models.TextField()
date_posted = models.DateTimeField(auto_now_add=True)
date_updated = models.DateTimeField(auto_now=True)


/r/djangolearning
https://redd.it/1c8sdez
Python icon library with 5237 high-quality icons (Tabler Icons wrapper)

What My Project Does:
pytablericons is a Python wrapper for the tabler-icons project, which provides a set of 5237 free MIT-licensed high-quality SVG icons for web projects with each icon being designed on a 24x24 grid and a 2px stroke.
It allows you to load any of those SVG icons directly into a Pillow PNG Image in any size and color without losing quality and without having to download the icons manually or handling the SVG conversion yourself. For the outline icons, the stroke width is customizable as well. All of this is done in just a single line and since the icon is a Pillow Image, it can then be used easily with basically anything (e.g. PyQt5, PyQt6, PySide2, PySide6, Tkinter, etc.)


Target Audience:
This is useful for any Python developer who is working on UI projects and wants to easily display modern icons in any size and color without losing quality and without having to download each icon manually.


Comparison: /


Links:
Preview: https://github.com/niklashenning/pytablericons/assets/58544929/e13fb020-4d5f-4e28-bd5f-0d5659bd6582
GitHub: https://github.com/niklashenning/pytablericons

/r/Python
https://redd.it/1c8ohrp
Hey folks 👋,

Does anyone know how to set up Tailwind with Django? I've been using the CDN, but now I need to push to production.

I've searched for how to set it up, but I didn't find anything useful. It's not even in the Tailwind documentation.



/r/django
https://redd.it/1c8va6k
Am skeptical about this?🤔

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