• +43 660 1453541
  • contact@germaniumhq.com

Tagged: python-development

Force Named Argument Calling in Python

When calling functions in python, it makes sense to name the arguments, since they convey what values mean. A call to update(3, 5) is communicating less than update(major_version=3, minor_version=5). So how do we enforce that?


Read more

Why I Still Do Non Pythonic Checks

Sometimes things in life are simple. Python in particular allows checking if iterables or strings are empty, and if values are False, with just the not operator. Sometimes life is not that simple :).


Read more

Venv, a Better Virtualenv

If you like me like to create virtual environments for everything, then you'll already sold on the idea of virtualenvs. The good news is that since Python 3.3 there's a new module part of standard python: venv.


Read more

How to Type Keys Using Germanium

One of the most common interactions in browsers is writing keys. Germanium has a trivially simple API to type keys, that includes shortcut handling, and special keys such as . Here's how:


Read more

The Best Programming Language

Roughly 10 years ago, there used to be a time when I really believed Java was the answer to almost everything. JSF2 was just appearing, and the component model they had was amazing. GWT was out in full swing, with the plan to conquer the world. EJB3 were the next big thing. Ten years later it is all dust. Sic transit gloria mundi.


Read more

Creating Replacement Shell Scripts in Python II

So in the yesterday's article I ranted on why shell scripting in general, with bash in particular is terrible. But there's a reason why we write shell scripts, namely that we're in the same domain of the commands that we know. Here's how to use the same knowledge in the python scripts:


Read more

Replacing Shell Scripts With Python I

I have a love hate relationship with Bash. On one hand, I have a lot of scripts still running on it. On the other hand, almost all of them were started before I consciously decided that for most things I'll switch to Python. Here are 5 problems that I see with Shell programming:


Read more

Creating Python Handlebars Helpers

If you're using handlebars in python, you're probably using pybars3. In handlebars most commands are defined by the language, such as {{if}} or {{each}}. What you need to know is that you can also write your own helper functions to extend the language. Here's how to implement a switch clause:


Read more

Python Unit Testing

Python has bundled into it a rather decent testing framework, that resembles a lot JUnit, named unittest. This is packaged in the core python, and it's simple to use. While I'm a big fan of Behave, sometimes, especially if testing low-level APIs, it's less verbose to just write a core python unit test. In this article we explore how to create our first test.


Read more

Creating WebDriver Browser Instances With Germanium's open_browser()

If you want to open a WebDriver browser instance using Selenium, you need a few steps. The binary driver available is required to be in the PATH, and you need to create a specific configuration object, depending on the browser type, to get the browser instance. In Germanium it's only open_browser("chrome"). Since Germanium is Selenium, how is that working?


Read more