Skip to content

[ODSC-69670] AQUA version visibility changes #1215

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

Merged
merged 8 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
45 changes: 43 additions & 2 deletions ads/aqua/extension/common_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# Copyright (c) 2025 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/


import json
import os
from importlib import metadata

import huggingface_hub
Expand All @@ -18,6 +18,10 @@
)
from ads.aqua.extension.base_handler import AquaAPIhandler
from ads.aqua.extension.errors import Errors
from ads.common.object_storage_details import ObjectStorageDetails
from ads.common.utils import read_file
from ads.config import CONDA_BUCKET_NAME, CONDA_BUCKET_NS
from ads.opctl.operator.common.utils import default_signer


class ADSVersionHandler(AquaAPIhandler):
Expand All @@ -28,6 +32,42 @@ def get(self):
self.finish({"data": metadata.version("oracle_ads")})


class AquaVersionHandler(AquaAPIhandler):
@handle_exceptions
def get(self):
"""
Returns the current and latest deployed version of AQUA

{
"installed": {
"aqua": "0.1.3.0",
"ads": "2.14.2"
},
"latest": {
"aqua": "0.1.4.0",
"ads": "2.14.4"
}
}

"""

current_version_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "version.json"
)
latest_version_artifact_path = ObjectStorageDetails(
CONDA_BUCKET_NAME, CONDA_BUCKET_NS, "service_pack/aqua_latest_version.json"
).path
latest_version_content = read_file(
latest_version_artifact_path, auth=default_signer()
)
current_version_content = read_file(current_version_path)
response = {
**json.loads(current_version_content),
**json.loads(latest_version_content),
}
return self.finish(response)


class CompatibilityCheckHandler(AquaAPIhandler):
"""The handler to check if the extension is compatible."""

Expand Down Expand Up @@ -118,4 +158,5 @@ def get(self):
("network_status", NetworkStatusHandler),
("hf_login", HFLoginHandler),
("hf_logged_in", HFUserStatusHandler),
("aqua_version", AquaVersionHandler),
]
6 changes: 6 additions & 0 deletions ads/aqua/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"installed": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ADS version we can get form the ads config. Otherwise will heave to update both places when we release ADS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

"ads": "2.14.2",
"aqua": "0.1.3.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to keep the aqua version details in ads/aqua/__init__.py instead of this external json? We can then get both the versions like:

from ads import __version__ as ads_version
from ads.aqua import __version__ as aqua_version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ADS version is already stored in the toml file, no need to move it to the init file.

class ADSVersionHandler(AquaAPIhandler):
    """The handler to get the current version of the ADS."""

    @handle_exceptions
    def get(self):
        self.finish({"data": metadata.version("oracle_ads")})

Regarding storing the version in init.py, I’d still prefer to keep it in a version.json file. Since init is no longer required and will likely be phased out soon, relying on it for versioning may not be ideal.

Maintaining the version in a dedicated version.json file is also easier and more visible, making it less likely to be overlooked during updates. Once AQUA becomes an independent project, we can move the version into a pyproject.toml file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

}
}
Loading