Coding 2022-05-02
I got a bit distracted earlier today learning about using mypycify. I managed to get it working with setup.py, but I kind of don't want to deal with setup.py files. I tried to get it working with enscons, but I didn't find anything that seemed to work out of the box, so I'm going to have to learn more about setting stuff up with SCons. Or suck it up and write a setup.py when I want to mess with mypyc. Eeeennh.
Anyway, let's shelve that for now and see about improving my test code over in MOTR. But first, thread.
Okay, just did the easy quick one. That looks like:
@pytest.fixture(scope="session")
def make_changes(api):
"""Create a factory function for making requirements generators.
The motivation for this was, admittedly, mostly to get rid of a coverage
miss.
"""
def make(python, dynamic, package_data):
def changes():
objects = yield from api.cli.build.build(package_data)
yield from dynamic.map(
lambda command: command.requirements(python), objects
)
return changes
return make
Now for the other one.
Okay, that's done-ish, but I don't want to copy a snippet to show off, because the changes are spread across three different files.
Basically, I made a helper class that bundles up a bunch of common operations to reduce the amount of irrelevant details exposed via the API.
Anyway, the code is more concise, but the bad names are starting to really grate on me, so that's what I want to focus on next.
For now, I'd better get ready for bed.
Good night.