Posts tagged: python

All posts with the tag "python"

275 posts latest post 2026-03-31
Publishing rhythm
Feb 2026 | 1 posts

Today I learned how to use AliasChoices with pydantic settings to setup common aliases for the same field. I’m bad about remembering these things, and hate looking up the docs. I like things to be intuitive and just do the thing I want it to do. Especially when they get configured through something like yaml and do not have a direct lsp look up right from my editor. I figured out how to support what might be common aliases for a storage directory. These can be set up as environment variables and used by config.

Mcat Anything

I’ve long looked for a way to cat anything in the terminal. I’m am terminally in the terminal. I manage all of my projects, code, website, notes, files, servers, infrastructure, almost everything from the terminal. I occasionally open a file manager, mostly at home, only so that I can browse images.

Compounding my issue, I’m a tmux user. It works great for me, and I barely have to think about it at this point. The keybindings are second nature to me. I can go between server, terminal, nvim, and between projects instantly, no loader, no lag, no animation, it just works for everything that really matters to me for really getting things done.

mcat is a new tool that seems like it can cat anything in the terminal, code, files, images, markdown, markdown with images, and even video, without leaving tmux!

...

2 min read

Missing Thoughts

No one is perfect, this is why we have things like checkpoints or gates in the form of pull requests, linting, type checking, and tests. What happens when you work on small side projects by yourself that try to be content focused? What happens when you end up building a lot of the tech under that site and build it on the bleeding edge of all the tech you make? They are likely missing these things and occasionally there are some periods of regression. This is one reason I really like the term digital garden to describe one’s small corner of the internet where they share their thoughts.

There will be regressions

There were signs, signs I did not notice

...

3 min read

Rules

There is no such thing as magic Be ready to roll back live deployments If CI was too fast be suspicious
1 min read

I often want to run an s3 sync in an isolated environment, I don’t want to set any environment variables, I don’t want anything secret in my history, and I don’t want to change my dotenv into something that exports variables, I just want s3 sync to work. dotenv run is the tool that I’ve been using for this, and this uv one liner lets it run fully isolated from the project.

uv tool run --from 'python-dotenv[cli]' dotenv run -- uv tool run --from awscli aws s3 sync s3://bucket data

multi-line #

same thing formatted for readability

uv tool run \ --from 'python-dotenv[cli]' \ dotenv run -- \ uv tool run \ --from awscli \ aws s3 sync s3://dropper data

There are probably 10 ways to skin this cat, but this is what I did, if you have a better way let me know, I’ll link you below.

First 3d Printed Threads

Working on an upcoming project that requires some threaded screws. Trying to keep a low budget on this one with as much to come off of the printer as I can. It might become a slant3d portals product if it works out. I always like making test prints for stuff like this especially to see how the feel is off of the printer that is going to print the final product and take much longer. First try was a success.

I started out looking up standard half inch thread pitch and size, but ran out of time to get the exact profile of a half inch bolt, so I will need to fix that later. Th

The print orientation is critical for strength here. This part is a full 1/2: so it should be strong either way, but to make sure we are printing the bolt horizontally to get nice long print layers. To do this we have to give it a bit of a flat spot on the top and bottom. This does not hurt performance, if anything it probably helps give some room for poor tolerances.

2 min read

FastAPI is a modern and efficient web framework for Python, built on top of the Starlette web framework, and pydantic for data validation and serialization.

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.

The key features are:

The +5 point increase for FastAPI is one of the most significant shifts in the web framework space. This signals a strong trend towards using Python for building performant APIs and reflects the overall strength of the Python ecosystem.

FastAPI.">Starlette has a head request that works right along side your get requests. This morning I fiddled around with custom routes for GET and HEAD, but had to manually set some things about the file, and was still missing e-tag in the end. Turns out as a developer you can just add a head route to your get routes and starlette will strip the content for you, while preserving all of those good headers that fastapi FileResponse created automatically for you.

...

python extras are for shipping

Python has two ways of adding optional dependencies to your projects pyproject.toml file dependency-groups and optional-dependencies.

for development

Dependency grooups are used when working on the project, they do not ship with the project, users cannot select to install them with the project. These are for things like running tests, linting, or docs. You might want to run these in ci, or keep your dev machines tight. For the most part you can probably keep these in dev. Depending on your team, fluency, and tolerance for slower installs extra packages. Adding too many tight groups might make it hard for the team to remember all the groups and which one to use and end up with them using --all-groups anyways.

