Octoprint, Brian and Charles, and Python Virtual env: ttftw 2023w09
By Robert Russell
- 3 minutes read - 466 wordsThree things from this week.
This week I’ve been following a lot of random threads again. Here are a few of them.
Octoprint
If you use a 3d printer you might be interested in Octoprint. It runs on a computer connected to the printer and handles a bunch of features like managing prints sent to the printer, tracking progress, or (with a webcam) streams video of the printer while it works. The most basic way to use it is just as a print server that integrates with software like PrusaSlicer and OpenSCAD.
I ran Octoprint 8 years ago for my first 3d printer. The Solidoodle Press wasn’t supposed to need a lot of tinkering but I made a lot more mods to it than I ever planned. This is one of my favourite prints to come off of it.
That printer was replaced a long time ago but I never got around to setting up Octoprint again until just this week. I’m looking forward to making some print timelapses.
Brian and Charles
We watched Brian and Charles this week. It was fun and quirky as you’d expect from the first scene. It was also the correct length for a movie: 90 minutes.
Getting used to Python virtual environments
A Python venv is a way to install some Python libraries without touching your systemwide Python libraries. It’s often recommended by projects but I’ve been tripped up trying to use them in the past. Basically you make a directory, activate the virtual env, and your Python paths all point to files inside that directory. What I’ve found is that I usually don’t want to use a venv for libraries or projects I’ll use a lot. What I noticed this week though is that I’ve happened on a pattern with using a venv for something I install on a lark feels like it lowers the risk.
What I do is
git clone some.weird/project
cd project
python3 -m venv .venv
. .venv/bin/activate
pip install -e requirements.txt
This week I tried out a few text-to-speech projects and one of them did get pretty mangled. When I decided that I was going to back away, all I had to do was deactivate
and delete the directory. Notice that I put the venv in a subdirectory of the project named .venv
. So all the libraries that might have been half-installed or corrupted are gone.
A virtual environment for Python isn’t perfect isolation but it’s a lot faster than a Docker/OCI container, which I see as the conceptual next level in isolation effort. All the commands are in my terminal history so they’re just a ctrl-r
away.
Oh, one more thing
Here’s a random sample of Wikipedia pages I visited this week