-
Notifications
You must be signed in to change notification settings - Fork 29
Refactor version extraction with regex #1116
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
Changes from 1 commit
fe0ebd9
9daf624
5e47f3e
8671c2e
1b8c43d
3bd8a1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |||||
| import logging | ||||||
| import logging.handlers | ||||||
| import psutil | ||||||
| import re | ||||||
| import typing as t | ||||||
| from . import types as pt # PreTeXt types | ||||||
| from lxml import etree as ET # noqa: N812 | ||||||
|
|
@@ -133,9 +134,10 @@ def requirements_version(dirpath: Optional[Path] = None) -> Optional[str]: | |||||
| return None | ||||||
| try: | ||||||
| with open(pp / "requirements.txt", "r") as f: | ||||||
| REGEX = r"\s*pretext(book)?(\[.*\])?\s*==\s*(?P<version>[\d\.]*)\s*"gm | ||||||
|
oscarlevin marked this conversation as resolved.
Outdated
|
||||||
| REGEX = r"\s*pretext(book)?(\[.*\])?\s*==\s*(?P<version>[\d\.]*)\s*"gm | |
| REGEX = r"\s*pretext(book)?(\[.*\])?\s*==\s*(?P<version>[\d\.]*)\s*" |
Copilot
AI
Mar 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requirements_version() parsing logic changed, but there are no targeted tests covering supported requirement lines (e.g., pretext[prefigure] == 2.36.0, pretextbook == ..., whitespace variations). Add a unit test to lock in the intended matching behavior and prevent regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reis imported twice in this module (already imported earlier). This will trip linters and is unnecessary; remove the newly added duplicate import.