Coding 2022-12-14
All right, let's take a look at MOTR's code...
My goal here is to trace things back from the flake8 test. Let's see how this breaks down...
- test_flake8.make_changes defines a function called make, which takes two arguments: parametric and package_data.
- package_data is passed into api.cli.build.build to return Facts[Objects], and inject information about which Python versions to use for flake8. The package_data comes from api.package.combine_packages. This is a PythonPackages object, and the relevant behavior partially lives in the constants defined in that package, and partly in api.cli.build.build(), which puts the necessary values under the necessary keys. TODO: make a helper function in package for carrying out the changes, rather than having them done in the return statement of api.cli.build.build().
- parametric pulls in the information from the modified Objects, and the argument further down is from api.cli.flake8.BASE.add_parts(...).build(). This add_parts() return value is a ParametricCommand. Its build() method calls the command_builder.CommandBuilder.facts() method from the _build() method, which is really complicated, but I think the important thing is the ParametricCommandMeta that had with_adaptor() called on it.
Okay, I'm lost again. Let's check out the facts() method? Oh, wow, my names for these things got janked. Basically, at some point, parametric information about how to construct the specific strain of environment required for the operation is injected into the ParametricCommand via with_adaptor(), and the build() method on that object retrieves it, and passes it to facts(), which combines it with the installer_registry data to pass it to installer.install(). The installer_registry is on the command.Metadata, and is, in these specific cases, populated from the PythonCmd helper.
So, for a synthetic version to work, I need to create a command.Metadata that has the desired installer data stored under a known key. In addition, I need a versions adaptor wrapped around a known key, which needs to be explicitly passed in, associated with a PVector[installer.PathWith[EnvironmentArgs]].
I apologize for how completely and thoroughly opaque that was, but I needed to go over this really thoroughly in order to remind myself where everything actually gets instantiated.
Maybe tomorrow, I can actually do something with all of this. For now, I'm done.
Good night.