r/Python • • Feb 28 '26

Daily Thread Saturday Daily Thread: Resource Request and Sharing! Daily Thread

3 Upvotes

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 • • Feb 28 '26

Showcase Distill the Flow: Pure Python Token Forensic Processing pipeline and Clearner

0 Upvotes

What My Project Does:

So as I posted last night and have now followed through on, Moonshine/Distill-The-Flow is now public reproducible code ready for any exports over analysis and visual pipelines to clean chat format style .json and .jsonl large structured exports. Drop 3, is not a dataset or single output, but through a global database called the "mash" we were able to stream multi provider different format exports into seperate database cleaned stores, .parquet rows, and then a global db that is added to every new cleaned provider output. The repository also contains a suite of visual analysis some of which directly measure model sycophancy and "malicious-compliance" which is what I propose happens due to current safety policies. It becomes safer for a model to continue a conversation and pretend to help, rather than risk said user starting new instance or going to new provider. This isnt claimed hypothesis with weight but rather a side analysis. All data is Jan 2025-Feb 2026 over one-year. These are not average chat exports. Just as with every other release, there is some configuration on user side to actually get running, as these are tools not standalone systems ready to run as it is, but to be utilized by any workflow. The current pipeline plus four providers spread over one year and a month was able to produce/output a "cleaned/distilled" count of 2,788 conversations, 179,974 messages, 122 million tokens, full scale visual analysis, and md forensic reports. One of the most important things checked for and cleaned out from the being added to the main "mash" .db is sycophancy and malicious compliance spread across 5 periods. Based on best hypothesis p3--> is when gpt5 and claude 4 released, thus introducing the new and current routing based era. These visuals are worthy of standalone presentation, so, even if you have no use directly through the reports and visuals gained from the pipeline against my over one-year of data exports, you may learn something in your own domain, especially with how relevant model sycophancy is now.

Expanded Context:

Distill-The-Flow is not a dataset nor marketed as such. The overlap between anthropic, openAI, and deepseek/MiniMax/etc is pure coincidence. This is in reference to the recent distillation attacks claimed by industry leaders extracting model capabilities through distilling. This is drop 3 of the planned Operation SOTA Toolkit in which through open sourcing industry standard and sota tier developments that are artificially gatekept from the oss community by the industry. This is not promotion of service, paid software or anything more than serving as announcement of release.

Repo-Quick-Clone:

https://github.com/calisweetleaf/distill-the-flow

Moonshine is a state of the art chat export Token Forensic analysis and cleaningpipeline for multi scaled analysis the meantime, Aeron which is an older system I worked on the side during my recursive categorical framework, has been picked to serve as a representational model for Project SOTA and its mission of decentralizing compute and access to industry grade tooling and developments. Aeron is a novel "transformer" that implements direct true tree of thought before writing to an internal scratchpad, giving aeron engineered reasoning not trained. Aeron also implements 3 new novel memory and knowledge context modules. There is no code or model released yet, however I went ahead to establish the canon repo's as both are clos

Now Project Moonshine, or Distill the Flow as formally titled follows after drop one of operation sota the rlhf pipeline with inference optimizations and model merging. That was then extended into runtime territory with Drop two of the toolkit,

Now Drop 4 has already been planned and is also getting close. Aeron is a novel transformer chosen to speerhead and demonstrate the capabilities of the toolkit drops, so it is taking longer with the extra RL and now Moonshine and its implications. Feel free to also dig through the aeron repo and its documents and visuals.

Aeron Repo:

Target Audience and Motivations:

The infrastructure for modern Al is beina hoarded The same companies that trained on the open wel now gate access to the runtime systems that make heir models useful. This work was developed alongside the recursion/theoretical work aswell This toolkit project started with one single goal decentralize compute and distribute back advancements to level the field between SaaS and OSS

Extra Notes:

Thank you all for your attention and I hope these next drops of the toolkit get yall as excited as I am. It will not be long before release of distill-the-flow but aeron is being ran through the same rlhf pipeline and inference optimizations from drop 1 of the toolkit along with a novel training technique. Please check up on the repos as soon distill-the-flow will release with aeron soon to follow. Please feel free to engage, message me if needed, or ask any questions you may have. This is not a promotion, this is an announcement and I would be more than happy to answer any questions you may have and I may would if interested, potentially show internal only logs and data from both aeron and distill the flow. Feel free to message/dm me, email me at the email in my Github with questions or collaboration. This is not a promotional post, this announcement/update of yet another drop in the toolkit to decentralize compute.

