-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Huong Nguyen <[email protected]>
- Loading branch information
Huong Nguyen
committed
Jan 16, 2025
1 parent
e864d76
commit 15ab3e8
Showing
4 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""`kedro_viz.api.rest.responses.version` contains response classes | ||
and utility functions for the `/version` REST endpoint""" | ||
|
||
from kedro_viz import __version__ | ||
from pydantic import BaseModel, ConfigDict | ||
from kedro_viz.api.rest.responses.base import BaseAPIResponse | ||
|
||
class VersionAPIResponse(BaseAPIResponse): | ||
""" | ||
VersionAPIResponse is a subclass of BaseAPIResponse that represents the response structure for version API. | ||
Attributes: | ||
installed (str): The installed version of the Kedro Viz package. | ||
isOutdated (bool): Whether the installed version is outdated. | ||
latest (str): The latest available version of the Kedro Viz package. | ||
""" | ||
|
||
installed: str | ||
isOutdated: bool | ||
latest: str | ||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"installed": __version__, | ||
"isOutdated": False, | ||
"latest": "0.5.0" # how do i check the latest version? | ||
} | ||
) | ||
|
||
def get_version_response(): | ||
"""API response for `/api/version`.""" | ||
installed_version = __version__ | ||
latest_version = "0.5.0" # how do i check the latest version? | ||
is_outdated = installed_version != latest_version | ||
|
||
return VersionAPIResponse( | ||
installed=installed_version, | ||
isOutdated=is_outdated, | ||
latest=latest_version | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters