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.


r/Python • • Feb 26 '26

Daily Thread Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

3 Upvotes

Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.


How it Works:

  1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
  2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
  3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

Guidelines:

  • This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
  • Keep discussions relevant to Python in the professional and educational context.

Example Topics:

  1. Career Paths: What kinds of roles are out there for Python developers?
  2. Certifications: Are Python certifications worth it?
  3. Course Recommendations: Any good advanced Python courses to recommend?
  4. Workplace Tools: What Python libraries are indispensable in your professional work?
  5. Interview Tips: What types of Python questions are commonly asked in interviews?

Let's help each other grow in our careers and education. Happy discussing! 🌟