Skip to content

Blog

Preventing segfaults in test suite that has Qt Tests

Motivation

When providing an GUI application one needs to select GUI backend. If application is Python and needs to work on all popular OSes1 the good choice is to use Qt. It is a cross-platform GUI toolkit that has good python bindings2.

However, the Qt objects require special care during testing. It this post I will describe my experience of writing such tests based on my work on PartSeg and napari.

Auto-selects sound devices on login

Motivation

The Ubuntu prioritizes the USB sound card over the internal sound card. This is not always what one wants. Some examples:

  1. USB camera with not-so-good microphone, when a better microphone is connected to the internal sound card.
  2. USB microphone with option to monitor recorded sound, that is recognized as possible output, when speakers are connected to the internal sound card.

In both scenarios, the system will select the USB device instead of the internal sound card. This is not always what one wants.

Python in neovim with pyenv

In contradiction to vim, neovim support for python3 is not added by compilation flag but by python3 package. This package is not installed by default and need to be installed manually.

Neovim instruction suggest installing it using --user flag. I do not like this suggestion as packages installed with --user flag are visible in all python environments.

During play with neovim I found that it scan all python environments and use first one that have neovim package installed.

So my preferred solution for now is to create separate python environment for neovim and install neovim package in it.

$ pyenv virtualenv 3.11.5 neovim
$ pyenv shell neovim
$ pip install pynvim

After that I can use :checkhealth command in neovim to check if everything is ok.

Please use python version already installed on your machine instead of 3.11.5 in above commands.

Chezmoi for dotfiles management

When looking for a dotfiles manager I was looking for something that will be:

  1. Easy to use
  2. Allow to handle machine specific configuration
  3. Keep dotfiles synchronization with only few commands

After read few articles I decided to try chezmoi.

Features

Most important features of chezmoi for me are:

  • Could be easy installed on Ubuntu and macOS
  • Allow using templates for configuration files
  • Allow specifying external dependencies like:
    • oh-my-zsh
    • Vundle
    • selected zsh plugins that is not installed by oh-my-zsh
    • language dictionary for vim
  • configuration in text files
  • use git for synchronization
  • preview changes before applying them

Configuration