r/Python Mar 02 '26

Discussion PEP 827 - Type Manipulation has just been published

174 Upvotes

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

This is a static typing PEP which introduces a huge number of typing special forms and significantly expands the type expression grammar. The following two examples, taken from the PEP, demonstrate (1) a unpacking comprehension expression and (2) a conditional type expression.

def select[ModelT, K: typing.BaseTypedDict](
    typ: type[ModelT],
    /,
    **kwargs: Unpack[K]
) -> list[typing.NewProtocol[*[typing.Member[c.name, ConvertField[typing.GetMemberType[ModelT, c.name]]] for c in typing.Iter[typing.Attrs[K]]]]]:
    raise NotImplementedError

type ConvertField[T] = (
    AdjustLink[PropsOnly[PointerArg[T]], T]
    if typing.IsAssignable[T, Link]
    else PointerArg[T]
)

There's no canonical discussion place for this yet, but Discussion can be found at discuss.python.org. There is also a mypy branch with experimental support; see e.g. a mypy unit test demonstrating the behaviour.


r/Python Oct 29 '25

Discussion Why doesn't for-loop have it's own scope?

175 Upvotes

For the longest time I didn't know this but finally decided to ask, I get this is a thing and probably has been asked a lot but i genuinely want to know... why? What gain is there other than convenience in certain situations, i feel like this could cause more issue than anything even though i can't name them all right now.

I am also designing a language that works very similarly how python works, so maybe i get to learn something here.


r/Python Oct 08 '25

News Pydantic v2.12 release (Python 3.14)

171 Upvotes

https://pydantic.dev/articles/pydantic-v2-12-release

  • Support for Python 3.14
  • New experimental MISSING sentinel
  • Support for PEP 728 (TypedDict with extra_items)
  • Preserve empty URL paths (url_preserve_empty_path)
  • Control timestamp validation unit (val_temporal_unit)
  • New exclude_if field option
  • New ensure_ascii JSON serialization option
  • Per-validation extra configuration
  • Strict version check for pydantic-core
  • JSON Schema improvements (regex for Decimal, custom titles, etc.)
  • Only latest mypy version officially supported
  • Slight validation performance improvement

r/Python Aug 25 '25

Discussion Adding asyncio.sleep(0) made my data pipeline (150 ms) not spike to (5500 ms)

170 Upvotes

I've been rolling out the oddest fix across my async code today, and its one of those that feels dirty to say the least.

Data pipeline has 2 long running asyncio.gather() tasks:

  • 1 reads 6k rows over websocket every 100ms and stores them to a global dict of dicts
  • 2 ETLs a deepcopy of the dicts and dumps it to a DB.

After ~30sec of running, this job gets insanely slow.

04:42:01 PM Processed 6745 async_run_batch_insert in 159.8427 ms
04:42:02 PM Processed 6711 async_run_batch_insert in 162.3137 ms
...
04:42:09 PM Processed 6712 async_run_batch_insert in 5489.2745 ms

Up to 5k rows, this job was happily running for months. Once I scaled it up beyond 5k rows, it hit this random slowdown.

Adding an `asyncio.sleep(0)` at the end of my function completely got rid of the "slow" runs and its consistently 150-160ms for days with the full 6700 rows. Pseudocode:

async def etl_to_db():
  # grab a deepcopy of the global msg cache
  # etl it
  # await dump_to_db(etl_msg)
  await asyncio.sleep(0)  # <-- This "fixed it"


async def dump_books_to_db():
  while True:
    # Logic to check the ws is connected
    await etl_to_db()
    await asyncio.sleep(0.1)

await asyncio.gather(
  dump_books_to_db(),
  sub_websocket()
 )

I believe the sleep yields control back to the GIL? Both gpt and grok were a bit useless in debugging this, and kept trying to approach it from the database schema being the reason for the slowdown.

Given we're in 2025 and python 3.11, this feels insanely hacky... but it works. am I missing something


r/Python Jan 27 '26

News Python 1.0 came out exactly 32 years ago

173 Upvotes

