Bart Dorlandt's Avatar

Bart Dorlandt

@dreamnetworking.nl

(Network) automation above all

303
Followers
247
Following
74
Posts
13.11.2024
Joined
Posts Following

Latest posts by Bart Dorlandt @dreamnetworking.nl

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

21.07.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

A print on 'user' and 'user.name' shows:

"id=1 name='John Doe' email='some@email.com'"
and
"John Doe"

21.07.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

As a first in the pydantic series, let's start with the basics. The goal of the whole series is to be able to validate the model as well as being able to generate the same json as the input, to verify we didn't miss anything.

21.07.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

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?

18.07.2025 13:07 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

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...

18.07.2025 12:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

I've working on parsing a json structure into a pydantic model. I'm planning to write a couple of posts on this. Is this something you've been playing with?
Anything specific you ran into?

Perhaps I could write about something specific if you have certain interests. Please let me know.

18.07.2025 09:38 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
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.

Sounds solid. I'd prefer task over just. I had written a comparison here github.com/bartdorlandt...

07.07.2025 10:29 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Managing dockers using ansible on Synology NAS - Dream networking and automation How I use ansible to manage docker compose on my Synology NAS

Dealing with #Ansible & #docker compose on #synology systems and an alternative #taskfile option

Let's dive in: buff.ly/xoSjQ1A

The alternative with taskfile: buff.ly/bMcd7SG

18.06.2025 09:38 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Using #Taskfile to deal with docker-compose vs docker compose on different systems

buff.ly/bMcd7SG

16.06.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Pyrefly: A Static Type Checker for Python | Pyrefly Your Docusaurus site did not load properly.

#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?

30.05.2025 09:38 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image Post image Post image

Most of us already got used to annotate our #python code with typehints. If I had to guess, I would say that most people are using #mypy for checking the types.

Did you know that other checkers have emerged these days?

30.05.2025 09:38 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

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.

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

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)

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
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...


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`

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
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...

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.

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
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...

`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.

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
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...

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

28.05.2025 09:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

When I encountered #uv I fell for it right away. I was already using ruff for a while and started looking into rye, which was the intermediate step before it became uv.

28.05.2025 09:38 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1
Preview
Improved shebang for your python standalone script - Dream networking and automation Set up the shebang for your script using uv run

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

12.03.2025 10:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Improved shebang for your python standalone script - Dream networking and automation Set up the shebang for your script using uv run

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`

12.03.2025 10:38 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image Post image

Previously I share a post on how you can use `uv run -s script.py` to run that script and have `uv` handle the dependencies. The original script is showing the shebang is pointing to a python3 executable.

12.03.2025 10:38 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Running scripts | uv A guide to using uv to run Python scripts, including support for inline dependency metadata, reproducible scripts, and more.

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?

10.03.2025 10:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image


Ever wanted to run a python script, without having to specify a virtualenv?

Given buff.ly/cVEXJle we can build scripts as we would normally, though now add a few comments to it to specify the dependencies.

10.03.2025 10:38 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Yeah indeed. I always had that setting enabled for poetry. It was the default for me.

13.01.2025 19:08 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
convert-poetry2uv Poetry to uv tool. To migrate from a poetry managed repo to uv.

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...

13.01.2025 15:44 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
GitHub - bartdorlandt/ansible-role-poetry Contribute to bartdorlandt/ansible-role-poetry development by creating an account on GitHub.

Consider this done.

Find more details on the role on github:
https://buff.ly/3BVaf4R

Are you using poetry, or have you switched to uv? Or perhaps using something else?

13.01.2025 09:36 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

Poetry had a new release recently, version 2.0. Given the number, this means stuff broke ;) E.g. the poetry shell command is no more. The pyproject.toml is updated and now supporting the project header. (PEP 621)

This also meant I had to update my ansible role for poetry (bartdorlandt.poetry).

13.01.2025 09:36 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 2 ๐Ÿ“Œ 0
Post image

I've written an article on linkedIn on my tool to migration from poetry to uv. Having uv is awesome, though the migration of each repo isn't...

This tool will make your life a bit easier. Have fun ๐Ÿ˜ž

https://buff.ly/3BPX5WI

03.01.2025 09:36 ๐Ÿ‘ 3 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Shortcat: Universal command palette for your Mac | Shortcat Shortcat is a Mac command palette app that lets you click, activate menus, switch windows, and more, with just your keyboard! macOS wide command palette utility app.

PS. For those who are using #shortcat (https://shortcat.app/), this unfortunately doesn't work to active the toggle.

01.01.2025 09:36 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Shortcat: Universal command palette for your Mac | Shortcat Shortcat is a Mac command palette app that lets you click, activate menus, switch windows, and more, with just your keyboard! macOS wide command palette utility app.

I found it to be very powerful for several other things as well and I've replaced spotlight with it.

No more annoyances for me, at least not regarding the notch ๐Ÿซ 

I hope it'll work for you as well. Or have you find another solution?

01.01.2025 09:36 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0