...

3 min read

anthony has some of the best python highlight videos each year. This might be a good sign, but each year there seems to be less and less that I am chomping at the bit to get to. I thought the remote debugger looked every interesting, his use case for babi seemed very interesting. I wonder what textual would look like built in a 3.14 world, would it still have built its own debugger/console?

uv tool run --python=3.14 babi

Without a process flag you need sudo permissions to attach a pdb debugger similar to gdb.

Kraft-Coordinates

Handy reference for coordinates in the kraft world.

Overworld:-208 71 -291 Nether:-26 9 -36

Overworld: 209 62 -752 Nether:26 1 -94

1 min read

PEP 735 describes dependency groups as sets of optional dependencies that are not shipped with the package but intended for development purposes.

The PEP includes an example for groups that include test, docs, typing, and a combo typing-test.

[dependency-groups] test = ["pytest", "coverage"] docs = ["sphinx", "sphinx-rtd-theme"] typing = ["mypy", "types-requests"] typing-test = [{include-group = "typing"}, {include-group = "test"}, "useful-types"]

This is implemented in uv and can be used by several of their commands.

uv sync --group test uv run --group test uv add --group test pytest uv remove --group test pytest uv export --group test uv tree --group test

Dependency Groups are not Extras #

The docs describe extras as being intended to ship with the application and dependency groups intended for development. The spec allows both to exist with the same name, but care should be taken as tools may have different implementations.

...

I smell a dependency to python-dotenv dying in my workflow. I originally read the title of the post and thought, “I know how to manage .env and almost skipped it”. I’m leaning more and more on uv run these days, so this should just go in my [[ just file ]] to make it easy to run.

zmk two hand hold down

I don’t know about you, but I don’t re-flash my keyboard enough to ever remember where I put the bootloader. Sometimes its the last thing I think about in a refactor and I end up cornering myself into a place where I cant get into that layer anymore. I’ve started putting hardware switches on my newer builds, but some older builds don’t have a hardware one, so it requires disassembly and jumping the microcontroller. Even when I have one though, I gotta flip my board over and its annoying sometimes, so I prefer to have a keystroke for it.

What I’ve landed on recently is the idea of a two hand hold down combo for the bootloader. These combos are ones that there is no way I can hit without picking my hands up from their normal homerow position and pressing four keys simultaneously with pointer and thumbs.

Here are some example layouts from keymap-editor

...

2 min read

I’ve been leaning on lazy-self-installing-python-scripts more and more, but I did not realize how much tooling that uv gives you to help manage your scripts.

uv init --script up uv add --script up typer rich uv remove --script up rich sed -i '1i #!/usr/bin/env -S uv run --script' up chmod +x up ./up

The result is a script that looks like this, its executable as what looks like regular command in your shell.

Keycap Cut Away

I was curious how/if my custom keycap design was hitting my switches. So I set out to find out what the fitup inside of this assembly looks like, but not theoretically, a fully sliced view into their fit up in the flesh.

To setup for this cut, I flooded the edge of a 2x4 with hot glue, and inserted the cap such that the step was tangent with the edge. This way I could use the edge as a guide to cut one side off and leave the stem in tact. I took a handsaw to it and filed it smooth.

Removal was applying some isopropyl alcohol and it popped right off.

...

1 min read

I have a couple of use cases for simple qr codes in python coming up. One is for blog posts, the other is for auth into a new server application logged to a terminal. I tried the qrcode library and it does not look as nice to me and I found pyqrcode to be quite nice.

import pyqrcode url = pyqrcode.create('https://waylonwalker.com/qr-codes-in-python') url.svg('qr-codes-in-python.svg', scale=8) print(url.terminal(quiet_zone=1)) url.svg('qr-codes-in-python.svg', scale=12) url.svg('qr-codes-in-python.svg', omithw=True) # width is controlled by the container url.svg('qr-codes-in-python.svg', omithw=True, module_color='#ffd119') url.svg('qr-codes-in-python.svg',...

...

Such a fantastic use of uv, its so fast and flexible and does everything I need that next time I go to set up some more complex testing like this I’m going to lean towards it more than i would something like tox. In the post Daniel sets up matrix testing for testing out different versions of python with the same pytest test suite.