Presentation for Sysadmin miniconf at linux.conf.au 2019
(Online on github.io)
Python is a great language for DevOps tasks. It’s easy to use for automation and offers an end-to-end range of tooling for managing infrastructure on-premise and in the cloud. Scripts are quickly implemented and new features easily rolled out. But what if complexity grows and all of the sudden you find yourself in a complete mess? How do you add a new feature or fix a bug in a script that you struggle to understand because it was written months ago? And do you sometimes see someone else’s code that you like but can't always put your finger on the magic ingredient? This talk is aimed at you if you are reasonably confident reading Python code and want to discover and improve beyond the basics. I'll provide you with ideas and suggestions that will help you stay on top of your coding and will bring it to the next level: Clean code which is easier to understand, more functional, testable and beautiful.
- Virtual Environments
- Pipenv: Python Dev Workflow for Humans
- Pipenv & Virtual Environments
- Python Application Dependency Management in 2018
- The Hitchhiker's Guide to Python / Code Style
- How to Write Beautiful Python Code With PEP 8
- Understanding List Comprehensions in Python 3
- Comprehensions
Most people I know use either PyCharm or Visual Studio Code. The screenshots were taken from PyCharm.
- Primer on Python Decorators
- Jinja's custom filters
- Beautiful CLIs with Click
Some links to resources to see more Python code on a regular base:
- The Python Challenge
- Advent of Code (also look at previous challenges)
This presentation uses reveal.js with these plugins:
It's a beautiful framework.
The Python 2.7 countdown comes from timeanddate.com, inspired by python clock.
The List Comprehension example was taken from Fluent Python: Clear, Concise, and Effective Programming by Luciano Ramalho.