r/pythoncoding • • Nov 19 '20

"How to Constrain Artificial Stupidity" - 2019 PyData talk by Vincent Warmerdam

Thumbnail
youtube.com
3 Upvotes

r/pythoncoding • • Jan 18 '18

Python frameworks/library to Rapidly prototype based on dataflow?

3 Upvotes

Hello,

I was wondering if there is a framework that exists that can be recommended by people.(Open source/ for free)

I would like to have a frame work where I can abstract my code in several files(Classes/py files etc) and then used this dataflow based approach to combine stuff together and get it working.

For eg I have an image as an input and I have several functions that have several different input and outputs. I need to be able to define a data flow and connection between the inputs and outputs and run the program(Sorry for the bad explanation).

Look at figure below for an example. https://imgur.com/a/6ZiiV

It should be python2 and 3 compatible should be to print out graphs of how it looks.

The few example of this I found are. https://github.com/maet3608/nuts-flow https://github.com/maet3608/nuts-ml https://github.com/PaulSchweizer/flowpipe


r/pythoncoding • • Jul 07 '17

Dependency Injector 3.5.0 has been released!

3 Upvotes

Dependency Injector 3.5.0 has been released!

  • Add functionality for initializing Configuration provider with default values.

More:


r/pythoncoding • • Nov 12 '15

PyCon UK 2012: Create *beautiful* command-line interfaces with Python

Thumbnail
youtube.com
3 Upvotes

r/pythoncoding • • Sep 22 '15

Python and crypto-strength random numbers by default

Thumbnail
lwn.net
3 Upvotes

r/pythoncoding • • Sep 10 '15

Creating beautiful REST APIs with Flask

Thumbnail pycoder.net
3 Upvotes

r/pythoncoding • • Aug 24 '15

sh - full-fledged subprocess interface for Python

Thumbnail
amoffat.github.io
3 Upvotes

r/pythoncoding • • Aug 03 '15

ConfigTree — handle complicated config files

Thumbnail configtree.readthedocs.org
3 Upvotes

r/pythoncoding • • Jun 19 '26

Migrate a Python project to a Monorepo (using agents)

2 Upvotes

With Agentic Engineering there's an opportunity to refactor legacy code, but this aspect of AI isn't that that much talked about and seems to be overlooked by teams out there.

I’ve been focusing on this lately, and have added agent skills to the Python Open Source project that I maintain: the Python tools for the Polylith Architecture.

If you don't know about Polylith:
the main use case is having Microservices in a Monorepo, and share code between the services. It’s an Architecture with tooling support. I'm the maintainer of the tooling support for Python that works well with uv, poetry and most of the package & dependency management tools for Python out there. There's more info in the link above, you'll also find the documentation there.

The agent skills that I recently added are for migrating and refactoring an entire Python project into a well-structured, human & agent-friendly Monorepo.

But agents are unpredictable and different models behave differently. I have test-run the skills with Claude Opus and Mistral. If you will try this thing out, please share your feedback how the skills worked for you.

A blog post about this:
https://davidvujic.blogspot.com/2026/06/refactoring-with-ai.html


r/pythoncoding • • Apr 13 '26

I built multiple Python projects: F1 dashboard, IMSA analytics system, and a Discord bot

Thumbnail
github.com
2 Upvotes

Over the past period I’ve been building a few projects focused on data, backend systems, and real-time analysis.

Here’s a quick overview:

F1 Intelligence Dashboard

Analyzes race sessions using FastF1

Tracks pace trends, battles, and strategy windows

Includes simple prediction logic for overtakes

IMSA Endurance Dashboard

Works with live timing data (no official API)

Detects anomalies and class battles

Stores race data to enable post-race analysis

Discord Bot

Built with discord.py

Slash commands, access control system

Activity tracking + ranking system using a database

Stack across projects:
Python, Flask, Pandas, FastF1, PostgreSQL

Still improving all of them (next focus is better predictions + more data-driven insights).

(I would like to make it perfectly clear that the website was created ENTIRELY by AI as idk how to create websites using java and html and such, i know mostly python and thats what im good at and i LOVE motorsports which is why ive been creating these for a very long time now which is why i ant feedback or ideas and id be more than glad to discuss anything with you guys, im also putting the tag created with AI because i did use AI for some help, but it was more than mostly only me working on these)

