Skip to content

Commit

Permalink
Add public version attributes
Browse files Browse the repository at this point in the history
Add __version__ to the public interface for both
s3torchconnector and s3torchconnectorclient.
  • Loading branch information
dnnanuti committed Jan 11, 2024
1 parent cf4af72 commit 2989119
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion s3torchconnector/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#
import os
import sys
from s3torchconnector import __version__

sys.path.insert(0, os.path.abspath(".."))

Expand All @@ -21,7 +22,7 @@
project = "Amazon S3 Connector for PyTorch"
copyright = "2023, Amazon S3"
author = "Amazon S3"
release = "1.1.1"
release = __version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 2 additions & 0 deletions s3torchconnector/src/s3torchconnector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .s3iterable_dataset import S3IterableDataset
from .s3map_dataset import S3MapDataset
from .s3checkpoint import S3Checkpoint
from ._version import __version__

__all__ = [
"S3IterableDataset",
Expand All @@ -18,4 +19,5 @@
"S3Reader",
"S3Writer",
"S3Exception",
"__version__",
]
8 changes: 8 additions & 0 deletions s3torchconnector/tst/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# // SPDX-License-Identifier: BSD
from s3torchconnector import __version__


def test_connector_version():
assert isinstance(__version__, str)
assert __version__ > "1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ._logger_patch import TRACE as LOG_TRACE
from ._logger_patch import _install_trace_logging
from ._mountpoint_s3_client import S3Exception
from ._mountpoint_s3_client import __version__

_install_trace_logging()

Expand All @@ -16,7 +17,4 @@ def _s3exception_reduce(exc: S3Exception):

copyreg.pickle(S3Exception, _s3exception_reduce)

__all__ = [
"LOG_TRACE",
"S3Exception",
]
__all__ = ["LOG_TRACE", "S3Exception", "__version__"]
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

import logging
import pickle
import pytest
from typing import Set

import pytest
from s3torchconnectorclient import LOG_TRACE
from s3torchconnectorclient import __version__
from s3torchconnectorclient._mountpoint_s3_client import (
S3Exception,
GetObjectStream,
Expand All @@ -15,8 +17,6 @@
MountpointS3Client,
)

from s3torchconnectorclient import LOG_TRACE

logging.basicConfig(
format="%(levelname)s %(name)s %(asctime)-15s %(filename)s:%(lineno)d %(message)s"
)
Expand Down Expand Up @@ -291,3 +291,8 @@ def test_mountpoint_client_pickles():

def _assert_isinstance(obj, expected: type):
assert isinstance(obj, expected), f"Expected a {expected}, got {type(obj)=}"


def test_client_version():
assert isinstance(__version__, str)
assert __version__ > "1.0.0"
1 change: 1 addition & 0 deletions s3torchconnectorclient/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ fn make_lib(py: Python, mountpoint_s3_client: &PyModule) -> PyResult<()> {
mountpoint_s3_client.add_class::<PyObjectInfo>()?;
mountpoint_s3_client.add_class::<PyRestoreStatus>()?;
mountpoint_s3_client.add("S3Exception", py.get_type::<S3Exception>())?;
mountpoint_s3_client.add("__version__", build_info::FULL_VERSION)?;
Ok(())
}

0 comments on commit 2989119

Please sign in to comment.