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
Smartcut: Super fast cutting and trimming of videos

What My Project Does

Smartcut is to my knowledge the most robust open-source implementation of frame accurate video cutting without recoding, a.k.a smart cut, smart encoding, smart render, etc.

It uses PyAV and libavcodec (ffmpeg internals) to encode a small part of the video near the cutpoints and then uses libavformat to stitch the recoded segments and parts of the original video back together into a whole video.

https://github.com/skeskinen/smartcut

Target Audience

This project is for people who want to cut videos really fast from the command line. This could be useful e.g. as part of a script that goes through a directory and quickly cuts off some part of the videos. It could also be used as a part of a video editor project, like I've done in my GUI video editor project.

It is also one of the largest available projects that uses PyAV (the pythonic bindings for libav project) and really showcases the awesomeness of the library. I also contributed 4 patches to PyAV and the maintainer was really cool to work with.

Comparison

The github page has a pretty nice list of related projects: https://github.com/skeskinen/smartcut?tab=readme-ov-file#other-projects

The most obvious comparison is to lossless-cut which is a popular open-source video editor written in TypeScript and Electron

/r/Python
https://redd.it/1f767df
Is Django Still Relevant for Backend Jobs?

Hi Djangonauts!

I'm a junior CS student with some experience in Django (intermediate functionality, needs frontend work). While I enjoy using Django, I'm concerned about landing a job with it after graduation. Many postings seem to focus on C# and .NET

My questions are:

Is Django still a valuable skill to learn for backend development positions?
Would focusing on C# and .NET offer better job prospects, considering the current market?

My dilemma:

I'm unsure if I should continue building my Django skills or switch gears to C# and .NET for better job security.

I'm feeling some pressure to upskill and avoid the pitfalls of job seekers lacking the right skills.
so I'm trying hard and pushing through burnouts, trying to upskill in order to strengthen my capability and candidacy.

/r/django
https://redd.it/1f76jbk
Why not just get your plots in numpy?!

Seriously, that's the question!

Why not just have simple
plot1(values,size,title, scatter=True, pt_color, ...)->np.ndarray
function API that gives you your plot (parts like figure and grid, axis, labels, etc) as numpy arrays for you to overlay, mask, render, stretch, transform, etc how you need with your usual basic array/tensor operations at whatever location of the frame/canvas/memory you need?

Sample implementation: https://github.com/bedbad/justpyplot

# What my project does?

Just implements the function above

When I render it, it already beats matplotlib and not by a small margin and it's not the ideal yet:

Plotting itself done in vectorized approach and can be done right utilising the GPUs fully

plot1, plot2 .. plotN is just dependency dimensionality you're plotting (1D values, 2D, add more can add more if wanted)

Target Audience? What it Compares against?
Whoever needs real-time or composable or standalone plotting library or generally use and don't like performance of matplotlib [1, 2, 3\]

I use something similar thing based on that for all of my work plotting needs and proved to be useful in robotics where you have a physical feedback loop based on the dependency you're plotting when you manipulating it by hand such as steering the drone;


/r/Python
https://redd.it/1f7jfgd
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1f7lwin
pytest vs unittest?

I keep reading from Django’s official site to use unittest, but I’m reading more about pytest and find some aspects really interesting and intuitive. What does the community at large prefer?

/r/django
https://redd.it/1f7maoe
Anyone made the switch from ASP.NET Core?

I'm a .NET developer by daytrade, and I'm starting side projects from time to time. Usually it's been Node.js/Go/ASP.NET, but I've never done Django yet. I'm just not a big Python user in general.

However, it now looks like I have to build an admin panel by myself for a side project I've just started, and Django entered my mind as it's got one by default. It looks like Django + DRF is sort of a ASP.NET/Spring lite-edition, so I'm looking to see some feedback if anyone has actually moved from ASP.NET to Django, or just used both and have some feedback to share.

One thing I'm kind of suspicious about is the performance. ASP.NET is what, 10x faster than Django? However I know it probably won't make a real difference, but seems a shame if there is no real benefit to using Django.

/r/django
https://redd.it/1f7ezda
Web scraping with GPT-4o: powerful but expensive

Hey folks,

So I've been messing around with OpenAI's new structured outputs feature and decided to build an AI-powered web scraper. Thought I'd share some of the cool (and not so cool) stuff I found.

**The Good:**

* This thing can parse some pretty complex tables. I threw a 10-day weather forecast at it with all sorts of nested data, and it handled it like well.
* It's smart enough to figure out merged cells and hidden data in the HTML.

**The Bad:**

* Wikipedia tables with combined rows? Yeah, that broke it.
* Asking it to give XPaths directly was a mess. Had to do some workarounds.

**The Ugly:**

* GPT-4o is expensive! Spent $24 in two days just messing around.

I made a quick demo with Streamlit if anyone wants to check it out: [https://orange-resonance-9766.ploomberapp.io](https://orange-resonance-9766.ploomberapp.io)

Source code's on GitHub if you're curious: [https://github.com/edublancas/posts/tree/main/ai-web-scraping](https://github.com/edublancas/posts/tree/main/ai-web-scraping)

Anyone else played with AI for web scraping? What's been your experience?

P.S. If you want the full nerdy details, I wrote a blog post about it: [https://blancas.io/blog/ai-web-scraper/](https://blancas.io/blog/ai-web-scraper/)

/r/Python
https://redd.it/1f7g0t9
Looking for fellow learners

TLDR: If you are interested in learning and then building in Django, Please DM me and we can start ASAP. I am a beginner in Django.

I am looking for one to two people to learn and practice Django together. This way we all can learn faster and build something cool together.

Requirements:

Must be serious learners who want to learn quick and start building.

Must be proficient with programming in general and have decent knowledge of Python. Quick Learner and positive mindset.

Plus Points: If you are experienced.

About Me: I am a software Engineer proficient in C++ & Python, Strong knowledge of Programming & DSA. Have almost 2 YOE.

To people who have commented: I have zero experience with Django, know basic things like views, models, app, users, admin etc. but would like to start from square 1 which i think should take like a week to get done with basics and jump on to building. Just telling it so that you have clear idea about my Django Knowledge and what to expect.

/r/django
https://redd.it/1f7awk6
Deploying on Choreo.dev?

Hi Guys,

I am testing out different options for hosting my django + postgresql + react application. I found https://choreo.dev/ very convenient because i can manage all parts of the application on one dashboard instead of using 3 different providers.

However, it makes me a little suspicious that you can hardly find anything about choreo on the internet + the documentation is also not that extensive.

Do any of you have experience with the provider, and if so, what do you think?

/r/django
https://redd.it/1f7yhrx
Spyder 6 IDE Released

Spyder 6 has been released. The Spyder IDE now has standalone installers for Windows, Linux and Mac. Alternatively it can be installed using a conda-forge Python environment:

https://github.com/spyder-ide/spyder/releases

/r/Python
https://redd.it/1f7w2rn
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