(I would also like to make it clear that i can explain any and every line of code in here and that the entire html and stuff, that’s Codex, I haven’t studied or able to write any html/Java codes, I am going to be learning Java in the future but for now anything html based like the website designs and all are all Codex, but, for the Python codes, I’m not going to say it’s ALL me because that’s not true and I don’t like lying, AI helps me MASSIVELY and I use it to as much as I can but any project I like using it as a tool and not like “build me this and that” the ideas and everything are mine and I’m glad to say that most, maybe most is a little far fetched, but like ALOT of the code is written by my hand and I don’t use AI to build me full codes and whatever lines or anything it writes for me, I understand FULLY, like I can explain every single line of the code, even the ones written by AI, so again, I don’t consider myself that great of a coder but I also don’t have AI build me the entire codes with me having nothing to do with them but the ideas, I hope this helps and if you have any feedback/ideas those would mean a lot to me, and if you have anyone/yourself that can check if the data isn’t faulty inside the website I would also appreciate that, I appreciate and welcome any and every support, even criticism)

Would appreciate any feedback or ideas.

GitHub:
https://github.com/Andrew-3y


r/pythoncoding • • Apr 11 '26

pytest-codeblock - A pytest plugin for testing code examples in Markdown and reStructuredText files

2 Upvotes

I wrote a small pytest plugin that tests code blocks in your docs.

https://github.com/barseghyanartur/pytest-codeblock

What My Project Does

pytest-codeblock is a minimal pytest plugin that finds Python code examples in your .rst and .md files and runs them as regular pytest tests. No dependencies beyond pytest itself (plus tomli on Python 3.10).

