Coding 2021-07-04

By Max Woerner Chase

Oh boy...

I threw together a Cmd class, but I don't have any tests or attempts to use it yet. Let's see what I can come up on the spur of the moment.

I'm going to want virtualenv creation, which is going to look like:

python -m venv --clear <path>

The generator for that needs to create an action and a target parented to that action, with the target being <path>.

It should somehow make it easy to create Cmds like

<path>/bin/<cmd> <args>

One thing I want to work out is how to deal with commands that parameterize kind of all over the place. Like, pytest commands need the particular virtualenv they're running under, the top-level executor, the core of the command, and then the testpaths and related arguments.

I'm thinking maybe something like...

def cmd(args: typing.Sequence[str], prefix: typing.Optional[str], env: typing.Optional[typing.Dict[str, str]], allowed_codes: typing.Sequence[int]) -> Cmd:

I think I'm going to need to revisit my sketches of how different commands fit together, and where some of these names should come from.

Trying to run through the organization some in my head. The two main axes of difference are "which project is being accessed", and "what is being done". Because whether or not a given task has project-specific behavior depends on the task, the higher-level organization is the different tasks, and those different tasks should be parameterized by the list of projects. If I try to come up with a class for everything, it looks like my pytest stuff needs some kind of core pytest command and wrapper classes to annotate it with stuff like extra inputs and outputs. I think this is the way to go, yeah. The classes are dataclasses, and they define iterators that produce their relevant changes, and also have attributes and properties representing various things they expose according to interfaces.

I'm not sure when I'll have the focus to put this together. Maybe I'll manage it in the next few days, maybe I'll need to take another break and get to it in a week. We'll see. Anyway, it is way too late right now.

Good night.