Bart Dorlandt
dreamnetworking.nl
Bart Dorlandt
@dreamnetworking.nl
(Network) automation above all
I'll continue with the posts and content on LinkedIn. There just in't enough characters to do it all here... Follow me on buff.ly/v7MR0oS
July 21, 2025 at 9:38 AM
A print on 'user' and 'user.name' shows:

"id=1 name='John Doe' email='[email protected]'"
and
"John Doe"
July 21, 2025 at 9:38 AM
Did you ever ran into a tricky json, with a lot of dicts, where the dict in the dicts were inconsistent with variables key names?
July 18, 2025 at 1:07 PM
You mean just the instruction to load the json in the model. True. But defining the whole model takes a few more lines 😂
Especially if the json is tricky...
July 18, 2025 at 12:11 PM
Sounds solid. I'd prefer task over just. I had written a comparison here github.com/bartdorlandt...
GitHub - bartdorlandt/Beyond_the_Makefile: Choices choices, which is the one?
Choices choices, which is the one? Contribute to bartdorlandt/Beyond_the_Makefile development by creating an account on GitHub.
github.com
July 7, 2025 at 10:29 AM
#pyrefly found at pyrefly.org is a new one written in rust and is created by #meta open source.
#ty found at buff.ly/rJg94P5 is created by astral-sh (creators of #ruff and #uv) and is also written in rust. Note: this isn't ready for production yet.

Have you tried any of the new kids on the block?
Pyrefly: A Static Type Checker for Python | Pyrefly
Your Docusaurus site did not load properly.
pyrefly.org
May 30, 2025 at 9:38 AM
I hope this project will help you in your migrations and make them smooth and quick.

In case you run into challenges, don't hesitate to reach out.
May 28, 2025 at 9:38 AM
The `-n` flag will do a dry run and creates a new file instead of moving the old one out of the way, allowing you to verify its contents.
To do the actual migration, just `uvx convert-poetry2uv pyproject.toml`. (Your original file will be backed up)
May 28, 2025 at 9:38 AM

I looked for existing ones, but didn't find any that met my requirements or desires. So, nothing to do than creating my own. And so it was born. buff.ly/zmp2ptg

to make it really easy to use, when you already have uv installed is just calling it directly: `uvx convert-poetry2uv -n pyproject.toml`
GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead
A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead - GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based p...
buff.ly
May 28, 2025 at 9:38 AM
Doing it by hand is just plain annoying and it will be easy to sneak in some errors.

After I did that once, and imaging other would be in the same pickle. I thought it would be useful to have a migration script to convert the existing #poetry `pyproject.toml` to one that can be consumed by #uv.
GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead
A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead - GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based p...
buff.ly
May 28, 2025 at 9:38 AM
`uv add --dev $library` to make it part of the development group.

Even loading libraries from your requirements file is easy, `uv add -r requirements.txt`.

Now, you might want to migrate other repositories to have some consistency. How to migrate your existing repo's to uv.
GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead
A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead - GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based p...
buff.ly
May 28, 2025 at 9:38 AM
Creating a uv repo is easy, just run `uv init $project` and you are off to the races. Using it for new projects is easy if you are already used to poetry. The commands are quite similar. Just add a few libraries with `uv add $library` or
GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead
A solution to convert existing poetry based python projects pyproject.toml to be consumed with `uv` instead - GitHub - bartdorlandt/convert_poetry2uv: A solution to convert existing poetry based p...
buff.ly
May 28, 2025 at 9:38 AM
With this in place, the uv run is part of the script and calling it directly from the CLI is now possible.

Have a read on my complete article
buff.ly/KQ8kqVN
Improved shebang for your python standalone script - Dream networking and automation
Set up the shebang for your script using uv run
buff.ly
March 12, 2025 at 10:38 AM
This provides the dependency of still writing `uv run` for the command, and it doesn't allow you to have that script as part of your PATH and just be able to call it.

So, let's improve that by changing the shebang.
`#!/usr/bin/env -S uv run --script`
Improved shebang for your python standalone script - Dream networking and automation
Set up the shebang for your script using uv run
buff.ly
March 12, 2025 at 10:38 AM
When we combine that with uv, buff.ly/cWc4fBv we can easily run the script without having to activate a virtualenv or specify the python interpreter. And it will just take care of it. Assume the script has the name `script.py` we would call it with `uv run -s script.py`.

Are you already using this?
Running scripts | uv
A guide to using uv to run Python scripts, including support for inline dependency metadata, reproducible scripts, and more.
buff.ly
March 10, 2025 at 10:38 AM
Yeah indeed. I always had that setting enabled for poetry. It was the default for me.
January 13, 2025 at 7:08 PM
Shell can be done by a plugin indeed. Though it is nothing more than enabling the venv. I just have an alias called `venv`:
`source ./.venv/bin/activate` and vscode picks it up automatically

Still want to migrate, use a conversion tool, like pypi.org/project/conv...
convert-poetry2uv
Poetry to uv tool. To migrate from a poetry managed repo to uv.
pypi.org
January 13, 2025 at 3:44 PM