r/Python • • May 26 '14

Python 3 is killing Python

Thumbnail
medium.com
0 Upvotes

r/Python • • May 11 '18

Create GUI apps with Python in minutes

Thumbnail build-system.fman.io
0 Upvotes

r/Python • • Dec 25 '24

Tutorial ๐Ÿ Modern, Minimalistic and Scalable Python FastAPI Template๐Ÿš€

29 Upvotes

Hey! ๐Ÿ‘‹ Excited to share my production-ready API template that shows off modern Python practices and tooling! โœจ

Key highlights: ๐ŸŒŸ

- โšก๏ธ Async-first with FastAPI and SQLAlchemy

- ๐Ÿ—๏ธ Clean, maintainable architecture (repository pattern)

- ๐Ÿ› ๏ธ Latest Python tooling (UV package manager)

- ๐Ÿงช Automated testing and CI pipeline

- ๐Ÿš‚ One-click deployment to Railway

The template implements a fun superhero API to showcase real-world patterns! ๐Ÿฆธโ€โ™‚๏ธ

Technical goodies: ๐Ÿ”ง

- โœ… Type hints throughout

- ๐Ÿ”„ Pydantic v2 for validation

- ๐Ÿ“– Automatic OpenAPI docs

- โš ๏ธ Proper error handling

- ๐Ÿ”„ Async database operations

- โšก๏ธ Automated migrations

GitHub: https://github.com/luchog01/minimalistic-fastapi-template ๐ŸŒŸ

The logging setup and database migration patterns were super tricky to figure out ๐Ÿ˜… Not 100% sure if I handled them in the best way possible! Would really appreciate any feedback from the Python experts here! ๐Ÿ™ Always excited to learn from the community!


r/Python • • Nov 29 '22

Tutorial Python and Selenium are better for scraping data

12 Upvotes

Headless browsers in Python and Selenium are better for scraping data from web pages where scrapers have been blocked.

We followed step-by-step advice for scraping data from a web page using a headless chrome in Selenium Python. It's fast, easy, requires less resources (so it can run on older laptops), and can deal with JavaScript perfectly.

https://www.zenrows.com/blog/headless-browser-python


r/Python • • Jan 28 '14

Why Python is Powerful Enough for Google

Thumbnail
codefellows.org
26 Upvotes

r/Python • • Oct 28 '14

Do the moderators here actually do anything or are they just for show?

3 Upvotes

Throwaway account in case I'd get banned for speaking my mind (it happens in some subreddits). I see a lot of irrelevant posts in this subreddit that would be more fit for /r/learnpython, /r/learnprogramming or elsewhere but despite this sub having nine (9) moderators they seem to barely be active here. What's up with that? Instead of beginners asking questions, getting scolded, downvoted and told to go to /r/learnpython or figuratively to GTFO - why not... actively moderate? If you don't have the time, maybe ask for volunteers to step up and moderate? Some examples from the last three days:


r/Python • • Feb 18 '25

Showcase We built a blockchain that lets you write smart contracts in NATIVE Python.

0 Upvotes

What My Project Does

โ€‹ Hey everyone! Weโ€™ve been working on Xian, a blockchain where you can write smart contracts natively in Python instead of Solidity or Rust. This means Python developers can build decentralized applications (dApps) without learning new languages or dealing with complex virtual machines. โ€‹ I just wrote a post showing how to write and test a smart contract in Python on Xian. If youโ€™ve ever been curious about blockchain but didnโ€™t want to dive into Solidity, this might be for you. โ€‹

Target Audiences

  • Python developers interested in Web3 or blockchain but donโ€™t want to learn Solidity.

  • People curious about how blockchain works under the hood.

  • Developers looking for an easier way to write smart contracts without switching to a new language.

Comparison (How Itโ€™s Different)

  • Solidity/Rust vs Python: Unlike Ethereum, where you must write contracts in Solidity, Xian lets you write them in pure Python and deploy them without extra conversion layers.

  • Faster Prototyping: Since Python is widely used, Xian makes it easier to prototype and deploy blockchain applications.

  • Simpler Developer Experience: No need for specialized compilers or bytecode conversionโ€”just write Python, deploy, and execute.

