Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop requirement for consecutive lesson numbering #502

Open
tkphd opened this issue Sep 11, 2020 · 2 comments
Open

Drop requirement for consecutive lesson numbering #502

tkphd opened this issue Sep 11, 2020 · 2 comments

Comments

@tkphd
Copy link
Contributor

tkphd commented Sep 11, 2020

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().

@maxim-belkin
Copy link
Contributor

Hi Trevor,

seen[i] will always be a digit because of the pattern we use

P_EPISODE_FILENAME = re.compile(r'(\d\d)-[-\w]+.md$')

and the matching we do:

styles/bin/lesson_check.py

Lines 289 to 291 in a8eee52

m = P_EPISODE_FILENAME.search(base_name)
if m and m.group(1):
seen.append(m.group(1))

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

styles/bin/lesson_check.py

Lines 290 to 294 in a8eee52

if m and m.group(1):
seen.append(m.group(1))
else:
reporter.add(
None, 'Episode {0} has badly-formatted filename', filename)

@tkphd
Copy link
Contributor Author

tkphd commented Sep 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants