Welcome

Write a code in least surprising manner possible

EuroPython 2023

My takes from EuroPython 2023 in Prague Wednesday, 19th July, 2023 Kindnesses & Promises Personal experience of a community organiser Petr Viktorin. It felt a bit out of scope for me because Petr spoke about his path through life (we all have some) and emphasized the importance of community in Python. Community is not the most important thing for me in Python - the actual engineering part of Python is. From the members of the Python community (people who know each other and meet often at meetup) it seems that it is a necessity or essential progress, but I think that a lot of people can be part of Python, contribute to it and not be part of this community. ...

July 21, 2023 · 6 min
Generated by DALL-E 2

My foundations

⚠️ This is going to be personal. When I was a kid I wanted to be a lot of things: an inventor, a magician, and a psychologist. That’s why I’ve become a software engineer. Bear with me, it will (hopefully) make sense. Up until university I never really understood what programmers are doing at work because I could not imagine how writing simple calculators - the way how I was learning programming - is by any means useful. And I was right. Just writing the code is only the tip of the iceberg. ...

March 5, 2023 · 3 min
Mindmap

Morning Talk - Python Evolution

On Thursday, February 2nd, 2023, I had the pleasure of delivering a morning talk on the topic of Python Evolution. The topic covered the modern environment, new syntax, and trends in the world of Python. During the presentation, I tried to give an overview of the most interesting new developments in Python over the past few years. However, there was so much to cover that I had to leave out some of the really cool stuff. ...

February 2, 2023 · 1 min
Generated by DALL-E 2

O historii firmy H1V3

Vize CEO startupu H1V3 byla, že komunikace pomocí mluvení nebo psaní patřila do propadliště dějin a v 21. století bychom měli mít možnost sdílet své myšlenky pomocí moderních technologií. Rozhodl se tedy využít Neuralinku, technologie, která umožňovala propojit lidský mozek s elektronikou. H1V3 se nesnažil interpretovat myšlenky, které z Neuralinku vycházely. Experimentoval s přenosem nezměněných dat z jednoho Neuralinku do druhého. Zjistili, že lidské mozky jsou si vlastně navzájem docela podobné a dokážou interpretovat myšlenky toho druhého bez nějakého nutného porozumění elektrickému signálu mezi nimi. Díky Neuralinku tak byli schopni docílit telepatie - komunikace beze slov. ...

September 26, 2022 · 4 min

Where good engineering practices would save the day - talk at PyCon SK 2022

Recording of my talk at PyCon SK 2022 is out! It was my first conference talk and I was quite nervous, as you can see. On the other hand I think I attracted attention of the audience, manage to end up on time and hopefully passed the intended message. I really enjoyed it after all and I’m looking for next opportunities. To make it better next time I need some feedback. So please, if you have anything to say about the talk please write me a private message. ...

September 26, 2022 · 1 min

Snakepit contest at PyconSK 2018

I’ve attended amazing conference Pycon SK in Bratislava 2018. Part of the programme was a contest in a game snakepit (contests info). It was a nice game where contestants should write a behaviour of snake from the old game we all remember from childhood. Instead of paying attention to the conference talks the contest has absorbed me and I created quick and dirty idea of how should snake play the game. There was 11 contestants and my snake artimi0 end up at the third place! ...

March 11, 2018 · 2 min

Environment for efficient Python Programmng

In this article I would like to describe few tools I’m using everyday to be efficient Python programmer. There is multiple approaches how efficiently control your programming environment but I have converged to this set of tools. I’m looking from any tool that I’m using at work to be easy to learn i.e. having shortcuts always somewhere visible. controlable by shortcut that can be carved in my muscle memory. capable of fast perfomance tasks I’m doing quite often. So when we have my criteria stated let’s go to see what’s worth using and learning. ...

September 7, 2017 · 4 min

Winning application for Wood Coding Challenge

As some of Python community here in Czech Republic know there was held programming contest called Wood Coding Challenge organized by Wood & Company. The task was to create stock exchange using Python / C / C++ that runs on TCP sockets communicate by JSON messages and presents solid engineering abilities. You can find whole description of task at the website of the contest. This certainly had my attention and during two months I completed this challenge. I spent 50 hours of my evenings to code this up. I chose to write it in Python 3.5 using Asyncio as it was preferred library used by organizers. I learned a lot of Asyncio and it seems to be right tool to write asynchronous code. ...

July 19, 2016 · 3 min

Reloadable containers for Python

We often face an issue that our long running services need some parts to be reloadable without restart of such service. To achieve this I implemented simple abstract class that wraps any container we could use. You can find whole example at my Github page. from abc import ABC, abstractmethod import time class Reloadable(ABC): """ This class wraps a container and expose all its methods. It reloads its content after `reload_every_secs` from `path`. """ def __init__(self, path, reload_every_secs=60): self._path = path self._last_update = time.time() self._reload_every_secs = reload_every_secs self._initialize_data() self.reload() def reload(self): self._last_update = time.time() try: with open(self._path) as f: self._fill_data(f) except FileNotFoundError: self._initialize_data() @abstractmethod def _initialize_data(self): """Change container to initial state""" pass @abstractmethod def _fill_data(self, fp): """Fill data from file to container self._data""" pass def access(self): if time.time() - self._last_update > self._reload_every_secs: self.reload() def __getattr__(self, item): return getattr(self._data, item) def __len__(self): self.access() return self._data.__len__() def __getitem__(self, item): self.access() return self._data.__getitem__(item) def __setitem__(self, key, value): self.access() return self._data.__setitem__(key, value) def __delitem__(self, key): self.access() return self._data.__delitem__(key) def __iter__(self): self.access() return self._data.__iter__() def __reversed__(self): self.access() return self._data.__reversed__() def __contains__(self, item): self.access() return self._data.__contains__(item) def __str__(self): self.access() return self._data.__str__() As you can see this class just wraps not specified container and whenever we want to interact with it somehow we trigger function access(). To actually use it simply implement two methods _initialize_data and _fill_data and you will have your container reloaded every few second as you can specify. ...

July 12, 2016 · 2 min

Round-robin in Celery

Recently we faced an issue how to fairly distribute computational resources for our imaging service using Celery. The imaging service does some basic operations with image like resize. We chose Celery to distribute work among our workers. The service works with chunks of 1000 images that is processed in batch. We wanted to avoid situation where one large client uses all processors on a worker and other smaller clients would have to wait. To achieve this we needed to create special queue for each client. Celery worker then takes tasks from all queues in round robin fashion. The problem is that we do not know what clients will be using our service in future and thus we needed to add queues for them dynamically. To dynamically add new queue and more consumer for it call following method: ...

July 11, 2016 · 2 min