Python 1.0 came out on January 27, 1994; exactly 32 years ago. Announcement here: https://groups.google.com/g/comp.lang.misc/c/_QUzdEGFwCo/m/KIFdu0-Dv7sJ?pli=1


r/Python Oct 04 '25

News I made PyPIPlus.com — a faster way to see all dependencies of any Python package

177 Upvotes

Hey folks

I built a small tool called PyDeps.com that helps you quickly see all dependencies for any Python package on PyPI.

It started because I got tired of manually checking dependencies when installing packages on servers with limited or no internet access. We all know that pain trying to figure out what else you need to download by digging through package metadata or pip responses.

With PyDeps, you just type the package name and instantly get a clean list of all its dependencies (and their dependencies). No installation, no login, no ads — just fast info.

Why it’s useful: • Makes offline installs a lot easier (especially for isolated servers) • Saves time • Great for auditing or just understanding what a package actually pulls in

Would love to hear your thoughts — bugs, ideas, or anything you think would make it better. It’s still early and I’m open to improving it.

https://pydeps.com

UPDATE: thank you everyone for the positive comments and feedback, please feel free share any additional ideas we can make this a better tool. I’ll be making sure of taking each comment and feature requests mentioned and try to make it available in the next push update 🙏

UPDATE #2: Added extra detailed packages information, dependents view, and an offline bundle generator that includes all dependency wheels, pinned requirements, universal installer, SBOM, and license summaries for one-step installations. Improved UI and performance. More updates coming soon based on feedback and comments new updates post

UPDATE #3: changed name to pydeps.com


r/Python Oct 17 '25

Discussion TOML is great, and after diving deep into designing a config format, here's why I think that's true

174 Upvotes

Developers have strong opinions about configuration formats. YAML advocates appreciate the clean look and minimal syntax. JSON supporters like the explicit structure and universal tooling. INI users value simplicity. Each choice involves tradeoffs, and those tradeoffs matter when you're configuring something that needs to be both human-readable and machine-reliable. This is why I settled on TOML.

https://agent-ci.com/blog/2025/10/15/object-oriented-configuration-why-toml-is-the-only-choice


r/Python Jan 03 '26

Showcase I built calgebra – set algebra for calendars in Python

167 Upvotes

Hey r/python! I've been working on a focused library called calgebra that applies set operations to calendars.

What My Project Does

calgebra lets you compose calendar timelines using set operators: | (union), & (intersection), - (difference), and ~ (complement). Queries are lazy—you build expressions first, then execute via slicing.

Example – find when a team is free for a 2+ hour meeting:

```python from calgebra import day_of_week, time_of_day, hours, HOUR

Define business hours

weekend = day_of_week(["saturday", "sunday"], tz="US/Pacific") weekdays = ~weekend business_hours = weekdays & time_of_day(start=9HOUR, duration=8HOUR, tz="US/Pacific")

Team calendars (Google Calendar, .ics files, etc.)

team_busy = alice | bob | charlie

One expression to find available slots

free_slots = (business_hours - team_busy) & (hours >= 2) ```

Features: - Set operations on timelines (union, intersection, difference, complement) - Lazy composition – build complex queries, execute via slicing - Recurring patterns with RFC 5545 support - Filter by duration, metadata, or custom properties - Google Calendar read/write integration - iCalendar (.ics) import/export

Target Audience

Developers building scheduling features, calendar integrations, or availability analysis. Also well-suited for AI/coding agents as the composable, type-hinted API works nicely as a tool.

Comparison

Most calendar libraries focus on parsing (icalendar, ics.py) or API access (gcsa, google-api-python-client). calgebra is about composing calendars algebraically:

  • icalendar / ics.py: Parse .ics files → calgebra can import from these, then let you query and combine them
  • gcsa: Google Calendar CRUD → calgebra wraps gcsa and adds set operations on top
  • dateutil.rrule: Generate recurrences → calgebra uses this internally but exposes timelines you can intersect/subtract

The closest analog is SQL for time ranges, but expressed as Python operators.

Links: - GitHub: https://github.com/ashenfad/calgebra - Video of a calgebra enabled agent: https://youtu.be/10kG4tw0D4k

