diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c9eee0e..1a83fb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.11', '3.12', '3.13' ] + python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] name: Python ${{ matrix.python-version }} tests steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index f310d71..0c0a9e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta" [project] name = "atmst" -version = "0.0.3" +version = "0.0.4" authors = [ { name="David Buchanan", email="d@vidbuchanan.co.uk" }, ] description = "A Python library for wrangling atproto-flavoured Merkle Search Trees" readme = "README.md" -requires-python = ">=3.11" +requires-python = ">=3.9" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", diff --git a/src/atmst/mst/node.py b/src/atmst/mst/node.py index 5ce40bb..b2b1932 100644 --- a/src/atmst/mst/node.py +++ b/src/atmst/mst/node.py @@ -4,7 +4,10 @@ from more_itertools import ilen from itertools import takewhile from dataclasses import dataclass -from typing import Tuple, Self, Optional + +from typing import TYPE_CHECKING, Tuple, Optional +if TYPE_CHECKING: # Self doesn't exist <3.11 + from typing import Self from cbrrr import encode_dag_cbor, decode_dag_cbor, CID @@ -38,7 +41,7 @@ def __post_init__(self) -> None: raise ValueError("Mismatched keys/vals lengths") @classmethod - def empty_root(cls) -> Self: + def empty_root(cls) -> "Self": return cls( subtrees=(None,), keys=(), @@ -78,7 +81,7 @@ def serialised(self) -> bytes: }) @classmethod - def deserialise(cls, data: bytes) -> Self: + def deserialise(cls, data: bytes) -> "Self": cbor = decode_dag_cbor(data) if len(cbor) != 2: # e, l raise ValueError("malformed MST node") diff --git a/src/atmst/mst/node_walker.py b/src/atmst/mst/node_walker.py index 9a3eaef..4321d08 100644 --- a/src/atmst/mst/node_walker.py +++ b/src/atmst/mst/node_walker.py @@ -1,5 +1,7 @@ from dataclasses import dataclass -from typing import Tuple, Self, Optional, List, Iterable +from typing import TYPE_CHECKING, Tuple, Optional, List, Iterable +if TYPE_CHECKING: # Self doesn't exist <3.11 + from typing import Self from cbrrr import CID @@ -45,7 +47,7 @@ def __init__(self, ns: NodeStore, root_cid: Optional[CID], lpath: Optional[str]= idx=0 )] - def subtree_walker(self) -> Self: + def subtree_walker(self) -> "Self": return NodeWalker(self.ns, self.subtree, self.lpath, self.rpath) @property