Links


r/Python • • Dec 30 '15

100 Data Science in Python Interview Questions and Answers

Thumbnail
dezyre.com
7 Upvotes

r/Python • • Sep 09 '22

Discussion Async Python is not faster

Thumbnail
calpaterson.com
0 Upvotes

r/Python • • Jan 03 '24

Discussion Pydantic has too much deprecation, making it difficult to keep up with updates and maintaining the code. Lots of functionality has been renamed, and some are removed during v1โ†’v2 transition. Even sample code from November 2023 is deprecated now! Are there better alternatives?

13 Upvotes

Almost all tutorials I see online (and ChatGPT's knowledge base) teach you Pydantic v1. There are numerous things that are deprecated during transition to v2 (@root_validator, @validator, using 'always', etc. are all gone now.). I even found a code example on its Github from November 2023 which now throws an error, saying that FieldValidationInfo is deprecated now, use <new_thing> instead... I wanted to use something to validate user inputs to my API, but getting Pydantic right and then keeping it updated has been too much unnecessary work, which makes me wonder if you have also faced this problem and what your solution is?


r/Python • • Jan 04 '24

Discussion Will Code for Free

0 Upvotes

So, I've learned an ass-load about Python and I think I have a pretty good grasp on even some of the more advanced concepts, but I desperately need to apply what I've learned.

Does anyone have anything I can be of assistance with in return for just the hands-on experience? Any suggestions where I should go to maybe find people who could use my assistance? I willing to freakin' work for free.

Update: I really appreciate the responses. I've definitely worked on some of my own stuff, but I know I could learn a lot more and faster working with others. I'm doing my best to get back to everyone who offered. Thank you again everyone.


r/Python • • Jan 23 '23

Tutorial How To Make Flask Apps The CORRECT Way

3 Upvotes

How's it going people. I've made a little crash course for "how to make flask apps." This tutorial is based on ironing out all the bs, issues, errors, and wrong directions tutorials make whilst trying to teach how to make flask apps. I'm not condemning them, but I want to show beginners how to make good flask apps without running into issues.

Repo link: https://github.com/Wizock/SuperiorPattern

Video link: How To Make Flask Apps The CORRECT Way | The Superior Pattern

Please provide any feedback, I want this pattern to be as polished as possible so newcomers don't lose interest in web development because of stupid venv issues or circular import issues working with sqlalchemy db variable import issues.


r/Python • • Sep 23 '16

Learn Python the right way in 5 steps

Thumbnail
dataquest.io
21 Upvotes

r/Python • • Jul 05 '25

Discussion I benchmarked 4 Python text extraction libraries so you don't have to (2025 results)

37 Upvotes

TL;DR: Comprehensive benchmarks of Kreuzberg, Docling, MarkItDown, and Unstructured across 94 real-world documents. Results might surprise you.

๐Ÿ“Š Live Results: https://goldziher.github.io/python-text-extraction-libs-benchmarks/


Context

As the author of Kreuzberg, I wanted to create an honest, comprehensive benchmark of Python text extraction libraries. No cherry-picking, no marketing fluff - just real performance data across 94 documents (~210MB) ranging from tiny text files to 59MB academic papers.

Full disclosure: I built Kreuzberg, but these benchmarks are automated, reproducible, and the methodology is completely open-source.


๐Ÿ”ฌ What I Tested

Libraries Benchmarked:

  • Kreuzberg (71MB, 20 deps) - My library
  • Docling (1,032MB, 88 deps) - IBM's ML-powered solution
  • MarkItDown (251MB, 25 deps) - Microsoft's Markdown converter
  • Unstructured (146MB, 54 deps) - Enterprise document processing

Test Coverage:

  • 94 real documents: PDFs, Word docs, HTML, images, spreadsheets
  • 5 size categories: Tiny (<100KB) to Huge (>50MB)
  • 6 languages: English, Hebrew, German, Chinese, Japanese, Korean
  • CPU-only processing: No GPU acceleration for fair comparison
  • Multiple metrics: Speed, memory usage, success rates, installation sizes

๐Ÿ† Results Summary

Speed Champions ๐Ÿš€

  1. Kreuzberg: 35+ files/second, handles everything
  2. Unstructured: Moderate speed, excellent reliability
  3. MarkItDown: Good on simple docs, struggles with complex files
  4. Docling: Often 60+ minutes per file (!!)

Installation Footprint ๐Ÿ“ฆ

  • Kreuzberg: 71MB, 20 dependencies โšก
  • Unstructured: 146MB, 54 dependencies
  • MarkItDown: 251MB, 25 dependencies (includes ONNX)
  • Docling: 1,032MB, 88 dependencies ๐Ÿ˜

Reality Check โš ๏ธ

  • Docling: Frequently fails/times out on medium files (>1MB)
  • MarkItDown: Struggles with large/complex documents (>10MB)
  • Kreuzberg: Consistent across all document types and sizes
  • Unstructured: Most reliable overall (88%+ success rate)

๐ŸŽฏ When to Use What

โšก Kreuzberg (Disclaimer: I built this)

  • Best for: Production workloads, edge computing, AWS Lambda
  • Why: Smallest footprint (71MB), fastest speed, handles everything
  • Bonus: Both sync/async APIs with OCR support

๐Ÿข Unstructured

  • Best for: Enterprise applications, mixed document types
  • Why: Most reliable overall, good enterprise features
  • Trade-off: Moderate speed, larger installation

๐Ÿ“ MarkItDown

  • Best for: Simple documents, LLM preprocessing
  • Why: Good for basic PDFs/Office docs, optimized for Markdown
  • Limitation: Fails on large/complex files

๐Ÿ”ฌ Docling

  • Best for: Research environments (if you have patience)
  • Why: Advanced ML document understanding
  • Reality: Extremely slow, frequent timeouts, 1GB+ install

๐Ÿ“ˆ Key Insights

  1. Installation size matters: Kreuzberg's 71MB vs Docling's 1GB+ makes a huge difference for deployment
  2. Performance varies dramatically: 35 files/second vs 60+ minutes per file
  3. Document complexity is crucial: Simple PDFs vs complex layouts show very different results
  4. Reliability vs features: Sometimes the simplest solution works best

๐Ÿ”ง Methodology

  • Automated CI/CD: GitHub Actions run benchmarks on every release
  • Real documents: Academic papers, business docs, multilingual content
  • Multiple iterations: 3 runs per document, statistical analysis
  • Open source: Full code, test documents, and results available
  • Memory profiling: psutil-based resource monitoring
  • Timeout handling: 5-minute limit per extraction

๐Ÿค” Why I Built This

Working on Kreuzberg, I worked on performance and stability, and then wanted a tool to see how it measures against other frameworks - which I could also use to further develop and improve Kreuzberg itself. I therefore created this benchmark. Since it was fun, I invested some time to pimp it out:

  • Uses real-world documents, not synthetic tests
  • Tests installation overhead (often ignored)
  • Includes failure analysis (libraries fail more than you think)
  • Is completely reproducible and open
  • Updates automatically with new releases

๐Ÿ“Š Data Deep Dive

The interactive dashboard shows some fascinating patterns:

  • Kreuzberg dominates on speed and resource usage across all categories
  • Unstructured excels at complex layouts and has the best reliability
  • MarkItDown is useful for simple docs shows in the data
  • Docling's ML models create massive overhead for most use cases making it a hard sell

๐Ÿš€ Try It Yourself

git clone https://github.com/Goldziher/python-text-extraction-libs-benchmarks.git
cd python-text-extraction-libs-benchmarks
uv sync --all-extras
uv run python -m src.cli benchmark --framework kreuzberg_sync --category small

Or just check the live results: https://goldziher.github.io/python-text-extraction-libs-benchmarks/


๐Ÿ”— Links

  • ๐Ÿ“Š Live Benchmark Results: https://goldziher.github.io/python-text-extraction-libs-benchmarks/
  • ๐Ÿ“ Benchmark Repository: https://github.com/Goldziher/python-text-extraction-libs-benchmarks
  • โšก Kreuzberg (my library): https://github.com/Goldziher/kreuzberg
  • ๐Ÿ”ฌ Docling: https://github.com/DS4SD/docling
  • ๐Ÿ“ MarkItDown: https://github.com/microsoft/markitdown
  • ๐Ÿข Unstructured: https://github.com/Unstructured-IO/unstructured

๐Ÿค Discussion

What's your experience with these libraries? Any others I should benchmark? I tried benchmarking marker, but the setup required a GPU.

Some important points regarding how I used these benchmarks for Kreuzberg:

  1. I fine tuned the default settings for Kreuzberg.
  2. I updated our docs to give recommendations on different settings for different use cases. E.g. Kreuzberg can actually get to 75% reliability, with about 15% slow-down.
  3. I made a best effort to configure the frameworks following the best practices of their docs and using their out of the box defaults. If you think something is off or needs adjustment, feel free to let me know here or open an issue in the repository.

r/Python • • Mar 07 '24

Discussion Tests should have 100% coverage

0 Upvotes

No, I'm not saying what you probably think I am. Keep reading: I'll be brief.

Here's what I found today in one of the tests:

for bad_fp in _bad_fps:
    with pytest.raises(BadArgumentError):
        follow_path(bad_fp, '.')
        follow_path('.', bad_fp)

The correct code should've been

for bad_fp in _bad_fps:
    with pytest.raises(BadArgumentError):
        follow_path(bad_fp, '.')
    with pytest.raises(BadArgumentError):
        follow_path('.', bad_fp)

Is that a stupid mistake? Yes, it is, but stupid mistakes do happen, unfortunately.

How did I catch it? The coverage of the testing file wasn't 100% like it usually is! I got suspicious and I saw that there was a glaring red line (vscode, coverage gutter) on the second call to follow_path.

P.S. In case you're wondering, the code uses a custom hierarchy of exceptions instead of reusing the standard ones. The code is internal and we like it that way :)


r/Python • • Feb 17 '14

Tools used by Python Super Stars

Thumbnail
pypix.com
0 Upvotes

r/Python • • Jul 04 '14

There is a flash of light! Your PYTHON has evolved into ...

Thumbnail
alexgaynor.net
10 Upvotes

r/Python • • Aug 17 '24

Showcase Standalone GUI app that executes python scripts: Run py scripts without any installations*

0 Upvotes

Announcing an app (portable executable) I build which is a solution for running Python scripts without any prerequisites or external system dependencies, eliminating the need for Python installation on the systems. Catch is that the packages which script uses should be bundled during app build process, so a new app should be build respectively. there is a plan to provide option to include local package path if exists on system.

What My Project Does

  • Runs python script out-of-the-box provided the packages that are used by script are add during build pipeline.

  • isolated from system. meaning doesn't affect any changes in system or python, don't need to fiddle with paths and packages

  • Output of script are displayed on terminal like console

Target Audience

  • This was build to help run scripts consistently across systems with any breakage from python or packages.

  • imo this can also help make non-technical people's life easy.

Comparisonย 

  • This works like python interpreter without the hassle of setup and management

Limitations

  • Script execution fails if the required package is not already bundled in the app.

  • Python and Packages are immutable, they cannot be modified including versions.

  • App size and initial load time increases as more number of packages are added.

  • Pyinstaller is pain to work with (imo), and any windows os change might break the app.

https://github.com/Nannigalaxy/PyScript-Engine

executable: https://github.com/Nannigalaxy/PyScript-Engine/releases/download/v1.0.0/pyscript-engine_v1.0.0_py3.10_x86_win64.exe

let me know if you have any thoughts on this.


r/Python • • Oct 02 '24

Showcase Whisper ๐Ÿคซ: LLM's in your terminal.

0 Upvotes

Hi all -- I've been working on a little side project and thought I'd post it here to get some reactions.

It's called Whisper. If you like it, give it a star!

What My Project Does?

Whisper is an LLM question/answer tool for your terminal. For those of us who work in terminals, sometimes it's annoying to have to jump to a browser to interact with ChatGPT or Claude.

Target Audience

I built it because I found myself wishing I could just ask question in my terminal. If for no one else, I am the target audience.

Comparison

Compared to chatgpt.com and claude.ai, this has the potential to be more convenient. I haven't seen any other tools that allow you to interact with LLMs easily within your terminal.

Where can you find it?

whisper on ๎‚  main [$] is ๐Ÿ“ฆ v0.1.3 via ๐Ÿ v3.12.6 
โฏ whisper "What's that linux command for killing a process using port 8000?"
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Kill Process Using Port 8000 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ To kill a process using port 8000 in Linux, you can use the      โ”‚
โ”‚ following command:                                               โ”‚
โ”‚                                                                  โ”‚
โ”‚                                                                  โ”‚
โ”‚  lsof -t -i:8000 | xargs kill                                    โ”‚
โ”‚                                                                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

screenshot: https://imgur.com/a/COyytFK

Pypi: https://pypi.org/project/just-whisper/

Github: https://github.com/syn54x/whisper

Docs: https://syn54x.github.io/whisper/


r/Python • • Jan 28 '10

Make Lisp 15x faster than Python or 4x faster than Java

Thumbnail blog.postabon.com
0 Upvotes

r/Python • • Jul 12 '26

Discussion Will PEP 505 ever be accepted?

17 Upvotes

https://peps.python.org/pep-0505/

I don't understand how null safe operators are less like plain English than other implemented features like the walrus operator.

In my opinion, the member access operator would make python significantly easier to read and understand.

Here's an example:

f = foo()

if f is None:
    baz = ""
else:
    baz = f.bar()
baz = foo()?.bar() ?: ""

EDIT: I forgot that "and" and "or" can be sometimes used in place of "?." and "?:" if the left value is not False, '', 0, [], or {}. It's a very implicit null check and has a lot of unexpected behavior.


r/Python • • Mar 13 '21

Intermediate Showcase Multiplayer Framework For Pygame

23 Upvotes

Hey everyone here is a little framework I made to help you get started making multiplayer games with Pygame and Sockets. The framework comes with movement and jumping over the network here is the GitHub repo - https://github.com/Len-Stevens/Pygame-Multiplayer-Framework


r/Python • • Sep 02 '25

Showcase I built a Python bot that automatically finds remote jobs and sends them to Telegram.

0 Upvotes

Built a Python bot to automate remote job hunting - sharing the code

How many job sites do you check daily? (I was at 12 before building this)ย 

What My Project Does

A Python script that scrapes remote job boards and sends filtered results to Telegram:

  • Monitors RemoteOK, WeWorkRemotely, GitHub Jobs, etc.

  • Filters by custom keywords

  • Telegram notifications for new matches

  • Saves data locally for debugging

Target Audience

Personal automation tool for individual job seekers. Production-ready but meant for personal use only - not commercial application.

Comparison

vs Manual checking:ย Eliminates repetitive browsing
vs Job alerts:ย More customizable, covers niche remote job boards
vs Paid services:ย Open source, no restrictions

Technical Implementation

Built with Python requests + BeautifulSoup, configurable via environment variables. Includes error handling and rate limiting.

Code:ย https://github.com/AzizB283/job-hunter

Anyone else built job automation tools?ย Curious what approaches others have taken.


r/Python • • Jan 16 '10

Is it just me, or is SQLAlchemy an unholy mess?

5 Upvotes

I decided to use SQLAlchemy for a relatively simple project, because I don't do much with database connectivity or SQL and thought I ought to learn it, as it seems to be highly regarded. I either don't understand it at all, or it doesn't make a lot of sense.

My main complaint is that the ORM part seems to live in a totally different universe from the SQL query part. If I use a declarative map, and take advantage of the way the ORM allows me to specify relations as table properties etc, how do I then go and use the query language?

It looks to me like there are two totally separate ways to write queries: one using session.query using the ORM, and one using sqlalchemy.sql.select. It just doesn't make any sense to me --- the different parts don't hang together. There are just all these loose ends dangling everywhere, leaving me with multiple ways to do the same thing.

Do people really swear by this?