Getting started with Ruff and Poetry

I manage most of my Python projects with Poetry, I really like how it handles dependencies, configures projects and manages virtual environments using simple commands.

Normally I include linting tools as part of my Poetry projects, specifically flake8 and pylint. They served me well, but recently I saw a lot of hype around ruff in online tech circles, so I decided to give it a try.

And I'm glad I did, ruff and poetry are a match made in heaven. I'm really enjoying working with ruff, and how I can have really good static code analysis, and really fast.

In this article, I give a quick guide on how to setup ruff the way I use it on my Python projects, and how to integrate the ruff-lsp to Neovim.

Add ruff to you poetry dependencies

Assuming you already have a poetry project in place, you can add ruff as a development dependency:

poetry add --group dev ruff

This will create the following entry in your pyproject.toml file:

[tool.poetry.group.dev.dependencies]
ruff = "^0.4.2"

Configure ruff

The ruff documentation is pretty good, and the tool is pretty versatible, so you can set ruff to however you like …

more ...

Building a blog with Pelican and Netlify

It's been more than a year since I last posted on this website. I've been busy and I didn't have something to write about, until now. As I wrote before, I've been running the classic Jekyll/GitHub Pages combo, but I wanted to try something different, something that gave me more control over my website, so I found Pelican.

Similar to Jekyll, Pelican is a static site generator: its output are plain HTML/CSS files that you can upload anywhere, you don't need a backend nor a database. This is great because finding cheap (free) hosting is easy, and Netlify's Started Plan is perfect for this type of websites.

Just like Jekyll, Pelican also supports a wide variety of plugins and themes. The main difference is that Pelican is written in Python, and being a huge Python fan myself, I decided to give it a go. This is the write-up of how I got it working.

1. Setup the project using Poetry

I really like Poetry for managing my dependencies and virtual environments.

You can create a new Poetry project by running:

poetry new new-blog

You can find more information on how to use Poetry by reading the docs.

Now …

more ...