Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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**

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://travis-ci.org/shaypal5/cachier>`_.
* A simple interface.
* Defining "shelf life" for cached values.
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 = [
Expand Down
7 changes: 5 additions & 2 deletions src/cachier/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down