Coding 2021-07-07

By Max Woerner Chase

I'm trying to actually use the code I've spent all of this time on, and I'm coming to the conclusion that it needs a lot of scaffolding built on top of it to be usable.

I took a break from writing this post for a bit, and I think the problem I was having is that my initial attempts were too low-level. Instead of writing a helper function per-Action, I need, like, one function that:

One of the other things I need for my workflow specifically is a way to create a file that a pip command can read. This might require changes to the execution model, or maybe there's something simpler I can do.

The crux of this is that my idiom for doing this in a noxfile involved using a TemporaryDirectory to store the file, and thinking about this in the context of the task runner implies to me that I'd need to be essentially running one Action "inside" another.

That would take a lot of effort, and I think a better way would be to put the responsibility for constructing a temporary directory on the application. At that point, creating the file would be a normal Action, and everything could just depend on it straightforwardly.

Hmm. I can mostly see how to do this, but it would be somewhat annoying, and I could just as well put the generated file next to the virtual environments, and it would be much quicker to implement. I'll try that for now, and see if not using a temporary directory somehow bites me.

In any case, I'll need an Action for "write some data to a file", and a helper that adds the file path as a Target.

Something else that's becoming clear to me is that the State concept doesn't actually pull its weight until I'm running parameterized commands, so I just shouldn't bother to start with.

Sketching things out, I basically want to create the virtual environment with the virtual environment directory as the target. I can then have a pip upgrade action that relies on the virtual environment and has, say, the path to pip as the target it exports. So far, so generic.

But the next action I want to set up has a bunch of moving parts: it needs to rely on the upgraded pip, and export an arbitrary set of targets, and also rely on a target that's passed in as part of the environment to this action's pip command.

That's, like, a lot.

I'll have to think about this a bunch before I write the helper, but I can at least write the Action to write data to a file.

I'll do that, then get to bed.

Good night.