Okay. I've rewritten the body of the prototype config file so that the business logic is all in a giant generator function. This is in a temporary state of code smell, in that the generator function is larger than most of the modules that it relies on. BUT, this rewrite has made it clear how I need to proceed.
In essence, there are several axes of variation that a command can be subject to, with pytest varying the most. The axes I've seen so far are:
- Which subproject the command applies to (this doesn't apply to the task runner repo, at least not currently, but I need it)
- What command is getting applied. In the case of pytest, this effectively gets split into:
- What runs pytest
- What arguments pytest runs with
The interfaces I want to be able to handle all of this properly are:
- Project This class must provide interfaces to add a prefix to a dirname (which should lead to a path in the repo), or to add a suffix to a dirname (which will be used to generate report directories)
- Session This interface takes a mapping from str names to Projects, and yields all necessary changes to the registry.
- PytestCommand and PytestRunner. These combine together to create a Session.
While all of this should allow me to crunch down the config file pretty aggressively, my main motivation is to extract out reusable components so that all of my config files can be crunched down like this, and also able to get bugfixes.
I think the next step for me to take is to review the current api module, and to start splitting it up into modules in an _api sub-package. Once the application code is tidied up so, I can resume pulling stuff out of the config file prototype into it.
I have no idea how long it is until an initial release at this point, but the state of the code is much more satisfying than it was a week ago, so that's nice.