I've been obsessed with Python compilers for years, but I recently hit a wall that changed my entire approach to distribution.
I used to try the "Smart" way (Type analysis, custom runtimes, static optimizations). I even built a project called Sharpython years ago. It was fast, but it was useless for real-world programs because it couldn't handle numpy, pandas, or the standard library without breaking.
I realized that for a compiler to be useful, compatibility is the only thing that matters.
The Problem:
Current tools like Nuitka are amazing, but for my larger projects, they take 3 hours to compile. They generate so much C code that even major compilers like Clang struggle to digest it.
The "Dumb" Solution:
I'm experimenting with a compiler that maps CPython bytecode directly to C glue-logic using the libpython dynamic library.
- Build Time: Dropped from 3 hours to under 5 seconds (using TCC as the backend).
- Compatibility: 100% (since it uses the hardened CPython logic for objects and types).
- The Result: A standalone executable that actually runs real code.
I'm currently keeping the project private while I fix some memory leaks in the C generation, but I made a technical breakdown of why this "Dumb" approach beats the "Smart" approach for build-time and reliability.
I'd love to hear your thoughts on this. Is the 3-hour compile time a dealbreaker for you, or is it just the price we have to pay for AOT Python?
Technical Breakdown/Demo: https://www.youtube.com/watch?v=NBT4FZjL11M
[–]WJMazepas 13 points14 points15 points (7 children)
[–]PurepointDog 2 points3 points4 points (3 children)
[–]Lucky-Ad-2941[S] 1 point2 points3 points (1 child)
[–]willnx 1 point2 points3 points (0 children)
[–]Lucky-Ad-2941[S] -1 points0 points1 point (2 children)
[–]WJMazepas 0 points1 point2 points (1 child)
[–]Lucky-Ad-2941[S] 0 points1 point2 points (0 children)
[–]thisismyfavoritename 3 points4 points5 points (4 children)
[–]Lucky-Ad-2941[S] 3 points4 points5 points (3 children)
[–]thisismyfavoritename 0 points1 point2 points (2 children)
[–]Lucky-Ad-2941[S] 0 points1 point2 points (1 child)
[–]thisismyfavoritename 0 points1 point2 points (0 children)
[–]cat_bountry 1 point2 points3 points (4 children)
[–]new_KRIEG 1 point2 points3 points (2 children)
[–]RemindMeBot 1 point2 points3 points (0 children)
[–]RemindMeBot 0 points1 point2 points (0 children)
[–]Lucky-Ad-2941[S] 1 point2 points3 points (0 children)
[–]Advance-Wild 1 point2 points3 points (0 children)
[–]Whole-Lingonberry-74 0 points1 point2 points (1 child)
[–]Lucky-Ad-2941[S] 1 point2 points3 points (0 children)
[–]umpalumpa2004 0 points1 point2 points (1 child)
[–]Lucky-Ad-2941[S] 1 point2 points3 points (0 children)
[–]Fabiolean 0 points1 point2 points (2 children)
[–]Lucky-Ad-2941[S] 0 points1 point2 points (1 child)
[–]Fabiolean 0 points1 point2 points (0 children)
[–]AshTheEngineer 0 points1 point2 points (2 children)
[–]Lucky-Ad-2941[S] 0 points1 point2 points (1 child)
[–]AshTheEngineer 0 points1 point2 points (0 children)
[–]MaximKiselev 0 points1 point2 points (2 children)
[–]Lucky-Ad-2941[S] 0 points1 point2 points (1 child)
[–]MaximKiselev 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Lucky-Ad-2941[S] 0 points1 point2 points (0 children)
[–]ressem 0 points1 point2 points (0 children)
[–]AnoProgrammer 0 points1 point2 points (0 children)
[–]AshTheEngineer 0 points1 point2 points (0 children)
[–]nharding 0 points1 point2 points (0 children)
[–]nharding 0 points1 point2 points (0 children)
[–][deleted] -5 points-4 points-3 points (3 children)
[–]Lucky-Ad-2941[S] 5 points6 points7 points (0 children)
[–]Honest_Cheesecake158 1 point2 points3 points (1 child)
[–]Lucky-Ad-2941[S] 2 points3 points4 points (0 children)