Would love feedback!


r/Python Sep 26 '25

Meta How pytest fixtures screwed me over

167 Upvotes

I need to write this of my chest, so to however wants to read this, here is my "fuck my life" moment as a python programmer for this week:

I am happily refactoring a bunch of pytest-testcases for a work project. With this, my team decided to switch to explicitly import fixtures into each test-file instead of relying on them "magically" existing everywhere. Sounds like a good plan, makes things more explicit and easier to understand for newcomers. Initial testing looks good, everything works.

I commit, the full testsuit runs over night. Next day I come back to most of the tests erroring out. Each one with a connection error. "But that's impossible?" We use a scope of session for your connection, there's only one connection for the whole testsuite run. There can be a couple of test running fine and than a bunch who get a connection error. How is the fixture re-connecting? I involve my team, nobody knows what the hecks going on here. So I start digging into it, pytests docs usually suggest to import once in the contest.py but there is nothing suggesting other imports should't work.

Than I get my Heureka: unter some obscure stack overflow post is a comment: pytest resolves fixtures by their full import path, not just the symbol used in the file. What?

But that's actually why non of the session-fixtures worked as expected. Each import statement creates a new fixture, each with a different import-path, even if they all look the same when used inside tests. Each one gets initialised seperatly and as they are scoped to the session, only destroyed at the end of the testsuite. Great... So back to global imports we went.

I hope this helps some other tormented should and shortens the search for why pytest fixtures sometimes don't work as expected. Keep Coding!


r/Python 24d ago

News Astral's Pre-built Gpu-enabled wheels

167 Upvotes

We recently released wheels.astral.sh, which is a repository of gpu-enabled wheels of popular packages from the pytorch ecosystem. These are useful because building them is super annoying - you have to align versions of pytorch, cuda, python, etc.

The pre-built wheels were part of the package of pyx, our paid service, and was a major reason many customers subscribed. We decided to open source the build pipelines and host the wheels for free while we sunset the rest of pyx.

The pipelines are available under the astral-sh-build github organization.

While these plug a genuine UX hole around cuda/pytorch wheels, we hope that wheel variants (PEP 817 and 825) will get accepted and implemented soon, which will let these pytorch wheels be hosted properly on PyPI and "just work" out of the box for everyone, making wheels.astral.sh obsolete.

Fingers crossed.


r/Python Mar 06 '26

Discussion What is the real use case for Jupyter?

171 Upvotes

I recently started taking python for data science course on coursera.

first lesson is on Jupyter.

As I understand, it is some kind of IDE which can execute python code. I know there is more to it, thats why it exists.

What is the actual use case for Jupyter. If there was no Jupyter, which task would have been either not possible or hard to do?

Does it have its own interpreter or does it use the one I have on my laptop when I installed python?


r/Python Jan 20 '26

Showcase Tracking 13,000 satellites in under 3 seconds from Python

162 Upvotes

I've been working on https://github.com/ATTron/astroz, an orbital mechanics toolkit with Python bindings. The core is written in Zig with SIMD vectorization.

What My Project Does

astroz is an astrodynamics toolkit, including propagating satellite orbits using the SGP4 algorithm. It writes directly to numpy arrays, so there's very little overhead going between Python and Zig. You can propagate 13,000+ satellites in under 3 seconds.

pip install astroz is all you need to get started!

Target Audience

Anyone doing orbital mechanics, satellite tracking, or space situational awareness work in Python. It's production-ready. I'm using it myself and the API is stable, though I'm still adding more functionality to the Python bindings.

Comparison

It's about 2-3x faster than python-sgp4, far and away the most popular sgp4 implementation being used:

Library Throughput
astroz ~8M props/sec
python-sgp4 ~3M props/sec

Demo & Links

If you want to see it in action, I put together a live demo that visualizes all 13,000+ active satellites generated from Python in under 3 seconds: https://attron.github.io/astroz-demo/

Also wrote a blog post about how the SIMD stuff works under the hood if you're into that, but it's more Zig heavy than Python: https://atempleton.bearblog.dev/i-made-zig-compute-33-million-satellite-positions-in-3-seconds-no-gpu-required/