It handles:

  • reStructuredText and Markdown — .. code-block:: python, .. code:: python, .. literalinclude::, literal blocks, and fenced ```python blocks

  • Grouping — split one logical example across several blocks using .. continue: or <!-- continue: --> and they run as a single test, or as cumulative incremental steps if each continuation has its own name

  • pytest markers and fixtures — .. pytestmark: django_db, <!-- pytestmark: skip -->, fixture injection via .. pytestfixture: tmp_path; custom fixtures from conftest.py work too

  • pytestrun marker — run full pytest-style suites (test classes, fixtures, parametrize, setup/teardown) inside a single doc block

  • Async support — top-level await is automatically wrapped, no config needed

  • Nameless code blocks — opt-in via pyproject.toml; off by default, only test_*-named blocks run unless you enable it

  • Custom languages and extensions — configurable if your docs use non-standard identifiers


Feature comparison

Featurepytest-codeblockSybilphmdoctestpytest-codeblocksdoctest
RST support✅✅❌❌✅
Markdown support✅✅✅✅❌
Both RST + MD✅✅❌❌❌
Native pytest collector✅✅❌✅✅
Fixture injection in docs✅⚠️ conftest only❌❌❌
pytest markers in docs✅⚠️ conftest only❌❌❌
Block grouping / continuation✅✅❌❌❌
Incremental grouping✅❌❌❌❌
Async support✅⚠️ manual❌❌❌
Test classes in doc blocks✅ (pytestrun)❌❌❌❌
literalinclude support✅❌❌❌❌
Nameless block testing✅ opt-in❌✅✅❌
Zero config to start✅❌✅✅✅
No generated files on disk✅✅❌✅✅
Zero extra dependencies✅❌❌✅✅

⚠️ = supported but requires extra wiring outside the doc file


Zero config to start. Install it, run pytest. Any block named test_* becomes a test.

pip install pytest-codeblock

reStructuredText:

.. code-block:: python
   :name: test_basic_example

   import math
   result = math.pow(3, 2)
   assert result == 9

Markdown:

```python name=test_basic_example
import math
result = math.pow(3, 2)
assert result == 9
```

Target Audience

Library authors and anyone who has shipped broken doc examples and only found out from a user bug report. If you're already running pytest, the cost to add doc block testing is close to zero.

Comparison

  • vs. doctest: doctest is built for REPL-style >>> examples. It works fine for trivial cases but gets awkward fast — multiline logic, fixtures, and async are all painful. pytest-codeblock lets you write plain Python with assert statements, so your examples look like real code rather than a terminal session.

  • vs. Sybil: Sybil is the most capable alternative and worth considering for complex setups. The tradeoff is configuration overhead: fixtures and regions need manual wiring in conftest.py. pytest-codeblock keeps fixture requests in the doc file itself (.. pytestfixture: tmp_path) and works with existing conftest.py fixtures without extra setup. If Sybil's power is more than you need, pytest-codeblock is lighter.

  • vs. phmdoctest: phmdoctest transpiles Markdown into .py files on disk and runs those. pytest-codeblock is a native pytest collector — no generated files, nothing to add to .gitignore, no intermediate artifacts.

  • vs. pytest-codeblocks (plural): Similar name, different scope. pytest-codeblock adds fixture injection, grouping, async wrapping, and the pytestrun marker for full test-class support inside doc blocks.

The plugin is in beta. It's been used in a few projects and the core behavior is stable, but edge cases and feedback are welcome.

Documentation: https://pytest-codeblock.readthedocs.io Repository: https://github.com/barseghyanartur/pytest-codeblock


r/pythoncoding • • Mar 16 '26

Decorators for using Redis in Python

Thumbnail
github.com
2 Upvotes

r/pythoncoding • • Mar 10 '26

uv-bundler – bundle Python apps into deployment artifacts (JAR/ZIP/PEX) with right platform wheels, no matching build environment

Thumbnail
reddit.com
2 Upvotes

r/pythoncoding • • Feb 22 '26

Pi vs E classifier

Thumbnail
github.com
2 Upvotes

r/pythoncoding • • Feb 04 '26

/r/PythonCoding monthly "What are you working on?" thread

2 Upvotes

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.


r/pythoncoding • • Dec 10 '25

FastAPI Lifespan Events: The Right Way to Handle Startup & Shutdown

Thumbnail reddit.com
2 Upvotes

r/pythoncoding • • Dec 05 '25

Python App: TidyBit version 1.2 Release. Need feedback and suggestions.

Thumbnail reddit.com
2 Upvotes

r/pythoncoding • • Nov 15 '25

A2A Protocol Explained with Demo

Thumbnail
youtu.be
2 Upvotes

r/pythoncoding • • Oct 04 '25

/r/PythonCoding monthly "What are you working on?" thread

2 Upvotes

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.


r/pythoncoding • • Aug 21 '25

A small Python script to let you see EAS information for a specific location

Thumbnail reddit.com
2 Upvotes

r/pythoncoding • • Apr 25 '25

Signal-based State Management in Python: How I Brought Angular's Best Feature to Backend Code

2 Upvotes

Hey Pythonistas,

I wanted to share a library I've been working on called reaktiv that brings reactive programming to Python with first-class async support. I've noticed there's a misconception that reactive programming is only useful for UI development, but it's actually incredibly powerful for backend systems too.

What is reaktiv?

Reaktiv is a lightweight, zero-dependency library that brings a reactive programming model to Python, inspired by Angular's signals. It provides three core primitives:

  • Signals: Store values that notify dependents when changed

  • Computed Signals: Derive values that automatically update when dependencies change

  • Effects: Execute side effects when signals or computed values change

This isn't just another pub/sub library

A common misconception is that reactive libraries are just fancy pub/sub systems. Here's why reaktiv is fundamentally different:

Pub/Sub SystemsReaktiv
Message delivery between componentsAutomatic state dependency tracking
Point-to-point or broadcast messagingFine-grained computation graphs
Manual subscription managementAutomatic dependency detection
Focus on message transportFocus on state derivation
Stateless by designIntentional state management

"But my backend is stateless!"

Even in "stateless" services, ephemeral state exists during request handling:

  • Configuration management

  • Request context propagation

  • In-memory caching

  • Rate limiting and circuit breaking

  • Feature flag evaluation

  • Connection pooling

  • Metrics collection

Real backend use cases I've implemented with reaktiv

1. Intelligent Cache Management

Derived caches that automatically invalidate when source data changes - no more manual cache invalidation logic scattered throughout your codebase.

2. Adaptive Rate Limiting & Circuit Breaking

Dynamic rate limits that adjust based on observed traffic patterns with circuit breakers that automatically open/close based on error rates.

3. Multi-Layer Configuration Management

Configuration from multiple sources (global, service, instance) that automatically merges with the correct precedence throughout your application.

4. Real-Time System Monitoring

A system where metrics flow in, derived health indicators automatically update, and alerting happens without any explicit wiring.

Benefits for backend development

  1. Eliminates manual dependency tracking: No more forgotten update logic when state changes

  2. Prevents state synchronization bugs: Updates happen automatically and consistently

  3. Improves performance: Only affected computations are recalculated

  4. Reduces cognitive load: Declare relationships once, not throughout your codebase

  5. Simplifies testing: Clean separation of state, derivation, and effects

How Dependency Tracking Works

One of reaktiv's most powerful features is automatic dependency tracking. Here's how it works:

1. Automatic Detection: When you access a signal within a computed value or effect, reaktiv automatically registers it as a dependency—no manual subscription needed.

2. Fine-grained Dependency Graph: Reaktiv builds a precise dependency graph during execution, tracking exactly which computations depend on which signals.

# These dependencies are automatically tracked:
total = computed(lambda: price() * (1 + tax_rate()))

3. Surgical Updates: When a signal changes, only the affected parts of your computation graph are recalculated—not everything.

4. Dynamic Dependencies: The dependency graph updates automatically if your data access patterns change based on conditions:

def get_visible_items():
    items = all_items()
    if show_archived():
        return items  # Only depends on all_items
    else:
        return [i for i in items if not i.archived]  # Depends on both signals

5. Batching and Scheduling: Updates can be batched to prevent cascading recalculations, and effects run on the next event loop tick for better performance.

This automatic tracking means you define your data relationships once, declaratively, instead of manually wiring up change handlers throughout your codebase.

Example: Health Monitoring System

from reaktiv import signal, computed, effect

# Core state signals
server_metrics = signal({})  # server_id -> {cpu, memory, disk, last_seen}
alert_thresholds = signal({"cpu": 80, "memory": 90, "disk": 95})
maintenance_mode = signal({})  # server_id -> bool

# Derived state automatically updates when dependencies change
health_status = computed(lambda: {
    server_id: (
        "maintenance" if maintenance_mode().get(server_id, False) else
        "offline" if time.time() - metrics["last_seen"] > 60 else
        "alert" if (
            metrics["cpu"] > alert_thresholds()["cpu"] or
            metrics["memory"] > alert_thresholds()["memory"] or
            metrics["disk"] > alert_thresholds()["disk"]
        ) else 
        "healthy"
    )
    for server_id, metrics in server_metrics().items()
})

# Effect triggers when health status changes
dashboard_effect = effect(lambda: 
    print(f"ALERT: {[s for s, status in health_status().items() if status == 'alert']}")
)

The beauty here is that when any metric comes in, thresholds change, or servers go into maintenance mode, everything updates automatically without manual orchestration.

Should you try it?

If you've ever:

  • Written manual logic to keep derived state in sync

  • Found bugs because a calculation wasn't triggered when source data changed

  • Built complex observer patterns or event systems

  • Struggled with keeping caches fresh

Then reaktiv might make your backend code simpler, more maintainable, and less buggy.

Let me know what you think! Does anyone else use reactive patterns in backend code?

Check it out on GitHub | PyPI


r/pythoncoding • • Mar 04 '25

/r/PythonCoding monthly "What are you working on?" thread

2 Upvotes

Share what you're working on in this thread. What's the end goal, what are design decisions you've made and how are things working out? Discussing trade-offs or other kinds of reflection are encouraged!

If you include code, we'll be more lenient with moderation in this thread: feel free to ask for help, reviews or other types of input that normally are not allowed.


r/pythoncoding • • Feb 11 '25

Confused setting up a content variable in BeautifulSoup

2 Upvotes

soup = []

for i in range(1,6):

url_a = f'https://www.mascotdb.com/native-american-high-school?page={i}'

resp_a = requests.get(url_a, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0'})

soup_b = BeautifulSoup(resp_a.content, "html.parser")

soup_b.append(soup)

I hope I haven't gotten this way too confused. I'm trying to combine five pages of a website into a single content variable. When I ran this code without the "append" line, it created a content file with only the last of the five pages, so I figured that I need to create a blank list (soup), and add an append line to get everything to roll into a single variable. But, python isn't liking this, saying "list object has no attribute parent". So clearly I'm off on something here, but am I on the right track?


r/pythoncoding • • Feb 10 '25

Inviting Collaborators for a Differentiable Geometric Loss Function Library

2 Upvotes

Hello, I am a grad student at Stanford, working on shape optimization for aircraft design.

I am looking for collaborators on a project for creating a differentiable geometric loss function library in pytorch.

I put a few initial commits on a repository here to give an idea of what things might look like: Github repo

Inviting collaborators on twitter