Accelerating Tree-Based Models in SQL with Orbital
I recently worked on improving the performance of tree-based models compiled to pure SQL in Orbital, an open-source tool that converts Scikit-Learn pipelines into executable SQL.
In the latest release (0.3), we changed how decision trees are translated, reducing generated SQL size by \~7x (from \~2M to \~300k characters) and getting up to \~300% speedups in real database workloads.
This blog post goes into the technical details of what changed and why it matters if you care about running ML inference directly inside databases without shipping models or Python runtimes.
Blog post:
https://posit.co/blog/orbital-0-3-0/
Learn about Orbital:
https://posit-dev.github.io/orbital/
Happy to answer questions or discuss tradeoffs
/r/Python
https://redd.it/1pqnxm5
I recently worked on improving the performance of tree-based models compiled to pure SQL in Orbital, an open-source tool that converts Scikit-Learn pipelines into executable SQL.
In the latest release (0.3), we changed how decision trees are translated, reducing generated SQL size by \~7x (from \~2M to \~300k characters) and getting up to \~300% speedups in real database workloads.
This blog post goes into the technical details of what changed and why it matters if you care about running ML inference directly inside databases without shipping models or Python runtimes.
Blog post:
https://posit.co/blog/orbital-0-3-0/
Learn about Orbital:
https://posit-dev.github.io/orbital/
Happy to answer questions or discuss tradeoffs
/r/Python
https://redd.it/1pqnxm5
Posit
Accelerating Tree-Based Models in SQL with Orbital 0.3.0 - Posit
Orbital 0.3.0 reduces query size and execution time of tree-based machine learning models in SQL.
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1pr052n
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1pr052n
Switching themes on the fly in Flask-Admin
This might be more of a general Python question, but: in Flask-Admin, according to the Introduction to Flask-Admin docs, you can use different themes by initializing the app with:
This isn't really documented; the entire docs for "theme" just say "theme – Base theme. Defaults to Bootstrap4Theme().", with nothing about what other themes might exist, how to find and install them, etc.
Regardless, the main question is: Is there an easy way to switch themes on the fly, e.g. on a per-user basis? "Click here for dark mode", or letting users configure it in a personalization step, that kind of thing? Or can this only be done for the entire app at the initialization stage?
/r/flask
https://redd.it/1pqsd5x
This might be more of a general Python question, but: in Flask-Admin, according to the Introduction to Flask-Admin docs, you can use different themes by initializing the app with:
admin = Admin(app, name='microblog', theme=Bootstrap4Theme(swatch='cerulean'))This isn't really documented; the entire docs for "theme" just say "theme – Base theme. Defaults to Bootstrap4Theme().", with nothing about what other themes might exist, how to find and install them, etc.
Regardless, the main question is: Is there an easy way to switch themes on the fly, e.g. on a per-user basis? "Click here for dark mode", or letting users configure it in a personalization step, that kind of thing? Or can this only be done for the entire app at the initialization stage?
/r/flask
https://redd.it/1pqsd5x
The offline geo-coder we all wanted
#### What is this project about
This is an offline, boundary-aware reverse geocoder in Python. It converts latitude–longitude coordinates into the correct administrative region (country, state, district) without using external APIs, avoiding costs, rate limits, and network dependency.
#### Comparison with existing alternatives
Most offline reverse geocoders rely only on nearest-neighbor searches and can fail near borders. This project validates actual polygon containment, prioritizing correctness over proximity.
#### How it works
A KD-Tree is used to quickly shortlist nearby administrative boundaries, followed by on-the-fly polygon enclosure validation. It supports both single-process and multiprocessing modes for small and large datasets.
#### Performance
Processes 10,000 coordinates in under 2 seconds, with an average validation time below 0.4 ms.
### Target audience
Anyone who needs to do geocoding
### Implementation
It was started as a toy implementation, turns out to be good on production too
The dataset covers 210+ countries with over 145,000 administrative boundaries.
Source code: https://github.com/SOORAJTS2001/gazetteer
Docs: https://gazetteer.readthedocs.io/en/stable
Feedback is welcome, especially on the given approach and edge cases
/r/Python
https://redd.it/1pr3bih
#### What is this project about
This is an offline, boundary-aware reverse geocoder in Python. It converts latitude–longitude coordinates into the correct administrative region (country, state, district) without using external APIs, avoiding costs, rate limits, and network dependency.
#### Comparison with existing alternatives
Most offline reverse geocoders rely only on nearest-neighbor searches and can fail near borders. This project validates actual polygon containment, prioritizing correctness over proximity.
#### How it works
A KD-Tree is used to quickly shortlist nearby administrative boundaries, followed by on-the-fly polygon enclosure validation. It supports both single-process and multiprocessing modes for small and large datasets.
#### Performance
Processes 10,000 coordinates in under 2 seconds, with an average validation time below 0.4 ms.
### Target audience
Anyone who needs to do geocoding
### Implementation
It was started as a toy implementation, turns out to be good on production too
The dataset covers 210+ countries with over 145,000 administrative boundaries.
Source code: https://github.com/SOORAJTS2001/gazetteer
Docs: https://gazetteer.readthedocs.io/en/stable
Feedback is welcome, especially on the given approach and edge cases
/r/Python
https://redd.it/1pr3bih
GitHub
GitHub - SOORAJTS2001/gazetteer: A fast offline, boundary aware reverse geocoding library in python
A fast offline, boundary aware reverse geocoding library in python - SOORAJTS2001/gazetteer
uv update recommendations
After adopting astral's uv last August, I did my first check for updates and found astral releases \-- pretty much non-stop.
What are other folks' experiences with updates? Is updating to the latest and greatest a good strategy, or is letting others "jump in the water" first prudent?
/r/Python
https://redd.it/1pqyzse
After adopting astral's uv last August, I did my first check for updates and found astral releases \-- pretty much non-stop.
What are other folks' experiences with updates? Is updating to the latest and greatest a good strategy, or is letting others "jump in the water" first prudent?
/r/Python
https://redd.it/1pqyzse
GitHub
Releases · astral-sh/uv
An extremely fast Python package and project manager, written in Rust. - astral-sh/uv
Elasticsearch-Grade Search, Zero Infrastructure — Just Django + Postgres
Elasticsearch-Grade Search, Zero Infrastructure — Just Django + Postgres
Native BM 25 search with PostgreSQL extension.
https://github.com/FarhanAliRaza/django-hawkeye
pip install django-hawkeye
/r/django
https://redd.it/1pqxqbv
Elasticsearch-Grade Search, Zero Infrastructure — Just Django + Postgres
Native BM 25 search with PostgreSQL extension.
https://github.com/FarhanAliRaza/django-hawkeye
pip install django-hawkeye
/r/django
https://redd.it/1pqxqbv
GitHub
GitHub - FarhanAliRaza/django-hawkeye: Django BM25 full-text search using PostgreSQL - a lightweight Elasticsearch alternative
Django BM25 full-text search using PostgreSQL - a lightweight Elasticsearch alternative - FarhanAliRaza/django-hawkeye
Would you use this instead of Electron for a real project? (Python desktop GUI)
I’ve tried building small desktop apps in Python multiple times. Every time it ended the same way: frameworks felt heavy and awkward, like Electron felt exrteamly overkill. Even when things worked, apps were big and startup was slow (most of them). so I started experimenting with a different approach and created my own, I tried to focus on performance and on making the developer experience as simple as possible. It's a desktop framework that lets you build fast native apps using Python as a backend (with optional React/Vite, python or just html/js/css for the UI)
I’m actively collecting early feedback. Would you try taupy in a real project?
Why or why not? I just really need your honest opinion and any advice you might have
git - https://github.com/S1avv/taupy
small demo - https://github.com/S1avv/taupy-focus
Even a short answer helps. Critical feedback is very welcome.
/r/Python
https://redd.it/1pqu2wu
I’ve tried building small desktop apps in Python multiple times. Every time it ended the same way: frameworks felt heavy and awkward, like Electron felt exrteamly overkill. Even when things worked, apps were big and startup was slow (most of them). so I started experimenting with a different approach and created my own, I tried to focus on performance and on making the developer experience as simple as possible. It's a desktop framework that lets you build fast native apps using Python as a backend (with optional React/Vite, python or just html/js/css for the UI)
I’m actively collecting early feedback. Would you try taupy in a real project?
Why or why not? I just really need your honest opinion and any advice you might have
git - https://github.com/S1avv/taupy
small demo - https://github.com/S1avv/taupy-focus
Even a short answer helps. Critical feedback is very welcome.
/r/Python
https://redd.it/1pqu2wu
GitHub
GitHub - S1avv/taupy: A modern desktop framework for Python.
A modern desktop framework for Python. Contribute to S1avv/taupy development by creating an account on GitHub.
Monkey Patching is hell. So I built a Mixin/Harmony-style Runtime AST Injector for Python.
**What My Project Does**
"Universal Modloader" (UML) is a runtime patching framework that allows you to inject code, modify logic, and overhaul applications **without touching the original source code**.
Instead of fragile monkey-patching or rewriting entire files, UML parses the target's source code at runtime and injects code directly into the Abstract Syntax Tree (AST) before execution.
This allows you to:
* Intercept and modify local variables inside functions (which standard decorators cannot do).
* Add logic to the beginning (HEAD) or end (TAIL) of functions.
* Overwrite return values or arguments dynamically.
**Target Audience**
This project is intended for **Modders, Researchers, and Hobbyists**.
* **For Modders:** If you want to mod a Python game or tool but the source is hard to manage, this acts like a BepInEx/Harmony layer.
* **For Researchers:** Useful for chaos engineering, time-travel debugging, or analyzing internal states without altering files.
**WARNING:** By design, this enables Arbitrary Code Execution and modifies the interpreter's state. **It is NOT meant for production environments.** Do not use this to patch your company's production server unless you enjoy chaos.
**Comparison**
How does this differ from existing solutions?
* **VS Standard Decorators:** Decorators wrap functions but cannot access or modify *internal local variables* within the function scope. UML can.
* **VS Monkey Patching:** Standard monkey
/r/Python
https://redd.it/1prf4zd
**What My Project Does**
"Universal Modloader" (UML) is a runtime patching framework that allows you to inject code, modify logic, and overhaul applications **without touching the original source code**.
Instead of fragile monkey-patching or rewriting entire files, UML parses the target's source code at runtime and injects code directly into the Abstract Syntax Tree (AST) before execution.
This allows you to:
* Intercept and modify local variables inside functions (which standard decorators cannot do).
* Add logic to the beginning (HEAD) or end (TAIL) of functions.
* Overwrite return values or arguments dynamically.
**Target Audience**
This project is intended for **Modders, Researchers, and Hobbyists**.
* **For Modders:** If you want to mod a Python game or tool but the source is hard to manage, this acts like a BepInEx/Harmony layer.
* **For Researchers:** Useful for chaos engineering, time-travel debugging, or analyzing internal states without altering files.
**WARNING:** By design, this enables Arbitrary Code Execution and modifies the interpreter's state. **It is NOT meant for production environments.** Do not use this to patch your company's production server unless you enjoy chaos.
**Comparison**
How does this differ from existing solutions?
* **VS Standard Decorators:** Decorators wrap functions but cannot access or modify *internal local variables* within the function scope. UML can.
* **VS Monkey Patching:** Standard monkey
/r/Python
https://redd.it/1prf4zd
Reddit
From the Python community on Reddit: Monkey Patching is hell. So I built a Mixin/Harmony-style Runtime AST Injector for Python.
Explore this post and more from the Python community
[Project] Pyrium – A Server-Side Meta-Loader & VM: Script your server in Python
I wanted to share a project I’ve been developing called **Pyrium**. It’s a server-side meta-loader designed to bring the ease of Python to Minecraft server modding, but with a focus on performance and safety that you usually don't see in noscripting solutions.
# 🚀 "Wait, isn't Python slow?"
That’s the first question everyone asks. Pyrium does **not** run a slow CPython interpreter inside your server. Instead, it uses a custom **Ahead-of-Time (AOT) Compiler** that translates Python code into a specialized instruction set called **PyBC (Pyrium Bytecode)**.
This bytecode is then executed by a highly optimized, Java-based **Virtual Machine** running inside the JVM. This means you get Python’s clean syntax but with execution speeds much closer to native Java/Lua, without the overhead of heavy inter-process communication.
# 🛡️ Why use a VM-based approach?
Most server-side noscripts (like Skript or Denizen) or raw Java mods can bring down your entire server if they hit an infinite loop or a memory leak.
* **Sandboxing:** Every Pyrium mod runs in its own isolated VM instance.
* **Determinism:** The VM can monitor instruction counts. If a mod starts "misbehaving," the VM can halt it without affecting the main server thread.
* **Stability:** Mods are isolated from the JVM and each other.
# 🎨 Automatic Asset Management (The ResourcePackBuilder)
One of the biggest pains in server-side modding
/r/Python
https://redd.it/1prasf0
I wanted to share a project I’ve been developing called **Pyrium**. It’s a server-side meta-loader designed to bring the ease of Python to Minecraft server modding, but with a focus on performance and safety that you usually don't see in noscripting solutions.
# 🚀 "Wait, isn't Python slow?"
That’s the first question everyone asks. Pyrium does **not** run a slow CPython interpreter inside your server. Instead, it uses a custom **Ahead-of-Time (AOT) Compiler** that translates Python code into a specialized instruction set called **PyBC (Pyrium Bytecode)**.
This bytecode is then executed by a highly optimized, Java-based **Virtual Machine** running inside the JVM. This means you get Python’s clean syntax but with execution speeds much closer to native Java/Lua, without the overhead of heavy inter-process communication.
# 🛡️ Why use a VM-based approach?
Most server-side noscripts (like Skript or Denizen) or raw Java mods can bring down your entire server if they hit an infinite loop or a memory leak.
* **Sandboxing:** Every Pyrium mod runs in its own isolated VM instance.
* **Determinism:** The VM can monitor instruction counts. If a mod starts "misbehaving," the VM can halt it without affecting the main server thread.
* **Stability:** Mods are isolated from the JVM and each other.
# 🎨 Automatic Asset Management (The ResourcePackBuilder)
One of the biggest pains in server-side modding
/r/Python
https://redd.it/1prasf0
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
How a try-except stole hours of our debugging time, or why Django signals went silent.
/r/django
https://redd.it/1prb6ge
/r/django
https://redd.it/1prb6ge
Confused About Django Project Structure: Traditional vs Service–Repository — Which One Should I Use?
Hi everyone,
I’m working on a Django project and I’m confused about which project structure is best to follow.
I see multiple approaches:
Traditional Django structure (models, views, urls, etc.)
Service + Repository pattern
Controller-based or layered structure
I want to understand:
When should I stick with the traditional Django approach?
At what point does using services and repositories make sense?
Is it over-engineering for small or medium projects?
I’d really appreciate advice from people who’ve worked on real-world Django projects.
/r/django
https://redd.it/1prgz0j
Hi everyone,
I’m working on a Django project and I’m confused about which project structure is best to follow.
I see multiple approaches:
Traditional Django structure (models, views, urls, etc.)
Service + Repository pattern
Controller-based or layered structure
I want to understand:
When should I stick with the traditional Django approach?
At what point does using services and repositories make sense?
Is it over-engineering for small or medium projects?
I’d really appreciate advice from people who’ve worked on real-world Django projects.
/r/django
https://redd.it/1prgz0j
Reddit
From the django community on Reddit
Explore this post and more from the django community