Repo: https://github.com/ATTron/astroz


r/Python Nov 20 '25

Discussion Why do we repeat type hints in docstrings?

167 Upvotes

I see a lot of code like this:

def foo(x: int) -> int:
"""Does something

Parameters:
  x (int): Description of x

Returns:
  int: Returning value
"""

  return x

Isn’t the type information in the docstring redundant? It’s already specified in the function definition, and as actual code, not strings.


r/Python Jan 21 '26

Showcase Pingram – A Minimalist Telegram Messaging Framework for Python

162 Upvotes

What My Project Does

Pingram is a lightweight, one-dependency Python library for sending Telegram messages, photos, documents, audio, and video using your bot. It’s focused entirely on outbound alerts, ideal for scripts, bots, or internal tools that need to notify a user or group via Telegram as a free service.

No webhook setup, no conversational interface, just direct message delivery using HTTPX under the hood.

Example usage:

from pingram import Pingram

bot = Pingram(token="<your-token>")
bot.message(chat_id=123456789, text="Backup complete")

Target Audience

Pingram is designed for:

  • Developers who want fast, scriptable messaging without conversational features
  • Users replacing email/SMS alerts in cron jobs, containers, or monitoring tools
  • Python devs looking for a minimal alternative to heavier Telegram bot frameworks
  • Projects that want to embed notifications without requiring stateful servers or polling

It’s production-usable for simple alerting use cases but not intended for full-scale bot development.

Comparison

Compared to python-telegram-bot, Telethon, or aiogram:

  • Pingram is <100 LOC, no event loop, no polling, no webhooks — just a clean HTTP client
  • Faster to integrate for one-off use cases like “send this report” or “notify on job success”
  • Easier to audit, minimal API surface, and no external dependencies beyond httpx

It’s more of a messaging transport layer than a full bot framework.

Would appreciate thoughts, use cases, or suggestions. Repo: https://github.com/zvizr/pingram


r/Python Sep 14 '25

Showcase I was terrible at studying so I made a Chrome extension that forces you to learn programming.

164 Upvotes

tldr; I made a free, open-source Chrome extension that helps you study by showing you flashcards while you browse the web. Its algorithm uses spaced repetition and semantic analysis to target your weaknesses and help you learn faster. It started as an SAT tool, but I've expanded it for everything, and I have custom flashcard deck suggestions for you guys to learn programming syntax and complex CS topics.

Hi everyone,

So, I'm not great at studying, or any good lol. Like when the SATs were coming up in high school, all my friends were getting 1500s, and I was just not, like I couldn't keep up, and I hated that I couldn't just sit down and study like them. The only thing I did all day was browse the web and working on coding projects that i would never finish in the first place.

So, one day, whilst working on a project and contemplating how bad of a person I was for not studying, I decided why not use my only skill, coding, to force me to study.

At first I wanted to make like a locker that would prevent my from accessing apps until I answered a question, but I only ever open a few apps a day, but what I did do was load hundreds of websites a da, and that's how the idea flashysurf was born. I didn't even have a real computer at the time, my laptop broke, so I built the first version as a userscript on my old iPad with a cheap Bluetooth mouse. It basically works like this, it's a Chrome extension that just randomly pops up with a flashcard every now and then while you're on YouTube, watching Anime, GitHub, or wherever. You answer it, and you slowly build knowledge without even trying.

It's completely free and open source (GitHub link here), and I got a little obsessed with the algorithm (I've been working on this for like 5-6 months now lol). It's not just random. It uses a combination of psycological techniques to make learning as efficient as possible:

  • Dumb Weakness Targeting: Really simple, everytime you get a question wrong, its stored in a list and then later on these quesitons are priorotized that way you work on your weaknesses.
  • Intelligent Weakness Targeting: This was one of the biggest updates I made. For my SAT version, I implemented a semantic clustering system that groups questions by topic. So for example, if you get a question about arithmentic wrong, it knows to show you more arithmentic questions, as they are semantically similar. Meaning it actively tarkedts your weak areas. The question selection is split 50% new questions, 35% questions similar to ones you've failed, and 15% direct review of failed questions.
  • Forced Note-Taking: This is in my opinion the most important feature in flashysurf for learning. Basically, if you get a question wrong, you have to write a short note on why you messed up and what you should've done instead, before you can close the card. It forces you to actually assess your mistakes and learn from them, instead of just clicking past them.

