Skip to content

Commit

Permalink
feat: expose integer Tutor version parts to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick committed Nov 7, 2024
1 parent 7042414 commit 0758f55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/20241107_164816_kyle_tutor_version_parts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] Add integer variables `TUTOR_VERSION_MAJOR`, `TUTOR_VERSION_MINOR`, and `TUTOR_VERSION_PATCH` to the template context. These are parsed from the existing `TUTOR_VERSION` string variable, which takes the format `"MAJOR.MINOR.PATCH"`. We add them as a convenience to developers who need to maintain version-agnostic Tutor plugins (by @michaelwheeler and @kdmccormick).
3 changes: 3 additions & 0 deletions tutor/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def _prepare_environment() -> None:
("HOST_USER_ID", utils.get_user_id()),
("TUTOR_APP", __app__.replace("-", "_")),
("TUTOR_VERSION", __version__),
("TUTOR_VERSION_MAJOR", int(__version__.split(".")[0])),
("TUTOR_VERSION_MINOR", int(__version__.split(".")[1])),
("TUTOR_VERSION_PATCH", int(__version__.split(".")[2])),
("is_docker_rootless", utils.is_docker_rootless),
],
)
Expand Down

0 comments on commit 0758f55

Please sign in to comment.