styles icon indicating copy to clipboard operation
styles copied to clipboard

Drop requirement for consecutive lesson numbering

Open tkphd opened this issue 3 years ago • 2 comments

lesson-check.py currently throws an error if the files contained in _episodes are not numbered sequentially, with an increment of one. This seems arbitrary, and forces a global renumbering when an episode is added or removed. A legitimate numbering scheme might increment by 5 or 10, since two-digit numbering is required. In development, or in a hybrid lesson, interstitial episodes might be inserted as well, so having spaces in the numbering is helpful for some common corner cases.

Recommend removing the block, "Check that numbers are consecutive," from the lesson-check script. Alternatively, that block could be replaced by a "Check that numbering is numerical," using seen[i].isdigit().

tkphd avatar Sep 11 '20 17:09 tkphd

Hi Trevor,

seen[i] will always be a digit because of the pattern we use https://github.com/carpentries/styles/blob/a8eee52a26c41f45902837dd6ed97b986f4690a9/bin/lesson_check.py#L42 and the matching we do: https://github.com/carpentries/styles/blob/a8eee52a26c41f45902837dd6ed97b986f4690a9/bin/lesson_check.py#L289-L291

so we don't need that isdigit() check and can drop this block. Question: do you want to use numbers in your episode names? If not, you could use manual episode ordering and drop numbers from episode names altogether. Of course, this doesn't mean we don't need to tweak lesson_check.py -- we'd have to adjust the else part of https://github.com/carpentries/styles/blob/a8eee52a26c41f45902837dd6ed97b986f4690a9/bin/lesson_check.py#L290-L294

maxim-belkin avatar Sep 11 '20 18:09 maxim-belkin

Ah-ha, thanks for highlighting the regular expression match. Very nice.

We don't need numerical episode labels, and the manual numbering looks like it has some advantages -- at the expense of the current simplicity. I would prefer to maintain number labels for the HPC Carpentries, but it's good to know an alternative exists.

tkphd avatar Sep 11 '20 19:09 tkphd