From 7fb7a81dd711d9f266d87a0e86a75f7fdcdcfafe Mon Sep 17 00:00:00 2001 From: Alexandru MAXIMCIUC Date: Sun, 9 Nov 2025 02:17:24 +0200 Subject: [PATCH 1/7] make BackupMultiBucket import from exceptiongroup only on py<3.11; add psutil as a dev dependency in poetry.lock --- python/bucketbase/backup_multi_bucket.py | 5 +++- python/poetry.lock | 35 +++++++++++++++++++++++- python/pyproject.toml | 1 + python/tests/test_backup_multi_bucket.py | 5 +++- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/python/bucketbase/backup_multi_bucket.py b/python/bucketbase/backup_multi_bucket.py index d08123f..3ee5a78 100644 --- a/python/bucketbase/backup_multi_bucket.py +++ b/python/bucketbase/backup_multi_bucket.py @@ -1,9 +1,12 @@ import contextlib import logging +import sys from pathlib import Path, PurePosixPath from typing import BinaryIO, Iterable -from exceptiongroup import ExceptionGroup +if sys.version_info < (3, 11): + from exceptiongroup import ExceptionGroup + from streamerate import slist, sset from typing_extensions import override diff --git a/python/poetry.lock b/python/poetry.lock index 79239cd..ae473e1 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -1350,6 +1350,39 @@ nodeenv = ">=0.11.1" pyyaml = ">=5.1" virtualenv = ">=20.10.0" +[[package]] +name = "psutil" +version = "7.1.3" +description = "Cross-platform lib for process and system monitoring." +optional = false +python-versions = ">=3.6" +groups = ["dev"] +files = [ + {file = "psutil-7.1.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0005da714eee687b4b8decd3d6cc7c6db36215c9e74e5ad2264b90c3df7d92dc"}, + {file = "psutil-7.1.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:19644c85dcb987e35eeeaefdc3915d059dac7bd1167cdcdbf27e0ce2df0c08c0"}, + {file = "psutil-7.1.3-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:95ef04cf2e5ba0ab9eaafc4a11eaae91b44f4ef5541acd2ee91d9108d00d59a7"}, + {file = "psutil-7.1.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1068c303be3a72f8e18e412c5b2a8f6d31750fb152f9cb106b54090296c9d251"}, + {file = "psutil-7.1.3-cp313-cp313t-win_amd64.whl", hash = "sha256:18349c5c24b06ac5612c0428ec2a0331c26443d259e2a0144a9b24b4395b58fa"}, + {file = "psutil-7.1.3-cp313-cp313t-win_arm64.whl", hash = "sha256:c525ffa774fe4496282fb0b1187725793de3e7c6b29e41562733cae9ada151ee"}, + {file = "psutil-7.1.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:b403da1df4d6d43973dc004d19cee3b848e998ae3154cc8097d139b77156c353"}, + {file = "psutil-7.1.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ad81425efc5e75da3f39b3e636293360ad8d0b49bed7df824c79764fb4ba9b8b"}, + {file = "psutil-7.1.3-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f33a3702e167783a9213db10ad29650ebf383946e91bc77f28a5eb083496bc9"}, + {file = "psutil-7.1.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fac9cd332c67f4422504297889da5ab7e05fd11e3c4392140f7370f4208ded1f"}, + {file = "psutil-7.1.3-cp314-cp314t-win_amd64.whl", hash = "sha256:3792983e23b69843aea49c8f5b8f115572c5ab64c153bada5270086a2123c7e7"}, + {file = "psutil-7.1.3-cp314-cp314t-win_arm64.whl", hash = "sha256:31d77fcedb7529f27bb3a0472bea9334349f9a04160e8e6e5020f22c59893264"}, + {file = "psutil-7.1.3-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2bdbcd0e58ca14996a42adf3621a6244f1bb2e2e528886959c72cf1e326677ab"}, + {file = "psutil-7.1.3-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:bc31fa00f1fbc3c3802141eede66f3a2d51d89716a194bf2cd6fc68310a19880"}, + {file = "psutil-7.1.3-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3bb428f9f05c1225a558f53e30ccbad9930b11c3fc206836242de1091d3e7dd3"}, + {file = "psutil-7.1.3-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56d974e02ca2c8eb4812c3f76c30e28836fffc311d55d979f1465c1feeb2b68b"}, + {file = "psutil-7.1.3-cp37-abi3-win_amd64.whl", hash = "sha256:f39c2c19fe824b47484b96f9692932248a54c43799a84282cfe58d05a6449efd"}, + {file = "psutil-7.1.3-cp37-abi3-win_arm64.whl", hash = "sha256:bd0d69cee829226a761e92f28140bec9a5ee9d5b4fb4b0cc589068dbfff559b1"}, + {file = "psutil-7.1.3.tar.gz", hash = "sha256:6c86281738d77335af7aec228328e944b30930899ea760ecf33a4dba66be5e74"}, +] + +[package.extras] +dev = ["abi3audit", "black", "check-manifest", "colorama ; os_name == \"nt\"", "coverage", "packaging", "pylint", "pyperf", "pypinfo", "pyreadline ; os_name == \"nt\"", "pytest", "pytest-cov", "pytest-instafail", "pytest-subtests", "pytest-xdist", "pywin32 ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "requests", "rstcheck", "ruff", "setuptools", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "validate-pyproject[all]", "virtualenv", "vulture", "wheel", "wheel ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "wmi ; os_name == \"nt\" and platform_python_implementation != \"PyPy\""] +test = ["pytest", "pytest-instafail", "pytest-subtests", "pytest-xdist", "pywin32 ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "setuptools", "wheel ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "wmi ; os_name == \"nt\" and platform_python_implementation != \"PyPy\""] + [[package]] name = "pyarrow" version = "22.0.0" @@ -2286,4 +2319,4 @@ minio = ["minio", "multiminio"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<4.0.0" -content-hash = "6270afca2af7cf6e193d767661ce087e7e752df4aa58a46abfb4e71b7c3c8603" +content-hash = "24f921d11e82c1f6f66edac438d9cfc7626cb2c240867b310875f94c6ec5923e" diff --git a/python/pyproject.toml b/python/pyproject.toml index d5134c9..c6925a4 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -29,6 +29,7 @@ pyarrow = ">=21.0.0" twine = ">=6.1.0" pre-commit = ">=4.3.0" mypy = "^1.18.2" +psutil = "^7.1.3" [tool.black] line-length = 160 diff --git a/python/tests/test_backup_multi_bucket.py b/python/tests/test_backup_multi_bucket.py index 5f0b636..17ff397 100644 --- a/python/tests/test_backup_multi_bucket.py +++ b/python/tests/test_backup_multi_bucket.py @@ -1,6 +1,7 @@ # mypy: disable-error-code="no-untyped-def" import gc import os +import sys import tempfile import threading from io import BytesIO @@ -9,7 +10,9 @@ from unittest import TestCase import psutil -from exceptiongroup import ExceptionGroup +if sys.version_info < (3, 11): + from exceptiongroup import ExceptionGroup + from minio import Minio from bucketbase import MemoryBucket, MinioBucket, ShallowListing From 9f3d04d3deff47d627a1589ac825ef1413ff88ed Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 17:27:06 +0200 Subject: [PATCH 2/7] fix CI build in python-package.yml --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2406d9c..2b2cd87 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -32,6 +32,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install poetry + cd python poetry install --with dev - name: Run tests env: @@ -53,6 +54,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install poetry + cd python poetry install --with dev - name: Run tests in container env: From e877a5d1a36e6629cdf93f4855b2718789bf5d6d Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 17:28:24 +0200 Subject: [PATCH 3/7] fix: update poetry lock step to prevent unnecessary updates --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2b2cd87..a6aca4b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,6 +33,7 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry cd python + poetry lock --no-update poetry install --with dev - name: Run tests env: @@ -55,6 +56,7 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry cd python + poetry lock --no-update poetry install --with dev - name: Run tests in container env: From fdfe0c0a2f81455b6fe9f85c8850c1b157830694 Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 17:40:31 +0200 Subject: [PATCH 4/7] fix: update psutil dependency and poetry lock configuration --- .github/workflows/python-package.yml | 4 ++-- python/poetry.lock | 35 +++++++++++++++++++++++++++- python/pyproject.toml | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a6aca4b..d1d78d2 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,7 +33,7 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry cd python - poetry lock --no-update + poetry lock poetry install --with dev - name: Run tests env: @@ -56,7 +56,7 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry cd python - poetry lock --no-update + poetry lock poetry install --with dev - name: Run tests in container env: diff --git a/python/poetry.lock b/python/poetry.lock index 32faec3..8cd7583 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -1331,6 +1331,39 @@ nodeenv = ">=0.11.1" pyyaml = ">=5.1" virtualenv = ">=20.10.0" +[[package]] +name = "psutil" +version = "7.1.3" +description = "Cross-platform lib for process and system monitoring." +optional = false +python-versions = ">=3.6" +groups = ["dev"] +files = [ + {file = "psutil-7.1.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0005da714eee687b4b8decd3d6cc7c6db36215c9e74e5ad2264b90c3df7d92dc"}, + {file = "psutil-7.1.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:19644c85dcb987e35eeeaefdc3915d059dac7bd1167cdcdbf27e0ce2df0c08c0"}, + {file = "psutil-7.1.3-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:95ef04cf2e5ba0ab9eaafc4a11eaae91b44f4ef5541acd2ee91d9108d00d59a7"}, + {file = "psutil-7.1.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1068c303be3a72f8e18e412c5b2a8f6d31750fb152f9cb106b54090296c9d251"}, + {file = "psutil-7.1.3-cp313-cp313t-win_amd64.whl", hash = "sha256:18349c5c24b06ac5612c0428ec2a0331c26443d259e2a0144a9b24b4395b58fa"}, + {file = "psutil-7.1.3-cp313-cp313t-win_arm64.whl", hash = "sha256:c525ffa774fe4496282fb0b1187725793de3e7c6b29e41562733cae9ada151ee"}, + {file = "psutil-7.1.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:b403da1df4d6d43973dc004d19cee3b848e998ae3154cc8097d139b77156c353"}, + {file = "psutil-7.1.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ad81425efc5e75da3f39b3e636293360ad8d0b49bed7df824c79764fb4ba9b8b"}, + {file = "psutil-7.1.3-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f33a3702e167783a9213db10ad29650ebf383946e91bc77f28a5eb083496bc9"}, + {file = "psutil-7.1.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fac9cd332c67f4422504297889da5ab7e05fd11e3c4392140f7370f4208ded1f"}, + {file = "psutil-7.1.3-cp314-cp314t-win_amd64.whl", hash = "sha256:3792983e23b69843aea49c8f5b8f115572c5ab64c153bada5270086a2123c7e7"}, + {file = "psutil-7.1.3-cp314-cp314t-win_arm64.whl", hash = "sha256:31d77fcedb7529f27bb3a0472bea9334349f9a04160e8e6e5020f22c59893264"}, + {file = "psutil-7.1.3-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2bdbcd0e58ca14996a42adf3621a6244f1bb2e2e528886959c72cf1e326677ab"}, + {file = "psutil-7.1.3-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:bc31fa00f1fbc3c3802141eede66f3a2d51d89716a194bf2cd6fc68310a19880"}, + {file = "psutil-7.1.3-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3bb428f9f05c1225a558f53e30ccbad9930b11c3fc206836242de1091d3e7dd3"}, + {file = "psutil-7.1.3-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56d974e02ca2c8eb4812c3f76c30e28836fffc311d55d979f1465c1feeb2b68b"}, + {file = "psutil-7.1.3-cp37-abi3-win_amd64.whl", hash = "sha256:f39c2c19fe824b47484b96f9692932248a54c43799a84282cfe58d05a6449efd"}, + {file = "psutil-7.1.3-cp37-abi3-win_arm64.whl", hash = "sha256:bd0d69cee829226a761e92f28140bec9a5ee9d5b4fb4b0cc589068dbfff559b1"}, + {file = "psutil-7.1.3.tar.gz", hash = "sha256:6c86281738d77335af7aec228328e944b30930899ea760ecf33a4dba66be5e74"}, +] + +[package.extras] +dev = ["abi3audit", "black", "check-manifest", "colorama ; os_name == \"nt\"", "coverage", "packaging", "pylint", "pyperf", "pypinfo", "pyreadline ; os_name == \"nt\"", "pytest", "pytest-cov", "pytest-instafail", "pytest-subtests", "pytest-xdist", "pywin32 ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "requests", "rstcheck", "ruff", "setuptools", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "validate-pyproject[all]", "virtualenv", "vulture", "wheel", "wheel ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "wmi ; os_name == \"nt\" and platform_python_implementation != \"PyPy\""] +test = ["pytest", "pytest-instafail", "pytest-subtests", "pytest-xdist", "pywin32 ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "setuptools", "wheel ; os_name == \"nt\" and platform_python_implementation != \"PyPy\"", "wmi ; os_name == \"nt\" and platform_python_implementation != \"PyPy\""] + [[package]] name = "pyarrow" version = "22.0.0" @@ -2247,4 +2280,4 @@ minio = ["minio", "multiminio"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<4.0.0" -content-hash = "3b577129d504cf743ff720a54ddf424f7a125928a1124a2c8962c033a4cb6771" +content-hash = "ca0e240d7052471945492335858d3cbca9b356bf35c8beb82e4d7b064c1c94cb" diff --git a/python/pyproject.toml b/python/pyproject.toml index 35fba71..58436ca 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,7 +13,7 @@ requests = ">=2.25.1" streamerate = ">=1.2.1" pyxtension = ">=1.17.1" StrEnum = ">=0.4.0" -filelock= ">3.20.0" +filelock = ">=3.20.0" minio = { version = ">=7.2.4,<=8.0.0", optional = true } multiminio = { version = ">=1.0.2", optional = true } From 7b0dab47327ecf0278c3564525be6b4afb870c08 Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 17:50:09 +0200 Subject: [PATCH 5/7] fix: FileLockForPath._releas() to work under ubuntu --- python/bucketbase/backup_multi_bucket.py | 5 +++-- python/bucketbase/file_lock.py | 7 ++++--- python/tests/test_backup_multi_bucket.py | 7 +++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/python/bucketbase/backup_multi_bucket.py b/python/bucketbase/backup_multi_bucket.py index 3ee5a78..643d304 100644 --- a/python/bucketbase/backup_multi_bucket.py +++ b/python/bucketbase/backup_multi_bucket.py @@ -1,10 +1,11 @@ import contextlib import logging -import sys from pathlib import Path, PurePosixPath from typing import BinaryIO, Iterable -if sys.version_info < (3, 11): +try: + _ = ExceptionGroup.__class__ # pylint: disable=used-before-assignment +except NameError: from exceptiongroup import ExceptionGroup from streamerate import slist, sset diff --git a/python/bucketbase/file_lock.py b/python/bucketbase/file_lock.py index 1249c61..5f8a6b7 100644 --- a/python/bucketbase/file_lock.py +++ b/python/bucketbase/file_lock.py @@ -1,5 +1,4 @@ import os -import sys from pathlib import Path import filelock @@ -20,9 +19,11 @@ def _acquire(self) -> None: return super()._acquire() def _release(self) -> None: - if sys.platform.startswith("darwin"): + try: + super()._release() + finally: + # Remove the lock file after release on all platforms try: os.remove(self._lock_file_path) except OSError: pass - return super()._release() diff --git a/python/tests/test_backup_multi_bucket.py b/python/tests/test_backup_multi_bucket.py index cb56343..d0752d6 100644 --- a/python/tests/test_backup_multi_bucket.py +++ b/python/tests/test_backup_multi_bucket.py @@ -1,7 +1,6 @@ # mypy: disable-error-code="no-untyped-def" import gc import os -import sys import tempfile import threading from io import BytesIO @@ -10,9 +9,13 @@ from unittest import TestCase import psutil -if sys.version_info < (3, 11): + +try: + _ = ExceptionGroup.__class__ +except NameError: from exceptiongroup import ExceptionGroup + from minio import Minio from bucketbase import MemoryBucket, MinioBucket, ShallowListing From 2d1a95d19851a751f2d5ff3badb67f44f99ae28c Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 17:58:15 +0200 Subject: [PATCH 6/7] v1.5.1: fix ExceptionGroup failing. + fix the lock deletion on Py 3.12 --- python/bucketbase/file_lock.py | 9 +++++---- python/pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/python/bucketbase/file_lock.py b/python/bucketbase/file_lock.py index 5f8a6b7..bc751de 100644 --- a/python/bucketbase/file_lock.py +++ b/python/bucketbase/file_lock.py @@ -1,4 +1,5 @@ import os +import sys from pathlib import Path import filelock @@ -19,10 +20,10 @@ def _acquire(self) -> None: return super()._acquire() def _release(self) -> None: - try: - super()._release() - finally: - # Remove the lock file after release on all platforms + super()._release() + # Only delete lock file on macOS where it's safe + # On Linux/Windows, let filelock handle cleanup to avoid race conditions + if sys.platform.startswith("darwin"): try: os.remove(self._lock_file_path) except OSError: diff --git a/python/pyproject.toml b/python/pyproject.toml index 58436ca..96a79ce 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bucketbase" -version = "1.5.0" # do not edit manually. kept in sync with `tool.commitizen` config via automation +version = "1.5.1" # do not edit manually. kept in sync with `tool.commitizen` config via automation description = "bucketbase" authors = ["Andrei Suiu "] repository = "https://github.com/asuiu/bucketbase" From 45dc989eb04e6f78f97787c9cf04a83ce7e403f4 Mon Sep 17 00:00:00 2001 From: ASU Date: Sun, 9 Nov 2025 18:05:32 +0200 Subject: [PATCH 7/7] revert back to remove the lock file only on MacOS --- python/bucketbase/file_lock.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/python/bucketbase/file_lock.py b/python/bucketbase/file_lock.py index bc751de..d908afb 100644 --- a/python/bucketbase/file_lock.py +++ b/python/bucketbase/file_lock.py @@ -20,11 +20,12 @@ def _acquire(self) -> None: return super()._acquire() def _release(self) -> None: - super()._release() - # Only delete lock file on macOS where it's safe - # On Linux/Windows, let filelock handle cleanup to avoid race conditions - if sys.platform.startswith("darwin"): - try: - os.remove(self._lock_file_path) - except OSError: - pass + try: + super()._release() + finally: + # On Linux/Windows, let filelock handle cleanup to avoid race conditions + if sys.platform.startswith("darwin"): + try: + os.remove(self._lock_file_path) + except OSError: + pass