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
Best Way to Split Scientific PDF Text into Paragraphs?

Hi everyone,

I'm working on processing scientific articles (mostly IEEE-style) and need to split the extracted text into paragraphs reliably.

Simple rules like \\n or \\n\\n often give poor results because:

Many PDFs have line breaks at the end of each line, even mid-paragraph.

Paragraph separation isn't consistent.

I'm looking for a better method or tool (free if possible) to segment PDF text into proper paragraphs
Any suggestions (libraries methods......) would be appreciated!



/r/Python
https://redd.it/1lo60gv
How is PySide6 as a GUI development option?

I've been looking into native GUI app development, and PySide6 came up—does anyone have experience with it?

Also, is building GUI apps with Python kind of a bad idea in general?

/r/Python
https://redd.it/1lo9132
An open-source alternative to Yahoo Finance's market data python APIs with higher reliability.

"Hey folks! 👋

I've been working on this Python API called defeatbeta-api that some of you might find useful. It's like yfinance but without rate limits and with some extra goodies:

• Earnings call transcripts (super helpful for sentiment analysis)
• Yahoo stock news contents
• Granular revenue data (by segment/geography)
• All the usual yahoo finance market data stuff

I built it because I kept hitting yfinance's limits and needed more complete data. It's been working well for my own trading strategies - thought others might want to try it too.

Happy to answer any questions or take feature requests!"

/r/Python
https://redd.it/1loaj1q
toycrypto: Some toy cryptographic modules and related tools

### toycrypto

Some toy cryptographic modules and related tools that should never, ever be used for anything other than demonstation purposes.

Python's "one int to rule them all" makes it very attractive for illustrating cryptographic notions and computations.

- PyPi
- Github
- Documentation

### What My Project Does

toycrypto is a collection of modules which can be used to illustrate or teach about basic cryptographic concepts.
It has few third party dependencies and no required dependencies on anything that would prevent its use in a pure Python environment.

It started out as a place for me to collect various things I had written in Jupyter notebooks or in teaching notes.

A few examples:

- The oldest (and ugliest) code in the project is the Elliptic Curve module, which I had originally created to so that I could talk about the doubleandadd algorithm (and its vulnerabilites to side channels).

- The birthday problem module because I needed something that would efficiently provide reasonable approximations for the kinds of numbers and probability I wanted to talk about.

- A more recent module is the security games,
which can be used to illustrate things like IND-CPA.

- The number theory module started out to just give me pure Python utilities that I would otherwise have used Sage

/r/Python
https://redd.it/1loighk
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/1loncju
Can someone help me with a clear guide to Django auth process customization ?

Hello guys !! I'm new in the django world, and i feel a little confused by the authentication process of this framework. A come frame laravel where i used to create the auth process by myself (although there are some ready to use kits like breeze). But in Django, i've realized that the authentication system is a built in feature of the framework. I searched for a way to customize it, but all the tutorials i found were not as clear as i needed. So if someone has some tips or suggestions for me, il be delighted to explore them 🙂. Thanks in advance.

/r/django
https://redd.it/1lo9bwr
Practice resources

Recently complete watching “code bro” YouTube python learning
And now I wanted to practice on those skill. Do you have any recommended researchers to practice from it?

I tried “code war” and i think the Questions there is a little off ( some of the question there are weird and I don't think I'll ever run into them again)

I know “leet code” is more difficult question aiming for interview question but maybe I should learn from them

/r/Python
https://redd.it/1lonjvb
Blog Understand how Python works using daily koans

When I first started using Python, I did what everyone does: followed tutorials, bookmarked cheat sheets, and tried to memorize as much as I could. For a while, it worked. At least on the surface.

But even after months of writing code, something felt off.
I knew how to use the language, but I didn’t really understand it.

Then I stumbled across a line of code that confused me:

== False # False
if : # Also False

I spent longer than I care to admit just staring at it.
And yet that little puzzle taught me more about how Python handles truth, emptiness, and logic than any blog post ever did.

That was the first time I really slowed down.
Not to build something big, but to sit with something small. Something puzzling. And that changed the way I learn.

So I started a little experiment:
Each day, I write or find a short Python koan, a code snippet that seems simple, but carries a deeper lesson. Then I unpack it. What it looks like on the surface. Why it works the way it does. And

/r/Python
https://redd.it/1loq064
What’s your approach to organizing Python projects for readability and scalability?

I'm working on improving my Python project structure for better readability and scalability. Any tips on organizing files, folders, modules, or dependencies?

