From edc41c135681fcacf528970c633ea69f155fd69b Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Wed, 11 Nov 2026 10:39:03 -0800 Subject: [PATCH] Require Python 3.11+, aligned with fsspec fsspec now requires Python >= 3.11 (fsspec/filesystem_spec#2393), and asyncssh dropped 3.9 in 2.22.0. - requires-python >= 3.11; drop the 3.9 and 3.10 classifiers. - CI: test 3.11-3.14 with fail-fast disabled. ubuntu-latest is now Ubuntu 26.04, which has no setup-python build for 3.9, so the 3.9 job failed at setup and cancelled the rest of the matrix. - black target-version py311. - Run the pre-commit workflow on pushes to main (was master). - Use X | None, datetime.UTC, and the stdlib importlib.metadata; drop importlib-metadata from the dev requirements. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/test.yml | 4 ++-- pyproject.toml | 6 ++---- requirements-dev.txt | 1 - sshfs/pools/base.py | 7 +++---- sshfs/spec.py | 11 +++++------ tests/test_sshfs.py | 6 +++--- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 63f4c9e..5a90208 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,7 +3,7 @@ name: pre-commit on: pull_request: push: - branches: [master] + branches: [main] jobs: pre-commit: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f3c45d..e33f06d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,11 +15,11 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - pyv: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + pyv: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v6 diff --git a/pyproject.toml b/pyproject.toml index ceb88ca..0370557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,12 +8,10 @@ description = "SSH Filesystem -- Async SSH/SFTP backend for fsspec" readme = "README.md" license = "Apache-2.0" license-files = ["LICENSE"] -requires-python = ">=3.9" +requires-python = ">=3.11" classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", @@ -58,7 +56,7 @@ faulthandler_timeout = 60 [tool.black] line-length = 79 -target-version = ['py39'] +target-version = ['py311'] [tool.isort] atomic = true diff --git a/requirements-dev.txt b/requirements-dev.txt index 2433630..9e25270 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,4 +3,3 @@ pytest-asyncio pytest-cov pytest-rerunfailures mock-ssh-server -importlib-metadata >= 6.0.0 diff --git a/sshfs/pools/base.py b/sshfs/pools/base.py index 1510a29..47a122f 100644 --- a/sshfs/pools/base.py +++ b/sshfs/pools/base.py @@ -1,6 +1,5 @@ import asyncio from contextlib import AsyncExitStack, suppress -from typing import Optional from asyncssh.misc import ChannelOpenError @@ -16,10 +15,10 @@ def __init__( self, client, *, - max_channels: Optional[int] = None, - timeout: Optional[float] = MAX_TIMEOUT, + max_channels: int | None = None, + timeout: float | None = MAX_TIMEOUT, unsafe_terminate: bool = True, - sftp_client_kwargs: Optional[dict] = None, + sftp_client_kwargs: dict | None = None, **kwargs, ): self.client = client diff --git a/sshfs/spec.py b/sshfs/spec.py index f8f5940..99dbfa5 100644 --- a/sshfs/spec.py +++ b/sshfs/spec.py @@ -4,8 +4,7 @@ import stat import weakref from contextlib import AsyncExitStack, suppress -from datetime import datetime, timezone -from typing import Optional +from datetime import UTC, datetime import asyncssh from asyncssh.sftp import SFTPOpUnsupported @@ -41,7 +40,7 @@ def __init__( host, *, pool_type=SFTPSoftChannelPool, - sftp_client_kwargs: Optional[dict] = None, + sftp_client_kwargs: dict | None = None, **kwargs, ): """ @@ -59,7 +58,7 @@ def __init__( Pool manager to use (when doing concurrent operations together, pool managers offer the flexibility of prioritizing channels and deciding which to use). - sftp_client_kwargs: Optional[dict] + sftp_client_kwargs: dict | None Options passed to `SSHClientConnection.start_sftp_client` (e.g. env, send_env, path_encoding, path_errors, sftp_version). @@ -181,12 +180,12 @@ def _decode_attributes(self, attributes): "gid": attributes.gid, "uid": attributes.uid, "time": ( - datetime.fromtimestamp(attributes.atime, tz=timezone.utc) + datetime.fromtimestamp(attributes.atime, tz=UTC) if attributes.atime is not None else None ), "mtime": ( - datetime.fromtimestamp(attributes.mtime, tz=timezone.utc) + datetime.fromtimestamp(attributes.mtime, tz=UTC) if attributes.mtime is not None else None ), diff --git a/tests/test_sshfs.py b/tests/test_sshfs.py index 141baf7..adf048e 100644 --- a/tests/test_sshfs.py +++ b/tests/test_sshfs.py @@ -4,14 +4,14 @@ import tempfile import warnings from concurrent import futures -from datetime import datetime, timedelta, timezone +from datetime import UTC, datetime, timedelta +from importlib.metadata import entry_points from pathlib import Path from types import SimpleNamespace import fsspec import pytest from asyncssh.sftp import SFTPAttrs, SFTPFailure -from importlib_metadata import entry_points from sshfs import SSHFileSystem from sshfs.file import SSHFile @@ -160,7 +160,7 @@ def test_info_timestamps_are_tz_aware_utc(fs, remote_dir): fs.touch(remote_dir + "/a.txt") details = fs.info(remote_dir + "/a.txt") for key in ["time", "mtime"]: - assert details[key].tzinfo == timezone.utc + assert details[key].tzinfo == UTC def test_decode_attributes_missing_timestamps(fs):