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
Please help us test new Flask deployment tooling

Hi,

I work for Canonical, the creators of Ubuntu. We have been working on some new tooling to make it easier to deploy Flask applications in production using Kubernetes. This includes tooling to create Docker images as well as tooling to make it easy to connect to a database, configure ingress and integrate with observability. We would love your help and feedback for further development. We have a couple of tutorials:

[Creating a production ready Docker image](https://documentation.ubuntu.com/rockcraft/en/latest/tutorial/flask/)
Deploy a Flask App on Kubernetes

Please share any feedback you have. We are also running user experience research which takes about an hour to complete. Please let us know if you are interested (DM me or comment below). Thank you!

/r/flask
https://redd.it/1f7tj1m
Generators underused in corporate settings?

I've worked at a couple of places that used Python. And I've rarely seen anyone regularly using the yield keyword. I also very rarely see people using lazy "comprehensions" like

foo = (parse(line) for line in file)
bar = sum(postprocess(item) for item in foo)


And so, I'll use these features, because to me, they simplify things a lot. But generally people shy away from them. And, in some cases, this is going to be because they were burned by prior experiences. Or in other cases it's because people just don't know about these language features.


Has this been your experience? What was the school of thought that was in place on your prior teams?

/r/Python
https://redd.it/1f7zh22
Is there any plugin or Django app like this?

Supposing you have multiple users on your website and they receive points for doing something (posting, writing reviews, anything you choose to) and there are a few groups of users, each group having different rights and privileges on your website and the users are upgraded or downgraded to different groups based on accumulated points.

How to do this in Django? Is there any plugin or app helping you with this? If you just need to use pure Django then how this should be done?

Thank you in advance!

/r/djangolearning
https://redd.it/1f7s2gr
Using HTMX with Django is much easier than I thought!

I have recently given HTMX a try halfway through working on a Django project that needed dynamic content loading. It took me so long to give it a try because I thought that it would be hard to learn, but I was sooooo wrong. 😅

So it turns out that to add dynamic content loading all I had to do is:

1. Make a partial template of what I wanted to dynamically load.
2. Add HTMX to project
3. Add HTMX attributes to HTML

For this project, where I dynamically loaded available properties based on selected dates and number of guests I used these 3 HTMX attributes on my form element:

1. hx-get : to make an asynchronous HTTP GET request when an event is triggered
2. hx- target : to select the target element where we want to load the dynamic content.
3. Hx-swap: defines how the content retrieved via an HTMX request should be inserted into the target element on the page.

I found two things a little difficult to figure out:

1. Choosing the correct swap attribute: at first I tried outerHTML, but after some trial and error, I realized that innerHTML was the right choice.

1. Detecting HTMX requests in my Django view: It took me some

/r/django
https://redd.it/1f80vnq
D Self-Promotion Thread

Please post your personal projects, startups, product placements, collaboration needs, blogs etc.

Please mention the payment and pricing requirements for products and services.

Please do not post link shorteners, link aggregator websites , or auto-subscribe links.

--

Any abuse of trust will lead to bans.

Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

--

Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.

/r/MachineLearning
https://redd.it/1f63rhf
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/1f8f4hr
Can't make the user login

I don't know what is happening. Already tried copilot and gpt. But they're not help at ALL
all i have is
[04/Sep/2024 03:26:28\] "POST /accounts/login/ HTTP/1.1" 200 4157
and not redirecting. i have the LOGIN_REDIRECT_URL
Its not just redirecting. I don't know what to do anymore

/r/django
https://redd.it/1f8mgxr
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/1f8f4hr
Understanding apps, forms, and the structure of a project/app

Hello everyone,

I am basically a beginner trying to use Django in order to build an app for a business I work for. I have experience with programming, but I never built any app (or web based one).

After going through the Tutorial of Django, I jumped and started programming.

I decided to use various apps instead of having one app because I couldn't focus on the tasks needed and it was a cluster of code.

I began with 2 applications: forms - allows essentially forms management/everything to do with forms: processing, validation etc, and users app - user management, authentication, user settings and so on.

I started to create a login form and login form view. the login form has its own clean methods, and the login form view allows me to forward the form and reder it in HTML loginForm/. I decided to render only the form itself, but I will have a proper "login/" page will the loginForm/ will be imported to. As I said earlier, it is because the forms app is only responsible for the forms, and the rest of the page will be done by something else.

after I wrote all of what I mentioned, I realized that Django has

/r/djangolearning
https://redd.it/1f8qcyw
P Free RSS feed for tousands of jobs in AI/ML/Data Science every day

This is for all of you interested in a constant flow of freshly curated jobs in Artificial Intelligence, Machine Learning, NLP, Computer Vision, Data Engineering, Data Analytics, Big Data, and Data Science in general via RSS format. Jobs are aggregated through aijobs.net and it provides 200 listings at a time. The feed is updated about every hour with the latest jobs.

URL: https://aijobs.net/feed/

No sign-up needed - just add it to your favourite feed reader and be in the loop about new opportunities at any time 🚀

/r/MachineLearning
https://redd.it/1f8nw8f
Alternatives to Jinja for Flask-Based Desktop App Using PyInstaller and WebView

I'm developing a desktop application using the following tech stack:

Frontend: HTML, CSS, JavaScript, Jinja2 (current template engine)
Backend: Flask
Packaging: PyInstaller to create a `.exe`
UI: WebView for Windows

I am currently using Jinja2 for templating, but I want to explore other template engines that might provide better performance or additional features. My main requirements are:

1. Compatibility with Flask: Should integrate easily without much configuration.
2. Support for Desktop Apps: Must work well with PyInstaller when packaging the app.
3. Efficient Rendering: Performance is key, as the app is intended for desktop use.

Are there any good alternatives to Jinja2 that would fit well within this stack? Any advice on integration or potential challenges would be appreciated!

Thank you!

/r/flask
https://redd.it/1f8me1y
Introducing WSCE: A Custom Shell Environment Built with Python

Over the past few weeks, I've been working on a custom shell environment called **WSCE**. Built entirely in Python, it mimics the functionality of an operating system and comes packed with features like a fake boot sequence, a text editor, and more. It's designed to provide a unique experience that blends the line between an OS and a shell environment.

# What My Project Does

WSCE is a simulated operating system environment built as a Python-based shell. It offers a range of features such as:

* **FakeBoot:** Emulates the boot process of an actual operating system.
* **Aurora Text Editor:** A simple text editor to mimic basic productivity tools.
* **CommandSearch:** A script that searches a folder for python files to make into custom commands

# Target Audience

This project is primarily a passion project and is not intended for production use. It is targeted at hobbyists, Python developers, and those interested in exploring custom shell environments or unique OS simulations. It's perfect for those who enjoy tinkering with code and experimenting with unconventional software projects.

# Comparison to Existing Alternatives

WSCE stands out because it's not like any other shell environment or operating system out there. Unlike traditional shells or full OS environments, this project focuses on simulating

/r/Python
https://redd.it/1f8sslp
Nice looking, data display tables in Python? +Video

Ahoy, I wanted to share a video my buddies made. They maintain the great_tables package, a library for building pretty tables with Python, e.g. for publication or the web. If that's something you might want to do, you might want to check this out.

Here's their video, https://youtu.be/M5zwlb8OzS0
Here's the package doc site, https://posit-dev.github.io/great-tables/
Here's the repo, https://github.com/posit-dev/great-tables

How do you approach creating publication ready tables from your python analytics?

/r/Python
https://redd.it/1f8zg2c
Agency together

Hey guys, been wanting to open up a tech agency where I can create website, web apps, mobile apps and other stuff.

Looking for someone who can help with dev as well as marketing etc.

Dm me if anyone of your guys are interested.

/r/flask
https://redd.it/1f8vab2
Is Python easier to break into than other languages coming fron experience in a different stack?

Im looking to get out of.net because its a career dead end in my local area but no java jobs consider me even though i have spring boot projects. Python seems less opinionated with libraries like fastapi so i wonder if its easier to break in as a generalist.

/r/Python
https://redd.it/1f92ekl
Hello guys i need help with something I'm using jupyter notebook for object detection but when i use this code: if cv2.waitkey(1) & 0xFF == ord('q'): break it shows this error: module 'cv2' has no attribute 'waitkey' Does anyone know why?



/r/IPython
https://redd.it/1f90tlr
Please roast my resume - looking for dev job for the 1st time

/r/django
https://redd.it/1f8p9ks
What are you best tips for managing the database state with a small team?

Small team working on a SaaS project with Django as the back end. We're all new to Django, and we're running into issues where the database and migrations keep getting out of sync.

We use github, and are developing locally. I'm sure this is a super common problem with easy fixes, and advice?

/r/django
https://redd.it/1f90c5z
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/1f98kuz