Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Excel Workbook Refresh Automation

Hey everyone! I’m looking to automate a repetitive task with Python and could use some help. I have a folder full of Excel workbooks that contain queries (linked to an ODBC connection), and I need a program that will:
1. Open each Excel file in the folder one by one.
2. Hit Control + Shift + F5 to refresh all queries in each workbook.
3. Wait until all the queries are done refreshing.
4. Save the workbook.
5. Close it and move to the next file.

Does anyone have suggestions on how to make this happen? I’d appreciate any code snippets or libraries to look into—thanks!

/r/Python
https://redd.it/1gq4aum
The Mill build tool is looking for people to collaborate with on adding Python support

Hi All,

Mill is a build tool traditionally targeting JVM languages Java/Scala/Kotlin, but is branching out to support other languages like multi-module Python or Javanoscript codebases. We're looking for people interested build tools to collaborate with us on adding first-class Python toolchain support to Mill. To that end, we've put up a non-trivial issue bounty to encourage collaboration for anyone who implements various Python-related build examples and tooling integrations for Mill:

First Class Python Support (4000USD Bounty)

I'd love to get feedback on the tool, the Python support roadmap, or thoughts on what people need from a Python build tool. My own Python tooling experience is a bit out of date, so any feedback (both positive or negative) would be very welcome!

/r/Python
https://redd.it/1gq6d3e
Building efficient API in Django REST framework, Django-ninja, and comparing to Golang

A few days ago I wrote about a step-by-step guide in optimizing an API written in Django REST Framework for retrieving large amount data (100k+ records), and most Redditors here liked it.

I have now added the same example written with Django-ninja to compare. Just for fun I also added a very light weight Golang implementation of the identical API.

https://preview.redd.it/11phws0hpl0e1.png?width=600&format=png&auto=webp&s=b34cf1b2c6fbb2ca16760431b4890954c55a4049

https://preview.redd.it/sugub4hipl0e1.png?width=600&format=png&auto=webp&s=b0aa484e8c57728f8b375a0e8d7902464dda2de7

One thing that was surprising to me is that Django-ninja does not appear to be using more memory than the Go implementation.

You check out the updated implementations and the test results here: https://github.com/oscarychen/building-efficient-api

/r/django
https://redd.it/1gq5efh
Question for the pros

Hi coders!

I've been made redundant, and so l've decided to take up a new challenge - Python.

Currently reading through: Automate the boring stuff with python by Al Sweigart. ChatGPT recommended this beginners guide as its top choice.

Any tips you could impart on someone getting into the topic? Things you wished you knew at an early stage?


/r/Python
https://redd.it/1gq9qe2
Question about libraries

I don't understand how I should learn libraries. Let me explain: reading them I often don't understand what is written, it's all so difficult and technical. So I think "maybe I should watch an introductory video?" but I don't do it because it seems ethically wrong, I think I should learn by myself and not relying on someone's help every time. Can you tell me how you understand a library? Or a set of libraries needed to create a type of application (even more difficult since I don't even know which library to start with).

/r/Python
https://redd.it/1gq8qj3
Is async django ready for prime time? Our async django production experience

We have traditionally used Django in all our products. We believe it is one of the most underrated, beautifully designed, rock solid framework out there.

However, if we are to be honest, the history of async usage in Django wasn't very impressive. You could argue that for most products, you don’t really need async. It was just an extra layer of complexity without any significant practical benefit.

Over the last couple of years, AI use-cases have changed that perception. Many AI products have calling external APIs over the network as their bottleneck. This makes the complexity from async Python worth considering. FastAPI with its intuitive async usage and simplicity have risen to be the default API/web layer for AI projects.

I wrote about using async Django in a relatively complex AI open source project here: https://jonathanadly.com/is-async-django-ready-for-prime-time

tldr: Async django is ready! there is a couple of gotcha's here and there, but there should be no performance loss when using async Django instead of FastAPI for the same tasks. Django's built-in features greatly simplify and enhance the developer experience.

So - go ahead and use async Django in your next project. It should be a lot smoother that it was a year

/r/django
https://redd.it/1gqfyw3
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/1gqriuc
I'm puzzled trying to update just 1 m2m object in a form

I have a form in a template where I want the ability to check a box and it shows an interest in a game for an official. There is a many-to-many relationship between games and officials.

In the template, the form presents only the user of all officials to either check or uncheck for a game.

If the user makes any change (checks or unchecks), they essentially uncheck all users associated with that game.

Please help point me in the right direction.

Here are relevant sections of code:

[models.py](http://models.py)

class Official(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
class Game(models.Model):
game_official_options = models.ManyToManyField(Official, blank=True, related_name='officials')

[view.py](http://view.py)

def GameDetail(request, slug):
game = officials_models.Game.objects.get(slug=slug)
if request.method == "POST":
form = officials_forms.GameInterestForm(request.user, , instance=game)
if form.is_valid():
post = form.save(commit=False)


/r/django
https://redd.it/1gqo5j5
uv after 0.5.0 - might be worth replacing Poetry/pyenv/pipx

uv is rapidly maturing as an open-source tool for Python project management, reaching a full-featured capabilities with recent versions 0.4.27 and 0.5.0, making it a strong alternative to Poetry, pyenv, and pipx. However, concerns exist over its long-term stability and licensing, given Astral's venture funding position.

https://open.substack.com/pub/martynassubonis/p/python-project-management-primer-a55

/r/Python
https://redd.it/1gqh4te
Advice for Django Job

I recently started learning Django. I know how to make simple APIs with DRF. But I feel like there are too many abstractions like it makes it so easy to make a rest api. Anyways, Can some please tell me how to make it to full stack.... Is server side rendering and jinja templating all? Because on the other hand NextJS and React thing is very popular. I am studying AI/ML in parallel so what texh stach would be good for me?
I only want a job or internship with descent >= 5LPA salary as of now as I am in 3rd year. Whats the shortest way to do that.
PS: I also do competitive programming and am 2 star on codechef but I am kinda confused with what path to follow.

/r/django
https://redd.it/1gqwr77
Flask 3.1.0 Released

https://flask.palletsprojects.com/en/stable/changes/#version-3-1-0



Drop support for Python 3.8. #5623
Update minimum dependency versions to latest feature releases. Werkzeug >= 3.1, ItsDangerous >= 2.2, Blinker >= 1.9. #5624,5633
Provide a configuration option to control automatic option responses. #5496
Flask.openresource/openinstanceresource and Blueprint.openresource take an encoding parameter to use when opening in text mode. It defaults to utf-8. #5504
Request.max_content_length can be customized per-request instead of only through the MAX_CONTENT_LENGTH config. Added MAX_FORM_MEMORY_SIZE and MAX_FORM_PARTS config. Added documentation about resource limits to the security page. #5625
Add support for the Partitioned cookie attribute (CHIPS), with the SESSIONCOOKIEPARTITIONED config. #5472
-e path takes precedence over default .env and .flaskenv files. load_dotenv loads default files in addition to a path unless load_defaults=False is passed. #5628
Support key rotation with the SECRETKEYFALLBACKS config, a list of old secret keys that can still be used for unsigning. Extensions will need to add support. #5621
Fix how setting host_matching=True or subdomain_matching=False interacts with SERVER_NAME. Setting SERVER_NAME no longer restricts requests to only that domain. #5553
Request.trustedhosts is checked during routing, and can be set through the TRUSTEDHOSTS config. #5636

/r/Python
https://redd.it/1gqjytv
Automation question

Hey all,

I'm trying to automate a process at my work to improve my efficiency. For context, imagine I work at workplace A which has its own database of information that staff need to access. On top of this there's workplaces B and C also who have the same situation. However all 3 workplaces need to access each of the workplaces data (A, B and C) which is done via a website. On the website we have to click a link down the bottom corner of the page to "swap workplace". This opens a new page where we then select the workplace we want and click submit.

Is there anyway to automate this process of being able to just click a button and automatically be open up workplace A, without having to go into the menu.

There is no identifying feature for the workplace in the URL so I can't just bookmark different urls.

My initial thoughts were too have a process that targets particular ui elements and clicks them in series to do the job.

Thoughts?


Any help would be awesome!


/r/Python
https://redd.it/1gqzgv6
Finding a Django Learning Partner

HI All,

I am in a difficult position in my career with early layoffs and joining at time of recession. Due to all these I have derailed and have been extremely lazy to learn and lack the motivation. I am looking for a partner to learn Django together. Only motive is to share progess and keep each other motivated.

I am good with python and know only some basics of Django. I am a quick learner and academically strong. Preferable partner should be learning Django fully focused. I am a 2022 graduate (if that matters)

Mentors willing to mentor me through this rough phase are appreciated too.

/r/djangolearning
https://redd.it/1gr3z2h
Make your Github profile more attractive as a Python Developer

What My Project Does:

This project automates the process of showcasing detailed analytics and visual insights of your Python repositories on your GitHub profile using GitHub Actions. Once set up, it gathers and updates key statistics on every push, appending the latest information to the bottom of your README without disrupting existing content. The visualizations are compiled into a gif, ensuring that your profile remains clean and visually engaging.

With this tool, you can automatically analyze, generate, and display visuals for the following metrics:

\- Repository breakdown by commits and lines of Python code

\- Heatmap of commit activity by day and time

\- Word cloud of commit messages

\- File type distribution across repositories

\- Libraries used in each repository

\- Construct counts (including loops, classes, control flow statements, async functions, etc.)

\- Highlights of the most recent closed PRs and commits

By implementing these automated insights, your profile stays up-to-date with real-time data, giving visitors a dynamic view of your work without any manual effort.

\---

Target Audience:

This tool is designed for Python developers and GitHub users who want to showcase their project activity, code structure, and commit history visually on their profile. It’s ideal for those who value continuous profile enhancement with minimal maintenance, making it useful for developers

/r/Python
https://redd.it/1gr4qkw
Django models reverse relations

Hi there! I was exploring Django ORM having Ruby on Rails background, and one thing really seems unclear.

How do you actually reverse relations in Django? For example, I have 2 models:

class User(models.Model):
// some fields

class Address(models.Model):
user = models.OneToOneField(User, related_name='address')


The issue it that when I look at the models, I can clearly see that Adress is related to User somehow, but when I look at User model, it is impossible to understand that Address is in relation to it.

In Rails for example, I must specify relations explicitly as following:

class User < ApplicationRecord
has_one :address
end

class Address < ApplicationRecord
belongs_to :user
end


Here I can clearly see all relations for each model. For sure I can simply put a comment, but it looks like a pretty crappy workaround. Thanks!

/r/django
https://redd.it/1gr1v69
Just Finished Studying Django Official Docs Tutorials

I am a BSc with Computer Science and Mathematics major, done with the academic year and going to 3/4 year of the degree. I am interested in backend engineering and want to be job ready by the time I graduate, which is why I am learning Django. My aimed stack as a student is just HTMX, Django and Postgres, nothing complicated.

I have 6 projects (sites) that I want to have been done with by the time I graduate:

* **Student Analytics App**
* **Residence Management System**
* **Football Analytics Platform**
* **Social Network**
* **Trading Journal**
* **Student Scheduling System**

I have about 3 months to study Django and math alternatingly. I believe I can get a decent studying of Django done by the time my next academic year commences and continue studying it whenever I get the chance during my academic year.

Anyways, enough with the blabbering, I just got done studying the Django tutorials from the official docs. I love the tutorials, especially as someone who always considered YouTube tutorials over official docs. This is the first documentation I actually read to learn and not to troubleshoot/fix a bug in my code. I think it is very well written!

I wanted to ask:

* Is there any resource

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