I’ve worked with Python almost entirely from the maintenance programmer perspective. That is, I take other code written already, make edits, add features, and then redeploy it. I’ve created exactly zero greenfield applications in Python. That changes today however, with the creation of the didactic-engine-flask app!
The only prereq to understanding this article is knowing git if you want to get the code, but it isn’t necessary. I’m starting this from ground zero. If you’re just getting started with Python, be sure to read “Getting Started With Python Right!” and “Unbreaking Python Through Virtual Environments” about setting up your environment. These two entries cover enough to ensure you won’t end up with broken, conflicted, and convoluted Python environments.
Mission: Build a Flask based API.
This post is about a singular thing, building an API with Flask. It won’t be about data modeling, databases, or wrapping middleware into the mix. It’s pure and simple Flask, with just the bare necessities needed to get an API working and responding appropriately requests. Continue reading “Using Python’s Flask to Build a Basic API, Creating the didactic-engine-flask”
I wrote some days ago a post “Getting Started With Python Right!“. In this post I wrote about what I’d found to be the best way to setup MacOS for Python development. In it I also added links and a few details to get a Windows or Linux machine setup right for Python development.
However, there’s more, as @tlockney (Thomas Lockney) pointed out in a comment! He detailed,
- Since you’re using pyenv, the version of pip you use should always be the one associated with the current version of Python, which won’t be the case when you later switch versions.
- People who aren’t clear on what’s going on will likely copy the code you included verbatim, so instead of aliasing the version of pip referenced in the pyenv path, it’s going to always point at the brew installed version.
- You really should use virtualenv for pretty much everything and try to avoid ever installing libraries into your global Python environment. If you need tools accessible outside a virtualenv, check out pipx.
Continue reading “Unbreaking Python Through Virtual Environments”
UPDATE POST Added details about virtualenv to complement this post, per Thomas’ comment in the comments section below! Read this post for MacOS specific system Python setup, then read that for more options on how to set things up right!
Recently I sat down to get started on some Python work, specifically on MacOS. I’ve written code in Python before and tried out 2.x and 3.x before. I’m going with 3.x for this and upcoming articles but one thing became apparent. The Python tech stack is still ferociously fragmented in a number of ways, and this post is to provide some clarity if this is your first endeavor into the stack. Continue reading “Getting Started With Python Right!”