possee-org / genai-numpy

MIT License
4 stars 6 forks source link

Task: Add `# may vary` tag to random output, and automate line length issues #96

Open bmwoodruff opened 3 months ago

bmwoodruff commented 3 months ago

Description:

The current reviewtools.py file process_text_block does not check for

This causes two problems:

  1. When running spin lint, the generated examples will fail if longer than 79 characters (thanks @jud-sdev for help in #87).
  2. When running python tools/refguide_check --doctests, random output will fail (thanks @ogidig5 for help in #86).

I'd like to automate much of this.

Acceptance Criteria:

bmwoodruff commented 3 months ago

Looks like black is designed to format long code, so that may work. I'll have to substract the indent (and may be the >>>) from the length, but I think this will work for getting input code lengths shrunk to under 79 characters. I know they're planning to increase the limit to 88 soon. If they get that done before we're done, then we swap a number.

The package textwrap will format long strings. This works for the headers between code blocks. If they are multiline, then combine them into a string before wrapping them and then writing them.

I'm not yet sure about formatting the output cells to be 79 or less.