Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ The `logger.add_log_stream_handler()` function simply creates a stream-handler t
```python
logger.add_log_file_handler(path_to_log_directory)
```

## Report pretext version

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.
7 changes: 7 additions & 0 deletions pretext/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,13 @@ def check_for_updates() -> None:
f.write(str(datetime.date.today()))


def report_version() -> None:
"""
Report the current version of pretext.
"""
log.info(f"PreTeXt CLI version: {VERSION}")


def is_pretext_proc(proc: psutil.Process) -> bool:
if proc.name() == "pretext":
return False
Expand Down