RSSAmplifier

Blog

Stefan Scherfke - python

stefan.sofa-rockers.orgRSS feed ↗36 posts

Latest posts

Publishing to PyPI with a Trusted Publisher from GitLab CI/CD

Learn how to securely upload Python packages to PyPI from GitLab CI / CD pipelines using a “Trusted Publisher” (and without API tokens). Continuously test the release process with TestPyPI on every push. Use GitLab (deploy) environments as an additional security measure.

Typed Settings

I wrote a new settings library that has advantages and disadvantages compared to other settings libraries. With the use cases I have encountered over the last years, the advantages outweigh the disadvantages, though.

Raise … from … in Python

Pylint 2.6.0 raises the new warning raise-missing-from . What does that mean? This post explains Pythons raise ... from ... syntax and demonstrates, how you can improve the meaning of re-raised exceptions by adding their underlying cause.

Attrs, Dataclasses and Pydantic

Attrs , data classes and pydantic seem very similar on a first glance, but they are very different when you take a closer look. In this article, I’ll find out, what these libraries have in common, how they differ and which one I’m going to use in the future.

Packaging Python inside your organization with GitLab and Conda

Conda, GitLab and Docker can be used to manage and publish non- OSS code, e.g. inside organizations. You need some additional tooling for a smooth user experience, though.

The macOS Dark Mode, your Terminal and Vim

MacOS’ new Dark Mode is quite nice, but as a developer, you might also want to switch your Terminal profile and Vim theme – all at the same time, of course …

How to mask an image with a smooth circle in PyQt5

Masking a QPixmap with a smooth circle is not as easily done as one might wish. I’ll show you how to do it with the help of a QImage , a QPainter and a QBrush . I also take care of Retina displays.

Assertions and Exceptions

This article explains the difference between assertions and exceptions and when to use which one.

Getting started with devpi

How to get started with devpi and evaluate it for hosting a company’s packages.

Advanced asyncio testing

I demonstrate how you can use pytest’s fixture system and the plug-in pytest-asyncio to reduce the boilerplate code required for testing networking libraries.

Testing (asyncio) coroutines with pytest

Pytest currently offers no helpers for testing (asyncio) coroutines. Its powerful plug-in architecture allows you fix that and write elegant tests for coroutines.

aiomas – A library for multi-agent systems and RPC based on asyncio

aiomas is a new, asyncio based library that helps you with creating distributed multi-agent systems. It allows different clocks (real-time, coupled to simulations, …) and different codecs (MsgPack, JSON ) to be used. You can also just use the lower level abstractions for RPC or message based request-reply channels.

Master(ing) Passwords

Using good passwords is hard. You can’t remember complicated ones but you also don’t want store them in the cloud. Biometry is not a solution either. The master password algorithm comes to help. There are various implementations of it and I did one in Python.

SimPy: Real-time simulations

SimPy is a discrete-event simulation library for Python. It can perform simulations as fast as possible as well as in real time (or wall-clock time ). This guide describes real-time simulations can be achieved in SimPy.

SimPy: Shared Resources

SimPy is a discrete-event simulation library for Python. This guide describes its shared resources and shows how you can use them to model things like producer/consumer problems.

SimPy: Process Interaction

SimPy is a discrete-event simulation library for Python. This guide describes how you can let processes interact with each other – because this is what makes simulation fun!

SimPy: Events

SimPy is a discrete-event simulation library for Python. This guide describes how events in SimPy work and which types of events SimPy offers.

mosaik – An open co-simulation framework for smart energy systems

Mosaik is a co-simulation framework for smart energy systems. We’ve been working on it since four years now and finally had the opportunity to release it as Open Source Software.

SimPy: Environments

SimPy is a discrete-event simulation library for Python. This guide describes the simulation environments: A simulation environment manages the simulation time as well as the scheduling and processing of events. It also provides means to step through or execute the simulation.

How SimPy works

SimPy is a discrete-event simulation library for Python. This guide describes the basic concepts of SimPy: How does it work? What are processes, events and the environment? What can I do with them?

SimPy 3.0.2 released

SimPy 3.0.2 has just been released. It fixes the default capacity for Container , Store and FilterStore , which is now unlimited.

SimPy 3 released

SimPy 3 has finally been released. It has been rewritten completely from scratch and is now easier to use and more flexible than ever before.

Handling sub-process hierarchies in Python on Linux, OS X and Windows

Windows doesn’t support Posix signals. I’ll show you how you can work around this to cleanly terminate process hierarchies.

Bitbucket stopped rendering README.txt for Python projects [resolved]

Until recently, Bitbucket nicely rendered reStructuredText (reST) formatted README .txt files for Python projects. This made totally sense, because PyPI requires the project’s description in reST and most people …

SimPy 3 Preview

SimPy is a process-based and event-driven simulation framework written in pure Python. It can also be used for multi-agent systems and other eventloop-based applications. After several months of work and …

Check Python site-packages for Updates

A while ago, I found a nice little script called check_for_updates.py which uses PIP to check your installed Python packages for updates. However, it didn’t work under Python …

A Simple Web Bot with Requests and BeautifulSoup

Today I helped a colleague debugging a web bot written in Java. Since I did’t really work with Java since a few years, I thought it would be easier …

Designing and Testing PyZMQ Applications – Part 3

The third and last part of this series is again just about testing. While the previous article focused on unit testing, this one will be about testing complete PyZMQ processes …

Designing and Testing PyZMQ Applications – Part 2

This is the second part of the series Designing and Testing PyZMQ Applications . In the first part , I wrote about designing a PyZMQ application, so this time it’s all …

Designing and Testing PyZMQ Applications – Part 1

ZeroMQ (or ØMQ or ZMQ ) is an intelligent messaging framework and described as “sockets on steroids”. That is, they look like normal TCP sockets but actually work as you’d …

Book review: NumPy 1.5 Beginner’s Guide

I recently got the chance to review the book NumPy 1.5 Beginner’s Guide by Ivan Idris and published by Packt Publishing . It covers many aspects of NumPy and …

SimPy 2.2

SimPy is a process-based discrete-event simulation library written in pure Python. Ontje Lünsdorf and I have already contributed to prior version of SimPy and now have become members of the …

Building NumPy, SciPy & Matplotlib for Python 2.7 on Snow Leopard

A few days ago I wrote about how to build SciPy for Python 2.7 on Mac OS 10.6 Snow Leopard. Usually you want to install NumPy , SciPy and …

Building SciPy on Snow Leopard with Python 2.7

I recently had some struggle to build and install SciPy 0.8.0 on Mac OS X 10.6 Snow Leopard , but actually it’s quite easy. I used the …

Collectors 1.0

It took me nearly three months to fix five small issues with the documentation. But now I finally released Collectors v1.0 . :-) You can read everything important in the RC1 …

Collectors 1.0-rc1

Collectors made a huge jump von v0.1 to v1.0 over the last weeks, since we added lots of changes and consider what we’ve done as stable. If …