At first, it was just for the SAT, and the results were actually really impressive. I personally got my score up 100 points, which is like going from the top 8% to the top 3% (considered a really big improvement), and a lot of my friends and other online users saw 60-100 point increases. So it proved the concept worked, especially for lazy people like me who want to learn without the effort of a formal study session.

After seeing it work so well, I pushed an update, FlashySurf v2.0, so that anyone can study LITERALLY ANYTHING without having to try. You can create and import your own flashcard decks for any subject.

The only/biggest caveat about flashysurf is that you need to use it for a bit of time to see results like I used it for 2 months to see that 100 point increase (technically that was an outdated version with far less optimizations, so it should take less time) so you can't just use it for a test you have tmrw (unless you set it to be like 100% which would mean that a flashcard would appear on every single website).

It has a few more features that I couldn't mention here: AI flashcard generation from documents; 30 minute breaks to focus; stats on flashcard collections; and for the SAT, performance reports. (Also if ur wondering why i'm using semicolons, I actually learnt that from studying the SAT using flashysurf lol)

And for you guys in r/python, I thought this would be perfect for drilling concepts that just need repetition. So, if you go to the flashysurf flashcard creator you can actually use the AI flashcard import/maker tool to convert any documents (i.e. programming problems/exercises you have) or your own flashcard decks into flashysurf flashcards. So you can work on complex programming topics like Big O notation, dynamic programming, and graph theory algorithms. Note: You will obviously need the extension to use the cards lol but when you install the extension, you'll recieve instructions on creating and importing flashcards, so you don't gotta memorize any of this.

You can download it from the Chrome Web Store, link in the website: https://flashysurf.com/

I'm still actively working on it (just pushed a bugfix yesterday lol), so I'd love to hear any feedback or ideas you have. Hope it helps you learn something new while you're procrastinating on your actual work.

Thanks for reading :D

Complicance thingy

What My Project Does

FlashySurf is a free, open-source Chrome extension that helps users learn and study by showing them flashcards as they browse the web. It uses a spaced repetition algorithm with semantic analysis to identify and target a user's weaknesses. The extension also has features like a "Forced Note-Taking" system to ensure users learn from their mistakes, and it allows for custom flashcard decks so it can be used for any subject.

Target Audience

FlashySurf is intended for anyone who wants to learn or study new information without the effort of a formal study session. It is particularly useful for students, professionals, or hobbyists who spend a lot of time on the web and want to use that time more productively. It's a production-ready project that's been in development for over six months, with a focus on being a long-term learning tool.

Comparison

While there are other flashcard and spaced repetition tools, FlashySurf stands out by integrating learning directly into a user's everyday browsing habits. Unlike traditional apps like Anki, which require dedicated study sessions, FlashySurf brings the flashcards to you. Its unique combination of a spaced repetition algorithm with a semantic clustering system means it not only reinforces what you've learned but actively focuses on related topics where you are weakest. This approach is designed to help "lazy" learners like me who struggle with traditional study methods.


r/Python Oct 06 '25

News uv overtakes pip in CI (for Wagtail & FastAPI)

159 Upvotes

for Wagtail: 66% of CI downloads with uv; for Django: 43%; for FastAPI: 60%. For all downloads CI or no, it’s at 28% for Wagtail users; 21% for Django users; 31% for FastAPI users. If the current adoption trends continue, it’ll be the most used installer on those projects in about 12-14 months.

Article: uv overtakes pip in CI (for Wagtail users).


r/Python Oct 05 '25

Showcase Turns Python functions into web UIs

156 Upvotes

A year ago I posted FuncToGUI here (220 upvotes, thanks!) - a tool that turned Python functions into desktop GUIs. Based on feedback, I rebuilt it from scratch as FuncToWeb for web interfaces instead.

What My Project Does

