Andrew Latham

Python the programming language and versions

Over the many decades Python has become a very stable language. From version to version more things are alike than different. In the last fire or more years people new to the industry have shown their cards by claiming it can't be done.

Not that hard

As I continue to hear sob stories about how hard everything is I keep reaching back to as you can see from the page the date and content show that it is not hard to support various versions if that is a goal.

Personal exp...

Almost exactly three years ago in 2014 I did a fast conversion of Ansible to work with Python 3 in PR 8322 which ended up in a land of personal preferences and overly complex solutions to simple problems. I have worked on converting other projects like PyPXE and Saltstack. In each case I hit walls where confusion is apparent and in every case I am supplying working tested code to prove it works.

Take away

Write better software, think about the future and the past. Work on problems like anything is possible because it is. Develop good clean interfaces and standard APIs in such a way that the software could be written in any version of any language and operate the same. Think before you code.

This rant was brought to you by Andrew Latham in a frustrated situation attempting to understand the lack of effort.

Python Testing

Testing is not hard, don't make it hard.

Andrew Latham

Working on I have setup some testing that runs every time and I want to talk about it. I have worked on software in industries that could benefit from testing, coverage and style checks but the organizational impact causes testing to be a pretty harsh hurdle. Some amazing work has gone into bypassing testing in many industries. Here in this post I am discussing some testing, coverage and style checks that lower the bar and make it easy to use. The testing does not stop the operation or development. The code coverage report is useful. The style check is more of an indicator than anything else. This is a discussion and a process. Enable everyone from support to operations with that warm fuzzy feeling that testing is the new norm. Show the developers that testing is not a blocker.

Andrew Latham

Python CLI Webserver

If you ever need or want to create a webserver with the files in the current directory listed then just use this little snippet.

python -m SimpleHTTPServer

It will inform you of the address it is listening at or you can set the port via

python -m SimpleHTTPServer 8080

With Python 3 you might want to use:

python3 -m http.server

The same method of setting the port with Python 3 too

python3 -m http.server 8080