DEV Community

Discussion on: How I set my Linux computer for coding

Collapse
 
timepieces141 profile image
timepieces141 • Edited

I love powerline for my terminal, especially seeing what branch and/or virtual env I'm in: powerline.readthedocs.io/en/latest/

If you write in Python you can't live without virtual environments. So virtual environment wrapper is essential: pip install virtualenv virtualenvwrapper. I know python3 comes with venv, but I've never invested enough time to figure out if virtualenvwrapper still works with that, and I can't live without virtualenvwrapper.

People have already mentioned docker, but I just like to point out that even if a docker image is not your final artifact, they are a great tool for allowing any developer to run your unit tests regardless of how they have set up their development system, specifically OS (now that docker is on the big 3). And anything that allows your developers to run your code in a repeatable environment will save time, and that very same process can be used on your CI/CD server.

Collapse
 
mendoza profile image
David Mendoza (He/Him)

I haved never seen powerline, but now I love it hahaha, you know I think is an old habit of not using virtual environment when I was leaning python people always install everything global, I haven't used any virtual environment for that, but I hope I can give it a try, oh and docker... I know... I know haha it's that I don't always do unit testing so I thing right now is not necessary plus it's a beginners tutorial

Collapse
 
timepieces141 profile image
timepieces141

Well, I am 20 years into this and if there is one thing I could advise beginners, it's to write your unit tests from the very beginning. It's far easier to update a unit test than it is to take time out to write unit tests for an entire code base that is lacking them. And in languages that are interpreted instead of compiled, such as python, it's your quickest and easiest way to catch simple logical errors. And you get syntax and typo checks for free. Add in linting, and you have a simple workflow that produces an incredibly low rate of bugs. Saving time is the name of the game.

As for the virtual envs, I also see this as a way to reduce bugs - specifically dependencies in setup.py. While working, one might determine they need a library, install it, write the code, and move on, forgetting to add it to a requirements file. Creating a new virtual env from scratch to run your unit tests right before you push to git removes the potential for missing dependencies. And you can roll that whole process up into a script. I create an env, run pytest, run pylint, run coverage, run an HTML report, and destroy the env all in a bash script. That, or run it in a fresh docker container.

Collapse
 
shmink profile image
Tom Nicklin

Have you been using unix long?

Thread Thread
 
timepieces141 profile image
timepieces141

Pure Unix, no. We had a few Spark boxes at the beginning of my IT days. But soon after everything was Red Hat flavor Linux. By the time I had migrated into software development, Ubuntu was gaining popularity. Not sure the IT department ever left RH, but cyber devs did favor Debian-based.