Python tutorial cleanup
(This PR is not yet complete; opening as a Draft PR to get discussion and input)
The tutorials for the python bindings are in need of a lot of love. As of right now, this PR does this:
- Fix horribly wrong usage instructions
- Format everything with Black ~~for PEP8 (mostly, though some >80c lines are there)~~
- Fix wrong comments leftover from C/C++ port
- Ensure images are installed so the tutorials work there too as-is
- Updated imageio usage to avoid deprecation warnings
- Add README_python.md to the install
There are a couple of gotchas here, though:
(1) A lot of the tutorials were never ported to Python; we only go thru 14, while C++ goes up to 21. This isn't likely a big deal, porting them is mostly plug-n-chug. But...
(2) The structure of the stuff in the tutorials relating to AOT and Generators needs a complete overhaul. When the tutorials were first written, Generators didn't exist, so lesson 10 talks about AOT via direct calls to compile_to_file(); lesson 11 is about cross-compilation, using the same approach; lesson 12 is about GPU usage, and as a convenience there, it uses a generator-like class that is not a Generator.
At this point in time we really want to steer people towards Generators for AOT use, so this PR actually removes lessons 10-12 from Python entirely for now. What I think we (well, I) should do here is this:
- remove existing lessons 10-12
- move the existing lesson 15 (Generators) to lesson 10 and bring it up to date, focusing only on JIT usage (since all the tutorials up to then are JIT)
- make lesson 11 be about AOT (via Generators)
- make lesson 12 be about cross-compilation
- make lesson 13 be about GPU
- renumber the rest of the lessons appropriately
I think this would be a more useful ordering of lessons for recent Halide, but it would (at least initially) diverge from the C++ tutorials in terms of the numbering, etc. (In the medium-to-long term we would bring the C++ versions up to date with the Python versions.)
What do folks think?
(Removed now-irrelevant comment about imageio, obsoleted/fixed by #7125)
What's the state of this? Can I help to bring this PR over the finish line? I have the feeling that already merging this as-is is a huge improvement over the status quo and would have made my life starting with halides python bindings a lot easier :)
Steven is currently away, so it's unlikely to get any attention from him in the next month or so. If you'd like to take it over and get it over the finish line, that would be welcome.
What would be needed for this? Just a rebase to the current main?
For a start yeah, but the thing it really needs is for a python user of Halide to go through it and check it all makes sense.