diff --git a/HISTORY.md b/HISTORY.md index 4ad80de1..11b51912 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,12 @@ # cloudpathlib Changelog +## v0.15.0 (2023-06-16) + +- Changed return type for `CloudPathMeta.__call__` to fix problems with pyright/pylance ([PR #330](https://github.com/drivendataorg/cloudpathlib/pull/330)) +- Make `CloudPath.is_valid_cloudpath` a TypeGuard so that type checkers can know the subclass if `is_valid_cloudpath` is called ([PR #337](https://github.com/drivendataorg/cloudpathlib/pull/337)) +- Added `follow_symlinks` to `stat` for 3.11.4 compatibility (see [bpo 39906](https://github.com/python/cpython/issues/84087)) +- Add `follow_symlinks` to `is_dir` implementation for CPython `glob` compatibility (see [CPython PR #104512](https://github.com/python/cpython/pull/104512)) + ## v0.14.0 (2023-05-13) - Changed to pyproject.toml-based build. diff --git a/cloudpathlib/cloudpath.py b/cloudpathlib/cloudpath.py index c50989db..42b43de3 100644 --- a/cloudpathlib/cloudpath.py +++ b/cloudpathlib/cloudpath.py @@ -786,7 +786,7 @@ def _dispatch_to_local_cache_path(self, func: str, *args, **kwargs) -> Any: else: return path_version - def stat(self) -> os.stat_result: + def stat(self, follow_symlinks: bool = True) -> os.stat_result: """Note: for many clients, we may want to override so we don't incur network costs since many of these properties are available as API calls. @@ -795,7 +795,7 @@ def stat(self) -> os.stat_result: f"stat not implemented as API call for {self.__class__} so file must be downloaded to " f"calculate stats; this may take a long time depending on filesize" ) - return self._dispatch_to_local_cache_path("stat") + return self._dispatch_to_local_cache_path("stat", follow_symlinks=follow_symlinks) # =========== public cloud methods, not in pathlib =============== def download_to(self, destination: Union[str, os.PathLike]) -> Path: @@ -1182,7 +1182,7 @@ def __init__( def __repr__(self) -> str: return "/".join(self._parents + [self.name]) - def is_dir(self) -> bool: + def is_dir(self, follow_symlinks: bool = False) -> bool: return self._all_children is not None def exists(self) -> bool: diff --git a/pyproject.toml b/pyproject.toml index 7d8b9557..c721516b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "cloudpathlib" -version = "0.14.0" +version = "0.15.0" description = "pathlib-style classes for cloud storage services." readme = "README.md" authors = [{ name = "DrivenData", email = "info@drivendata.org" }]