Learning Python as a Platform Engineer-First Steps

Posted on Fri 01 January 2021 in Leadership

I've relatively recently moved into a Platform Engineering position after working in very developer oriented teams for many years. What's interesting is that the engineers you work with have much more diverse and interesting backgrounds in terms of their experience, so there's a real opportunity to grow and learn a lot more, as opposed to a more homogenous set of developers. With that in mind, I wanted to put together materials on how a more ops focused engineer can up-skill in Python(as that's more my wheel-house), in particular what are the things that would help you move into a more Python-focused role.

Where to start

Beginners who have no experience of Python are going to need to get their head around the fundamentals. I wouldn't avoid reading books, but you're going to get more impact delivering. Prioritise writing and reading code over anything else. One thing I'd always suggest is to try automate parts of your life with code. There's a great book called "Automate the boring stuff with Python" if you need inspiration to focus on delivering.

Personally, when I needed a refresher in Python after several years of NodeJS, I started writing scripts that helped me to refresh myself. I wrote a script to alert me of the most up to date bus arrival times from TFL just before I'd usually leave the house in the morning, so I knew what time I had to leave.

On an ongoing basis, I maintain a simple Python project on an ongoing-basis that will watch a YouTube channel and automatically download any streams that appear. I use this project to test out things is like to try out, such as new libraries or programming concepts. It's a safe way to try things out before I might suggest using it at work.

So to start with, pick a project.

What to avoid

Don't read books and not output anything! It's a trap of feeling productive while avoiding cementing any learnings. Think of it this way, you don't want to "learn to code", what you are is lazy and what you really want is to solve boring problems with code. You're learning to use a hammer, find nails in your life to start banging away at!

Also avoid getting bogged down in setup. As an ops engineer, you might lean more into what you're comfortable with. Just get something super basic working and don't waste too much time on setup or use repl.it and forget about it! Heck I even wrote a post on coding on my iPad.

Set a goal

Don't set a vague goal when learning to program, getting "better" doesn't mean anything. Programming is about delivering projects and learning what works and what doesn't. Focus on delivering small projects that help you in any small way and iterate on complexity. Don't be afraid to set clear goals for yourself and share them with others.

If it helps try to think about it as a maturity vs capabilities. You don't "mature" to be a developer, what would that even mean? Think of it more as adding capabilities to yourself, "I'm capable of writing a Python script, I'm capable of writing some tests, I'm capable of using boto to interact with AWS automatically". Avoid thinking "I'll read a bunch of books and be a developer some day".

So set a goal of delivering a specific project at a specific date.

Figure it out

Now it's time to start figuring out how to solve this problem you've set for yourself. At this stage I would say, look for what works best for you. Could you learn the basics more from say a book, a series of articles, a Udemy course? I've put some resources at the bottom of this post but this step really only you can define.

The one thing I would recommend is getting good at reading documentation, try to read up using the Python docs first before using Google/SO, but it's fine if that's what you need to do.

Asking for help

If you get stuck, ask for help. Ask colleagues, if you can't ask them, ask on Stackoverflow or find a Python discord or IRC channel for example: https://pythondiscord.com/ and reach out. I can only speak for myself, but I always love helping people genuinely trying to learn but just getting blocked. If you can't find any help at those resources and have some cash to spare, you can always use a service like https://codementor.io to get the expertise you need.

Automate your (platform) life

From a more platform-focused perspective, if you have say, manual things you do in AWS repeatedly, could that be turned into a quick script? Take a look at boto3 and see if there's anything that could save you some time every day.

Some inspiration:

  • When an incident occurs in the systems you maintain, are there several things you might check depending on the type of incident that occurs? Perhaps you could automate pulling out some key data on your local machine to save some critical time.
  • Rotating keys, setting up users, any other admin tasks you could use avoid logging into your cloud platform?
  • Are there parts of your job where the UI of your cloud-provider of choice is a total pain(cough Cloudwatch… cough)? Perhaps you could avoid it by programming a solution.

Resources

In terms of resources you can use:

This is definitely enough to get a platform engineer started, I'll expand on this series with next steps, so keep an eye! I'll also start documenting how I'm growing from a Developer into a role demanding more Ops capabilities when I feel more comfortable myself.