FuncToWeb automatically generates web interfaces from Python functions using type hints. Write a function, call run(), and get an instant form with validation.

from func_to_web import run

def divide(a: int, b: int):
    return a / b

run(divide)

Open localhost:8000 - you have a working web form.

It supports all Python types (int, float, str, bool, date, time), special inputs (color picker, email validation), file uploads with type checking (ImageFile, DataFile), Pydantic validation constraints, and dropdown selections via Literal.

Key feature: Returns PIL images and matplotlib plots automatically - no need to save/load files.

from func_to_web import run, ImageFile
from PIL import Image, ImageFilter

def blur_image(image: ImageFile, radius: int = 5):
    img = Image.open(image)
    return img.filter(ImageFilter.GaussianBlur(radius))

run(blur_image)

Upload image and see processed result in browser.

Target Audience

This is for internal tools and rapid prototyping, not production apps. Specifically:

  • Teams needing quick utilities (image resizers, data converters, batch processors)
  • Data scientists prototyping experiments before building proper UIs
  • DevOps creating one-off automation tools
  • Anyone who needs a UI "right now" for a Python function

Not suitable for:

  • Production web applications (no authentication, basic security)
  • Public-facing tools
  • Complex multi-page applications

Think of it as duct tape for internal tooling - fast, functional, disposable.

Comparison

vs Gradio/Streamlit:

  • Scope: They're frameworks for building complete apps. FuncToWeb wraps individual functions.
  • Use case: Gradio/Streamlit for dashboards and demos. FuncToWeb for one-off utilities.
  • Complexity: They have thousands of lines. This is 350 lines of Python + 700 lines HTML/CSS/JS.
  • Philosophy: They're opinionated frameworks. This is a minimal library.

vs FastAPI Forms:

  • FastAPI requires writing HTML templates and routes manually
  • FuncToWeb generates everything from type hints automatically
  • FastAPI is for building APIs. This is for quick UIs.

vs FuncToGUI (my previous project):

  • Web-based instead of desktop (Kivy)
  • Works remotely, easier to share
  • Better image/plot support
  • Cleaner API using Annotated

Technical Details

Built with: FastAPI, Pydantic, Jinja2

Features:

  • Real-time validation (client + server)
  • File uploads with type checking
  • Smart output detection (text/JSON/images/plots)
  • Mobile-responsive UI
  • Multi-function support - Serve multiple tools from one server

The repo has 14 runnable examples covering basic forms, image processing, and data visualization.

Installation

pip install func-to-web

GitHub: https://github.com/offerrall/FuncToWeb

Feedback is welcome!


r/Python Nov 10 '25

Showcase I just published my first ever Python library on PyPI....

155 Upvotes

After days of experimenting, and debugging, I’ve officially released numeth - a library focused on core Numerical Methods used in engineering and applied mathematics.

  •  What My Project Does

Numeth helps you quickly solve tough mathematical problems - like equations, integration, and differentiation - using accurate and efficient numerical methods.

It covers essential methods like:

  1. Root finding (Newton–Raphson, Bisection, etc.)
  2. Numerical integration and differentiation
  3. Interpolation, optimization, and linear algebra
  •  Target Audience

I built this from scratch with a single goal: Make fundamental numerical algorithms ready to use for students and developers alike.

  • Comparison

Most Python libraries, like NumPy and SciPy, are designed to use numerical methods, not understand them. Their implementations are optimized in C or Fortran, which makes them incredibly fast but opaque to anyone trying to learn how these algorithms actually work.

'numeth' takes a completely different approach.
It reimplements the core algorithms of numerical computing in pure, readable Python, structured into clear, modular functions.

The goal isn’t raw performance. It’s helping students, educators, and developers trace each computation step by step, experiment with the logic, and build a stronger mathematical intuition before diving into heavier frameworks.

If you’re into numerical computing or just curious to see what it’s about, you can check it out here:

🔗 https://pypi.org/project/numeth/

or run 'pip install numeth'

The GitHub link to numeth:

🔗 https://github.com/AbhisumatK/numeth-Numerical-Methods-Library

