Skip to content

Commit 0d380a9

Browse files
authored
add version reporting for API (#1042)
1 parent 3e5f083 commit 0d380a9

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

docs/api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ The `logger.add_log_stream_handler()` function simply creates a stream-handler t
2222
```python
2323
logger.add_log_file_handler(path_to_log_directory)
2424
```
25+
26+
## Report pretext version
27+
28+
If you want to include the current running version of PreTeXt in your app, you can call `utils.report_version` to get a info-level log report of the version, or import `VERSION` from the base of the project and use that in your own log message.

pretext/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,13 @@ def check_for_updates() -> None:
982982
f.write(str(datetime.date.today()))
983983

984984

985+
def report_version() -> None:
986+
"""
987+
Report the current version of pretext.
988+
"""
989+
log.info(f"PreTeXt CLI version: {VERSION}")
990+
991+
985992
def is_pretext_proc(proc: psutil.Process) -> bool:
986993
if proc.name() == "pretext":
987994
return False

0 commit comments

Comments
 (0)