1
45
2
19
3
4

I wrote this for hardware that only ships a Windows app (case LCDs, RGB controllers, AIO coolers, mice). You record USB traffic while clicking through the vendor app (usbmon on Linux, USBPcap on Windows), note what each click did, and usb-rea infers the command layout: constant bytes, counters, value fields with their scaling, lookup tables, checksums and CRCs, handshakes and image streams. Output is a Markdown report where every claim points at Wireshark frame numbers, plus a standalone pyusb driver.

A few Python-side details that might interest people here:

  • The pcap and pcapng parsing is plain standard library, so the only runtime dependency besides the optional MCP server is pyusb.
  • Linear field fits have to survive leave-one-out cross-checks before they are reported, so it says "unknown" rather than guessing.
  • usb-rea demo --device fan generates a synthetic capture and runs the whole pipeline, so you can try it with no hardware.

It is MIT licensed and on PyPI (pip install usb-rea). On known protocols, for example the NZXT Kraken X fan command from liquidctl, it recovers the packet format byte for byte. Feedback on the code or the inference approach is welcome.

4
2

Noust is a free (AGPL) Python 3.10+ CLI and FastAPI service that deploys web apps onto Linux servers. It runs as root, so a few classes of bugs are expensive. The project ended up with four rules, each enforced by a test, and each one exists because its absence shipped a real bug:

  1. Nothing runs a process except one module. Only core/runner.py may import subprocess. Argv only, never a shell, timeouts mandatory, secrets through env= or input= (never argv, which every local user can read in ps). The test suite's conftest makes any real process call fail, so code that bypasses the runner can't even be tested. --dry-run lives there too, which is why it can't be honoured in one path and ignored in another.
  2. except Exception only at an error boundary, and it must log. There used to be 302 of them, 149 silent; that's how calls to methods that didn't exist shipped for whole releases. mypy blocks CI.
  3. One implementation of each thing. The web API is a client of the same managers the CLI uses, never a second implementation.
  4. Guards at the chokepoint. Unit ownership is checked in the service manager, read-only SQL is enforced by the database server, escaping by the template engine.

The contributing guide explains each one with the bug behind it: https://github.com/Perkybeet/noust/blob/main/CONTRIBUTING.md

Interested in how others structure similar tools.

5
4
6
6
7
96
Tim Peters has died (discuss.python.org)
8
4

Got ERR_TUNNEL_CONNECTION_FAILED in Chrome and no idea why? Try the same proxy from Python, because it'll tell you what the browser won't. Chromium drops every CONNECT reply except 200 and 407, so you can't tell a policy block from a dead exit in there.

Python leaves the status in the exception text. You'll see OSError: Tunnel connection failed: 502 Bad Gateway from http.client, and requests wraps that in a ProxyError with the same words inside.

I'd read that string before retrying anything, since a blanket except ProxyError plus a retry loop just burns time on errors that can't heal. A 403 is usually policy, sometimes just a port they don't allow. 407 means check your login. If you get 405 or 501 you aren't talking to a forward proxy at all. Only 502, 503 and 504 are worth backing off on, those happened behind the proxy.

Disclosure: we run a proxy service, none of this depends on whose.

9
17
pip 26.3 released (discuss.python.org)
10
14

If you've got anything running on Google's Custom Search JSON API, it's on a clock. Google closed it to new customers and their overview page says it's gone on January 1, 2027.

Easy to miss in the docs: one call returns 10 results and a query tops out at 100. So pulling the top 100 for a single keyword is 10 billable calls.

For checking your own site's rankings there's an easier path anyway. The Search Console API hands you query, page, country and device rows, up to 25,000 per request, and it's all within Google's rules.

Anyone already moved off Custom Search? What did you switch to?

11
13
12
15
13
15
14
4
15
13
16
16
17
38

@mgorny@treehouse.systems:

After seeing yet another dozen packages lose keywords on Gentoo because of a single key dependency switching to uv-build, I would like to plea on behalf of Gentoo users: please don’t use uv-build as a build backend.

Just to be clear, this is not about uv itself or any other Astral tools; these are good tools with a nice and responsive upstream. The uv-build backend is one thing we have to disagree on. I’m not saying it’s bad; I’m saying that its benefits don’t outweigh the drawbacks.

18
13
submitted 1 month ago by cm0002@lemy.lol to c/python@programming.dev
19
23
submitted 1 month ago* (last edited 1 month ago) by misk@piefed.social to c/python@programming.dev
20
23
21
9
22
9
23
26
24
56

A hard exercise to help build the right mental model for Python data.

The “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph

25
25
view more: next ›

Python

8126 readers
3 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 3 years ago
MODERATORS