/r/Python
https://redd.it/1lotna6
How to Implement login by either email or phone number?

Hello, I'm trying to develop an online store project, and I need a way to allow users to use either email OR phone number for registration. Keyword being Or. However since this is an online store, for actual purchase i will require users to provide phone number later. For now, is there a way to let users sign up with email or phone number? (CustomUser maybe?)

/r/djangolearning
https://redd.it/1low9b8
D Monthly Who's Hiring and Who wants to be Hired?

For Job Postings please use this template

>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]

For Those looking for jobs please use this template

>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]

​

Please remember that this community is geared towards those with experience.

/r/MachineLearning
https://redd.it/1loqe5e
Will requiring login deter users from trying my mood tracker?

I am finishing up my first web application, a simple mood tracker where users log daily mood and notes. All pages require login so data stays private. I’m worried visitors will see the login wall and leave without trying the core features. Is that a dealbreaker? What’s the easiest way to let people try the main functionality without sacrificing privacy? I’m using React with a Django REST backend and session based authentication.

/r/django
https://redd.it/1louful
ViewORM for SQLAlchemy

Hello, Python community! Here is a package I developed for some projects I work at, and hopefully it might be helpful to a broad audience of developers: **SQLAlchemy-ViewORM** for managing simple and materialized views in ORM manner with any DB support.

* [PyPI](https://pypi.org/project/SQLAlchemy-ViewORM/)
* [Documentation](https://sqlalchemy-vieworm.readthedocs.io/en/latest/)
* [GitHub](https://github.com/AivanF/SQLAlchemy-ViewORM)

# What My Project Does

Features:

* **Standard views**: Traditional simple SQL views that execute their query on each access.
* **Materialized views**: Views that store their results physically for faster access.
* **Simulated views**: For databases that don’t support materialized views, they can be mocked with tables or simple views. Actually, *this was the primary reason of the project* – to simplify quick tests with SQLite while deployments use Postgres. The lib allows to control the way of simulation.
* **Views lifecycle control**: create, refresh or delete the views all together or each one separately, depending on your project / business needs.
* **ORM interface, dialect-specific queries**: views can be defined as a static SQL/ORM query, or as a function that takes DB dialect and returns a `selectable`. After creation, the views can be used as ordinary tables.

What it lacks:

* **Migrations**, Alembic support. For now, migrations related to views should be handled manually or by custom scripts. In case the project receives

/r/Python
https://redd.it/1loweun
Python script to batch-download YouTube playlists in any audio format/bitrate (w/ metadata support)

I couldn’t find a reliable tool that lets me download YouTube playlists in audio format exactly how I wanted (for car listening, offline use, etc.), so I built my own script using yt-dlp.

# 🔧 Features:

Download entire playlists in any audio format: `.mp3`, `.m4a`, `.wav`
Set any bitrate: 128 / 192 / 256 kbps or max available
Batch download multiple playlists at once
Embed metadata (artist, title, album, etc.) automatically

It’s written in Python, simple to use, and fully open-source.

It was created using ChatGPT and It performs as described.

Feel free use it ,if you need it

📽️ [YouTube tutorial link\] -https://youtu.be/HVd4rXc958Q
💻 [GitHub repo link\] - https://github.com/dheerajv1/AutoYT-Audio

/r/Python
https://redd.it/1lot7nn
Is it unreasonable to pair Django with Astro as well as htmx?

So basically you have a website that is completely static up until the login page. Does Django’s project structure work well with this? Where you can basically use Astro to efficiently develop the static pages and not have to use “bloated” Django or rather ssr as a whole for the completely static portions. Then I’m also not sure if Django is suitable to be used with htmx, but I really like the concept of not having to reload the entire page request. It’s kind of like Astro’s island architecture but for ssr in a backwards twisted way where you could make the comparison.

I’m also torn between using golang with Templ to learn backend development or going with Django in python. Htmx and Astro pair-ability is definitely a must, so if it’s easily doable without some hacky round about way in Django, then I will probably go with that for simplicity, employability, and overall more widespread use.

/r/djangolearning
https://redd.it/1ln514x
What is the best vps (interms of price) to host my django + react app.....(i have a background process script too)



/r/djangolearning
https://redd.it/1llmq48
How do you choose your Django hosting provider?

Hey guys, what are your usual go-to solutions when you're hosting your Django projects, and why?

Is price the most important factor, or is it the feature set, credibility of the company, or how do you choose the right one?

I'm conducting a small research project to gain a deeper understanding of this topic. Thank you for your help

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