License:

All repos and their contents use the Anti-Exploit License:

somnus-license


r/Python • • Feb 27 '26

Showcase Meet geodistpy - Fast & Accurate Geospatial Distance Lib

1 Upvotes

Hi folks 👋 I built geodistpy, a high-performance Python library for lightning-fast geospatial distance computations. It’s 100x(+) faster than geopy and geographiclib(current alternatives). It’s production-ready and available on PyPI now.

* GitHub: https://github.com/pawangeek/geodistpy

* Docs: https://pawangeek.github.io/geodistpy/

* PyPI: https://pypi.org/project/geodistpy/

🧠 What My Project Does

geodistpy computes ellipsoidal geodesic distances (and related spatial functions) between coords.

🎯 Target Audience

Designed for developers working on GIS, routing, logistics, clustering, real-time geo analytics, or any project with heavy distance computations. Great when performance matters more than simple wrappers alone. 

⚖️ Comparison

Vs Geopy / Geographiclib:

• 100x+ Orders of magnitude faster thanks to Numba optimization.

• Maintains competitive accuracy (Vincenty \~9 µm mean error vs Geographiclib).

• Extra utility functions (bearing, destination, interpolate


r/Python • • Feb 27 '26

Showcase [Project] NinoClicker v2.2: macOS High-Frequency Input Injection via Quartz CoreGraphics

2 Upvotes

What My Project Does: NinoClicker is a macOS-native automation tool that uses the Quartz framework to perform direct hardware-level mouse event injection. It features a "Ghost HUD" telemetry overlay (built with PyQt6) that allows users to monitor Engine Load and CPS (Clicks Per Second) in real-time. It includes a "Global Panic" switch and "Ghost Mode" visibility toggles using HIDSystemState listeners.

Target Audience: This is currently a toy project/proof-of-concept for developers interested in macOS-specific input handling and UI overlays that bypass window focus-trapping. It’s perfect for testing stability in high-input environments (like clicker games).

Comparison: Unlike standard cross-platform libraries like pyautogui or pynput, which often suffer from input lag and "focus stealing" on macOS, NinoClicker uses:

  1. Direct Quartz Injection: Bypasses the standard event loop for higher CPS (20k+).
  2. WindowTransparentForInput: Allows the HUD to be visible without intercepting clicks meant for the background application.
  3. HIDSystemState Hotkeys: Ensures the panic switch works even when the app isn't the "active" window.

Yes thats not how you write it ↓

Source Code:https://github.com/NinoTheNoob/Auto-Cliker

Verification/Proof : https://imgur.com/a/JDM29FT


r/Python • • Feb 27 '26

Showcase I replaced docker-compose.yml and Terraform with Python type hints and a project.py file

0 Upvotes

What My Project Does

If you have a Pydantic model like this:

from pydantic import BaseModel, PostgresDsn

class Settings(BaseModel):
    psql_uri: PostgresDsn

Why do you still have to manually spin up Postgres, write a docker-compose.yml, and wire up env vars yourself? The type hint already tells you everything you need.

takk reads your Pydantic settings models, infers what infrastructure you need, spins up the right containers, and generates your Dockerfile automatically. No YAML, no copy-pasting connection strings, no manual orchestration.

It also parses your uv.lock to detect your database driver and generate the correct connection string. So you won't waste hours debugging the postgresql:// vs postgresql+asyncpg:// mismatch like I did.

Your entire app structure lives in a single project.py:

from takk import Project, FastAPIApp, Job

project = Project(
    name="my-app",
    shared_secrets=[Settings],
    server=FastAPIApp(secrets=[CacheSettings]),
    weekly_job=Job(jobs.run, cron_schedule="0 0 * * FRI")
)

Run takk up and it spins everything up. Postgres, S3 (via Localstack), your FastAPI server, background workers, with no port conflicts and no env files to manage.

Target Audience

Small to mid-sized Python teams who want to move fast without a dedicated DevOps engineer. It's production-ready, as the blog post linked below is itself hosted on a server deployed this way. That said, it's still in early/beta stages, so probably not the right fit yet for large orgs with complex existing infra.

Comparison

- vs. docker-compose: No YAML. Resources are inferred from your type hints rather than declared manually. Ports, connection strings, and credentials are handled automatically.

- vs. Terraform: No HCL, no state files. Infrastructure is expressed in Python using the same Pydantic models your app already uses.

- vs. plain Pydantic + dotenv: You still get full Pydantic validation, but you no longer need to maintain separate env files or worry about which variables map to which services.

The core idea is that your type hints are already a description of your dependencies. takk just acts on that.

Blog post with the full writeup: https://takk.dev/blog/deploy-with-python-type-hints

Source / example app in Gitlab


r/Python • • Feb 27 '26

Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays

3 Upvotes

Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

How it Works:

  1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
  2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
  3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

Guidelines:

Example Topics:

  1. New Python Release: What do you think about the new features in Python 3.11?
  2. Community Events: Any Python meetups or webinars coming up?
  3. Learning Resources: Found a great Python tutorial? Share it here!
  4. Job Market: How has Python impacted your career?
  5. Hot Takes: Got a controversial Python opinion? Let's hear it!
  6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟


r/Python • • Feb 26 '26

Discussion Trending pypi packages on StackTCO

6 Upvotes

https://www.stacktco.com/py/trends

You can even filter by Ecosystem (e.g. NumPy, Django, Jupyter etc.)

Any Ecosystems missing from the top navigation?


r/Python • • Feb 26 '26

Showcase I built appium-pytest-kit: a plugin-first Appium + pytest starter kit for mobile automation

1 Upvotes

Hi r/Python,

I kept running into the same problem every time I started a new Appium mobile automation project: the first days were spent on setup and framework glue (config, device selection, waits/actions, CI ergonomics) before I could write real tests.

So I built and published appium-pytest-kit.

What My Project Does

- Provides ready-to-use pytest fixtures (driver, waits, actions, page/page-factory style helpers)

- Scaffolds a working starter project with one command

- Includes a “doctor” CLI to validate your environment

- Adds common mobile actions (tap/type/swipe/scroll, context switching) and app lifecycle helpers

- Improves failure debugging (clearer wait errors + automatic artifacts like screenshot/page source/logs)

- Supports practical execution modes for local vs CI, plus retries and parallel execution

- Designed to be easy to extend with your own fixtures/plugins/actions without forking the whole thing

Target Audience

- QA engineers / automation engineers using Python

- Teams building production mobile test suites with Appium 2.x + pytest

- People who want a solid starting point instead of assembling a framework from scratch

Comparison

- Versus “Appium Python client + pytest from scratch”: this removes most of the boilerplate and gives you sensible defaults (fixtures, structure, diagnostics) so you start writing scenarios earlier.

- Versus random sample repos/tutorial frameworks: those are often demo-focused or inconsistent; this aims to be reusable and maintainable across real projects.

- Versus Robot Framework / other higher-level wrappers: those can be great if you prefer keyword-driven tests; this is for teams that want to stay in Python/pytest and extend behavior in code.

Quickstart:

pip install appium-pytest-kit

appium-pytest-kit-init --framework --root my-project

Links:

PyPI: https://pypi.org/project/appium-pytest-kit/

GitHub: https://github.com/gianlucasoare/appium-pytest-kit

Disclosure: I’m the author. I’d love feedback on defaults, structure, and what would make it easier to adopt in CI.


r/Python • • Feb 26 '26

Showcase ytmpcli - a free open source way to quickly download mp3/mp4

12 Upvotes
  • What My Project Does

    • so i've been collecting songs majorly from youtube and curating a local list since 2017, been on and off pretty sus sites, decided to create a personal OSS where i can quickly paste links & get a download.
    • built this primarily for my own collection workflow, but it turned out clean enough that I thought i’d share it with y'all. one of the best features is quick link pastes/playlist pastes to localize it, another one of my favorite use cases is getting yt videos in a quality you want using the res command in the cli.
  • Target Audience (e.g., Is it meant for production, just a toy project, etc.)

    • its a personal toy project
  • Comparison (A brief comparison explaining how it differs from existing alternatives.)

    • there are probably multiple that exist, i'm posting my personal minimalistic mp3/mp4 downloader, cheers!

https://github.com/NamikazeAsh/ytmpcli

(I'm aware yt-dlp exists, this tool uses yt-dlp as the backend, it's mainly for personal convenience for faster pasting for music, videos, playlists!)


r/Python • • Feb 26 '26

Showcase I'm tired of guessing keys and refactoring string paths, so I wrote a small type-safe alternative

0 Upvotes

Hi everyone,

I wanted to share a small package I wrote called py-keyof to scratch an itch I’ve had for a long time: the inability to statically type-check keys or property paths in Python.

It's all fun and games to write getattr(x, "name"), until you remove "name" from the attributes of x and get zero warnings for doing so. You're in for an unpleasant alert at 3AM and a broken prod.

PyPI: https://pypi.org/project/py-keyof/ GitHub: https://github.com/eyusd/keyof

What My Project Does

py-keyof replaces string-based property access with a more type-safe lambda approach.

Instead of passing a string path like "address.city", you pass a lambda: KeyOf(lambda x: x.address.city).

  1. At Runtime: It uses a proxy object to record the path you accessed and gives you a usable path object (which can also be serialized to strings, JSONPath, etc).
  2. At Type-Checking Time: Because it uses standard Python syntax, tools like Pylance, Pyright, and Mypy can validate that the attribute actually exists on the model.

Target Audience

This is meant for developers who rely heavily on type hints and static analysis (Pylance/Pyright) to keep their codebases maintainable. It is production-ready, but it's most useful for library authors or backend developers building generic tools (like data tables, ORMs, or filtering engines) where you want to allow developers to specify fields without losing type safety.

Comparison

  • VS Magic Strings: If you use strings ("user.name"), your IDE cannot help you. If you rename the field, your code breaks at runtime. With a KeyOf, if you rename it, your IDE will flag the error.
  • VS operator.attrgetter: While attrgetter is standard, it doesn't offer generic inference or deep path autocompletion in IDEs out of the box.
  • VS pydantic.Field: Pydantic is great for defining models, but doesn't solve the problem of referring to those fields dynamically in other parts of your code (like sorting functions) in a type-safe way.

Example: Generics Inference

This is why I started it all, and where it shines. If you have a generic class, the type checker infers T automatically, so you get autocompletion inside the lambda without extra annotations, just like in TS.

from typing import TypeVar, Generic, List
from dataclasses import dataclass
from keyof import KeyOf

T = TypeVar("T")

class Table(Generic[T]):
def __init__(self, items: List[T]):
self.items = items

def sort_by(self, key: KeyOf[T]):
# Runtime: Extract the value using the path
self.items.sort(key=lambda item: key.from_(item))

# --- Usage ---

@dataclass
class User:
id: int
name: str

users = Table([User(1, "Alice"), User(2, "Bob")])

# 1. T is automatically inferred as User
# 2. Your IDE autocompletes '.name' inside the lambda
# 3. Refactoring 'name' in the class automatically updates this line
users.sort_by(KeyOf(lambda u: u.name))

# ❌ Static Type Error: 'User' has no attribute 'email'
# users.sort_by(KeyOf(lambda u: u.email))

It supports dictionaries, lists, and deep nesting (lambda x: x.address.city). It’s a small utility, but it makes safe refactoring much easier.

I don't know if this has been done somewhere else, or if there's a better way than using lambdas to type-check paths, so if you have any feedback on this, I'd be happy to hear what you think!


r/Python • • Feb 26 '26

Discussion Python Android installation

0 Upvotes

Is there any ways to install python on Android system wide ? I'm curious. Also I can install it through termux but it only installs on termux.


r/Python • • Feb 25 '26

Discussion Python Type Checker Comparison: Empty Container Inference

38 Upvotes

Empty containers like [] and {} are everywhere in Python. It's super common to see functions start by creating an empty container, filling it up, and then returning the result.

Take this, for example:

def my_func(ys: dict[str, int]):
  x = {}
  for k, v in ys.items():
    if some_condition(k):
      x.setdefault("group0", []).append((k, v))
    else:
      x.setdefault("group1", []).append((k, v))
  return x

This seemingly innocent coding pattern poses an interesting challenge for Python type checkers. Normally, when a type checker sees x = y without a type hint, it can just look at y to figure out x's type. The problem is, when y is an empty container (like x = {} above), the checker knows it's a dict, but has no clue what's going inside.

The big question is: How is the type checker supposed to analyze the rest of the function without knowing x's type?

Different type checkers implement distinct strategies to answer this question. This blog will examine these different approaches, weighing their pros and cons, and which type checkers implement each approach.

Full blog: https://pyrefly.org/blog/container-inference-comparison/


r/Python • • Feb 25 '26

Tutorial OAuth 2.0 in CLI Apps written in Python

15 Upvotes

https://jakabszilard.work/posts/oauth-in-python

I was creating a CLI app in Python that needed to communicate with an endpoint that needed OAuth 2.0, and I've realized it's not as trivial as I thought, and there are some additional challenges compared to a web app in the browser in terms of security and implementation. After some research I've managed to come up with an implementation, and I've decided to collect my findings in a way that might end up being interesting / useful for others.