diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0cdf5c88..e758b3f9 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -38,7 +38,7 @@ Welcome to the Cachier codebase! Please follow these guidelines to ensure code s ## 6. Backward Compatibility - Maintain backward compatibility for public APIs unless a breaking change is explicitly approved. -- Cachier supports Python 3.9+. +- Cachier supports Python 3.10+. ## 7. Documentation and Examples diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 2ee494c5..b4ebb7b5 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] os: ["ubuntu-latest", "macOS-latest", "windows-latest"] backend: ["local", "mongodb", "postgres", "redis"] exclude: diff --git a/AGENTS.md b/AGENTS.md index fb86325b..2e2e460f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,7 +5,7 @@ **Cachier** is a Python library providing persistent, stale-free, local and cross-machine caching for Python functions via a decorator API. It supports multiple backends (pickle, memory, MongoDB, SQL, Redis), is thread-safe, and is designed for extensibility and robust cross-platform support. - **Repository:** [python-cachier/cachier](https://github.com/python-cachier/cachier) -- **Primary Language:** Python 3.9+ +- **Primary Language:** Python 3.10+ - **Key Dependencies:** `portalocker`, `watchdog` (optional: `pymongo`, `sqlalchemy`, `redis`) - **Test Framework:** `pytest` with backend-specific markers - **Linting:** `ruff` (replaces black/flake8) @@ -98,7 +98,7 @@ ______________________________________________________________________ ### 1. **Code Style & Quality** -- **Python 3.9+** only. +- **Python 3.10+** only. - **Type annotations** required for all new code. - **Docstrings:** Use numpy style, multi-line, no single-line docstrings. - **Lint:** Run `ruff` before PRs. Use per-line/file ignores only for justified cases. @@ -145,7 +145,7 @@ ______________________________________________________________________ ### 7. **Backward Compatibility** - **Public API must remain backward compatible** unless breaking change is approved. -- **Support for Python 3.9+ only.** +- **Support for Python 3.10+ only.** ### 8. **Global Configuration & Compatibility** @@ -565,7 +565,7 @@ ______________________________________________________________________ - **When adding new features/backends, update all relevant docs, tests, CI, and requirements files.** - **If a test fails due to missing optional dependency, skip gracefully.** - **Never emit warnings/errors for missing optional deps at import time.** -- **All code must be Python 3.9+ compatible.** +- **All code must be Python 3.10+ compatible.** - **All new code must have full type annotations and numpy-style docstrings.** - **Backend consistency:** Ensure all backends (pickle, memory, mongo, sql, redis) are supported.\*\* - **Validation:** Test examples in this file work: `python -c "from cachier import cachier; ..."` should succeed. diff --git a/README.rst b/README.rst index 55e38286..976042b7 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ Current features ---------------- * Pure Python. -* Compatible with Python 3.9+ (Python 2.7 was discontinued in version 1.2.8). +* Compatible with Python 3.10+ (Python 2.7 was discontinued in version 1.2.8). * Supported and `tested on Linux, OS X and Windows `_. * A simple interface. * Defining "shelf life" for cached values. diff --git a/pyproject.toml b/pyproject.toml index b3565e8e..d249de33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,14 +24,13 @@ license = { file = "LICENSE" } authors = [ { name = "Shay Palachy Affek", email = 'shay.palachy@gmail.com' }, ] -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -75,7 +74,7 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default) # --- ruff --- [tool.ruff] -target-version = "py39" +target-version = "py310" line-length = 120 # Exclude a variety of commonly ignored directories. exclude = [ diff --git a/src/cachier/core.py b/src/cachier/core.py index f0db36e8..34830d3b 100644 --- a/src/cachier/core.py +++ b/src/cachier/core.py @@ -125,7 +125,7 @@ def _convert_args_kwargs(func, _is_method: bool, args: tuple, kwds: dict) -> dic # Map as many args as possible to regular parameters num_regular = len(params_to_use) - args_as_kw = dict(zip(params_to_use, args_to_map[:num_regular])) + args_as_kw = dict(zip(params_to_use, args_to_map[:num_regular], strict=False)) # Handle variadic positional arguments # Store them with indexed keys like __varargs_0__, __varargs_1__, etc. @@ -286,7 +286,9 @@ def cachier( ) elif backend == "memory": core = _MemoryCore( - hash_func=hash_func, wait_for_calc_timeout=wait_for_calc_timeout, entry_size_limit=size_limit_bytes + hash_func=hash_func, + wait_for_calc_timeout=wait_for_calc_timeout, + entry_size_limit=size_limit_bytes, ) elif backend == "sql": core = _SQLCore( @@ -549,6 +551,7 @@ async def _call_async(*args, max_age: Optional[timedelta] = None, **kwds): @wraps(func) async def func_wrapper(*args, **kwargs): return await _call_async(*args, **kwargs) + else: @wraps(func)