Coding 2021-08-02
I mostly took things easy today, did some work just now on one of my secret-ish projects.
Anyway, yesterday I mentioned not being happy with the Venv class in the configuration prototype. That is because of its public interface. It has four functions:
- create()
- update()
- install(*args)
- command(cmd)
And it only makes sense to call them in that exact order. (Basically, the filesystem is acting as hidden global state.) At the same time, there are reasons to want to vary some of these calls.
Here's what I want for each stage, more or less:
- Creation: this should have access to a root global, a path value that, in future, should be possible to change for the duration of an app execution; it should have access to a unique name; it should have access to an optional Python version string; these two should be combined into a name that is used for any Actions, and this name should combine with the root to create a path object pointing to a bin dir.
- Updating: this needs access to the action name and the bin dir from the previous step; it should produce the path to pip, alongside the action name and bin dir.
- Installation: this uses the action name and the pip path; it should produce the bin dir and the name of its Action.
- Command registration: this uses the bin dir and the name of the installation action.
From this, I can put together a rough sketch of helpful data types:
- CreationResult with fields for "action name" and "bin dir"
- UpdateResult with fields for CreationResult and "pip path"
- InstallationResult with fields for, either "bin dir" and specific action name, or specific action name and CreationResult
I'm unsure which of those last options makes more sense. I don't want to move forward on this until I have an answer that I find satisfying.
Anyway, I don't want to let things go any later, I'm pushing myself as is.
Good night.