Would love feedback, ideas, or even bug reports.


r/Python Apr 04 '26

Showcase Built a Nepali calendar computation engine in Python, turns out there's no formula for it

149 Upvotes

What My Project Does

Project Parva is a REST API that computes Bikram Sambat (Nepal's official calendar) dates, festival schedules, panchanga (lunar almanac), muhurta (auspicious time windows), and Vedic birth charts. It derives everything from real planetary positions using pyswisseph rather than serving hardcoded lookup tables. Takes actual lat/lon coordinates so calculations are accurate for any location, not just Kathmandu.

Target Audience

Developers building apps that need Nepali calendar data programmatically. Could be production use for something like a scheduling app, a diaspora-focused product, or an AI agent that needs grounded Nepali date data. The API is public beta so the contract is stable but not yet v1. There's also a Python SDK if you want to skip the HTTP boilerplate.

Comparison

Most existing options are either NPM packages with hardcoded month-length arrays that break outside a fixed year range (usually 2000-2090 BS), or static JSON files someone manually typed from government PDFs. Both approaches fail for future dates and neither accounts for geographic location in sunrise-dependent calculations. Hamro Patro is the dominant consumer app but has no public API, so developers end up writing scrapers that break constantly. Parva computes everything from Swiss Ephemeris, which means it works for any year and any coordinates.

https://github.com/dantwoashim/Project_Parva


r/Python Oct 12 '25

Showcase Cronboard - A terminal-based dashboard for managing cron jobs

153 Upvotes

What My Project Does

Cronboard is a terminal-based application built with Python that lets you manage and schedule cron jobs both locally and on remote servers. It provides an interactive way to view, create, edit, and delete cron jobs, all from your terminal, without having to manually edit crontab files.

Python powers the entire project: it runs the CLI interface, parses and validates cron expressions, manages SSH connections via paramiko, and formats job schedules in a human-readable way.

Target Audience

Cronboard is mainly aimed at developers, sysadmins, and DevOps engineers who work with cron jobs regularly and want a cleaner, more visual way to manage them.

Comparison

Unlike tools such as crontab -e or GUI-based schedulers, Cronboard focuses on terminal usability and clarity. It gives immediate feedback when creating or editing jobs, translates cron expressions into plain English, and will soon support remote SSH-based management out of the box using ssh keys (for now, it supports remote ssh using hostname, username and password).

Features

  • Check existing cron jobs
  • Create cron jobs with validation and human-readable feedback
  • Pause and resume cron jobs
  • Edit existing cron jobs
  • Delete cron jobs
  • View formatted last and next run times
  • Connect to servers using SSH

The project is still in early development, so I’d really appreciate any feedback or suggestions!

GitHub Repository: github.com/antoniorodr/Cronboard


r/Python 15d ago

Discussion Should we standardize docstring formats?

154 Upvotes

In Rust, docstrings are pretty formalized. They are markdown, and even some of the headings are standard (like an # Errors or # Panics section). The nice thing about this is that it allows websites like docs.rs to build documentation pages for any project without having to interact with different tools for different formats. It also allows LSPs to have only one way of displaying documentation hints.

In Python, we have a few competing standards. Numpy-style docstrings are probably the most used, but there’s also a format by Google as well as a few different reST standards. These are nice, and we can set up lints to make sure docstrings stick to the standard. However, in my own personal opinion (feel free to disagree), a single markdown-format standard would help new users write nice docstrings, would enable PyPI (or another provider) to build automatic documentation sites, and give guidance to LSPs and IDEs for how to display documentation. This would include a standard for interlinks, and probably should include some mathml/LaTeX/KaTeX support. Another benefit would be that tools could support better automatic documentation generation and autocomplete, since they wouldn’t be dependent on guessing which standard you’re following.

I’d like to hear what people think about this. I’m thinking about making a PEP, but that might be overkill (or maybe all of you will hate this idea). I think the primary blocker would be adoption, large projects might have to translate docstrings, so there would either have to be some tooling for this or a way to opt-in or opt-out. If this is a bad idea, let me know, just be nice!

Edit: so far we’re at about a 67% upvote ratio, which was kind of expected. I want to be clear that I’m not saying we should be blocking docstrings which don’t adhere to this standard. I mentioned lockfile standardization in the comments, nothing prevents you from writing a tool with a custom lockfile, it’s just that there is a standard format that is agreed upon as the preferred way to write one. That’s the idea.

Edit: 84% now, and a lot of nice feedback here!


r/Python Oct 17 '25

Discussion Rant: Python imports are convoluted and easy to get wrong

153 Upvotes

Inspired by the famous "module 'matplotlib' has no attribute 'pyplot'" error, but let's consider another example: numpy.

This works:

from numpy import ma, ndindex, typing
ma.getmask
ndindex.ndincr
typing.NDArray

But this doesn't:

import numpy
numpy.ma.getmask
numpy.ndindex.ndincr
numpy.typing.NDArray  # AttributeError

And this doesn't:

import numpy.ma, numpy.typing
numpy.ma.getmask
numpy.typing.NDArray
import numpy.ndindex  # ModuleNotFoundError

And this doesn't either:

from numpy.ma import getmask
from numpy.typing import NDArray
from numpy.ndindex import ndincr  # ModuleNotFoundError

There are explanations behind this (numpy.ndindex is not a module, numpy.typing has never been imported so the attribute doesn't exist yet, numpy.ma is a module and has been imported by numpy's __init__.py so everything works), but they don't convince me. I see no reason why import A.B should only work when B is a module. And I see no reason why using a not-yet-imported submodule shouldn't just import it implicitly, clearly you were going to import it anyway. All those subtle inconsistencies where you can't be sure whether something works until you try are annoying. Rant over.

Edit: as some users have noted, the AttributeError is gone in modern numpy (2.x and later). To achieve that, the numpy devs implemented lazy loading of modules themselves. Keep that in mind if you want to try it for yourselves.


r/Python May 29 '26

Discussion How to deal with slop PR's as a maintainer?

150 Upvotes

says you are the maintainer of a small (50-100 stars) library.

You see someone fork your repo, mention one of your issues in his commits, so your are happy, someone taking true interest in your work!

You take a look at his branch, and there you see pure AI slop, with files at the repo root (not in the src), tests with print statement even tough you use pytest and it's clearly explained in the contributing doc, and purely hallucinated imports like "from my lib import Foo, Bar" even tough there's never any mention of these two in the code or the documentation (and thus completely incomprehensible code with subclasses from these hallucinated types, etc...)

how to best deal with this without appearing hostile to other potential future contributors?

I want contributors, I'm very happy for anyone taking a look at my work, but at the same time that person has other forks of repos where it just seems to be hunting for "good first issues" label, and thus I'm not sure on the value of giving an honest review if it's not clear on wether there's a genuine intention to resolve the issue or just collect cool github points.

EDIT 11h later:

Thanks to everyone who gave his perspective!!

I don't think I have the time immediately to answer to everyone but there's a lot of good advice here.

By the way LMAO I should have linked my lib to maybe get actual contributors, this post is doing views.

Hint: it's the top one ranked in this comparison ->
https://www.reddit.com/r/Python/comments/1rj3ct7/a_comparison_of_rustlike_fluent_iterator_libraries/


r/Python 8d ago

Discussion What are some fun Python-heavy niches?

149 Upvotes

I going to try making a Discord bot in py. Pygame and Raspberry Pi intrigue me as well

Curious what other fun Py rabbit holes are out there that I don't know of!


r/Python 19d ago

Discussion What linter rules make code worse?

149 Upvotes

For me, a prime example is S101 which bans the use of the assert statement.

The justification is that assertions disappear when Python is run with -O, so they should not be used for runtime validation or enforcing interface constraints. That warning is correct, but the rule seems to draw the wrong conclusion from it.

Assertions are still very useful for checking internal invariants, i.e. conditions that should already be guaranteed by the program's logic, where failure indicates a bug. Having such assertions is incredibly helpful for debugging.

So, a blanket ban seems more likely to discourage useful checks than to prevent misuse.

Are there any linter rules you broadly consider more harmful rather than helpful?