DEV Community


Discussion on: Are you using Docker for local development?

mateusz__be profile image
Mateusz Bełczowski Author

Thanks for the detailed answer! I'm also a Python developer and use Pycharm as main IDE (Neovim when doing small edits).

Pycharm allows to easily select single test class or single test to run, but under the hood it just calls "docker-compose up python test".
Having to "docker-compose up" it, slows down the whole process by at least few seconds. It does not sound like a lot, but can be inconvenient.

As an alternative, I could what you suggest - have a project running with docker-compose up and just execute single test by calling "docker-compose exec python test".
It runs much faster, but has the downside that I have to manually type the test name (or path to it).

That's why I'm looking for something that could combine both solutions when working with Pycharm.

Do you find your workflow with tmux + VS Code convenient? Do you just switch tabs between them or keep them in separate monitors?

patryktech profile image

I only have one monitor, but I do a ton of work in the shell, so I use yakuake. I just press F12 on my keyboard, and the terminal slides down from the top of the screen, covering 90% (can easily change it). Run my commands (e.g. git commit -m && git push), press F12 again to hide it, and go back to my browser where I can monitor my Gitlab pipeline. (Or back to VS Code, or whatever I was doing).

I also use KDE plasma with virtual desktops, so I have VS Code on Desktop 2, Chrome on Desktop 1... <ctrl+alt+left> or <ctrl+alt+right> switches to the previous/next desktop, so jumping from VS Code to Chrome is also really fast...

Never tried PyCharm properly, but VS Code is really simple to configure, with a few extensions it works great (linting my Python and JS code).

I do run the test commands manually, but if they are complex enough, I can write an alias or bash script. I usually run Jest in watch mode anyway, so I run the command once when I start working, and often just let it run for days.

Pytest also has at least one watcher, but I haven't tried it. Since my terminal is practically always running, I type the command once, then my flow is:

  • Press F12 to bring up yakuake, press the up arrow to repeat the last command (or a couple of times to re-run an earlier one), and press enter. Press F12 again to hide the terminal. Sometimes I wait for the tests to finish ahead of time, sometimes I just go do my stuff and look at the results later.