diff --git a/AGENTS.md b/AGENTS.md index 1875873..d40a7e9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,7 +33,7 @@ ## Architecture -- The project uses Python and must be Python 3.12 compatible. +- The project uses Python and must be Python 3.12 and Python 3.10 compatible. - Library code lives in the `openvixdisklib` package (`nfc_auth`, `nfc_open`, `openvixdisklib`). - The `.vddk` dir contains the VDDK libraries and their dependencies, including diff --git a/README.md b/README.md index e744979..1345fdb 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,12 @@ Not implemented: compression open flags other than FastLZ, CBT / allocated-block queries, disk geometry (`DDB_GET`), encrypted disks, and direct ESXi `ha-nfc` without vCenter `vpxa-nfc`. +Requires Python 3.10 or later. + ## Install ```bash -python3.12 -m venv .venv +python3 -m venv .venv .venv/bin/pip install -e . ``` diff --git a/openvixdisklib/nfc_auth.py b/openvixdisklib/nfc_auth.py index e2b835e..75f4260 100644 --- a/openvixdisklib/nfc_auth.py +++ b/openvixdisklib/nfc_auth.py @@ -21,7 +21,6 @@ import contextlib import hashlib import socket import ssl -from typing import Self from pyVim.connect import Disconnect, SmartConnect from pyVmomi import vim @@ -395,7 +394,7 @@ class NfcAuthSession: finally: Disconnect(self.si) - def __enter__(self) -> Self: + def __enter__(self) -> NfcAuthSession: return self def __exit__(self, exc_type, exc, tb) -> None: diff --git a/openvixdisklib/nfc_open.py b/openvixdisklib/nfc_open.py index 8bccd73..05d21d4 100644 --- a/openvixdisklib/nfc_open.py +++ b/openvixdisklib/nfc_open.py @@ -25,7 +25,6 @@ import os import socket import ssl import struct -from typing import Self from openvixdisklib import fastlz from openvixdisklib.nfc_auth import NfcAuthSession, _ssl_client_context @@ -385,7 +384,7 @@ class NfcDisk: except OSError: pass - def __enter__(self) -> Self: + def __enter__(self) -> NfcDisk: return self def __exit__(self, exc_type, exc, tb) -> None: diff --git a/ruff.toml b/ruff.toml index c64fc5c..a6459b1 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,5 @@ line-length = 88 -target-version = "py312" +target-version = "py310" [lint] # UP031: Allow percent formatting for now. @@ -8,4 +8,5 @@ target-version = "py312" # BLE001: we'll allow catching Exception for now. # RUF015: enforces next() to be used when getting the first item of a list, # may be enabled at a later time. -ignore = ["UP031", "PIE790", "RUF100", "BLE001", "RUF015"] +# PYI034: typing.Self requires Python 3.11; return the class instead. +ignore = ["UP031", "PIE790", "RUF100", "BLE001", "RUF015", "PYI034"] diff --git a/setup.cfg b/setup.cfg index 55a6a75..f7fea88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,10 @@ classifier = Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 +python-requires = >=3.10 [files] packages =