From 7c1efe47f591195b1730839234515a8ed9799977 Mon Sep 17 00:00:00 2001 From: Shay Palachy Date: Mon, 30 Jun 2025 15:49:02 +0300 Subject: [PATCH 1/3] fix safety check and copilot instructions --- .github/copilot-instructions.md | 12 ++++++++++++ .github/workflows/safety.yml | 2 +- README.rst | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..956ef265 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,12 @@ +# GitHub Copilot Custom Instructions for Cachier + +- Cachier is a Python package providing persistent, stale-free memoization decorators for Python functions, supporting local (pickle), cross-machine (MongoDB), and in-memory caching backends. +- Always refer to the main decorator as `@cachier`, and note that it can be configured via parameters such as `stale_after`, `backend`, `mongetter`, `cache_dir`, `pickle_reload`, `separate_files`, `wait_for_calc_timeout`, and `allow_none`. +- Arguments to cached functions must be hashable; custom hash functions can be provided via the `hash_func` parameter for unhashable arguments. +- The default backend is pickle-based, storing cache files in `~/.cachier/` unless otherwise specified. MongoDB and memory backends are also supported. +- Cachier is thread-safe and supports per-function cache clearing via the `clear_cache()` method on decorated functions. +- Global configuration is possible via `set_default_params` and `enable_caching`/`disable_caching` functions. +- When reviewing code, ensure new features or bugfixes maintain compatibility with Python 3.9+, preserve thread safety, and follow the numpy docstring conventions for documentation. +- Tests are located in the `tests/` directory and should be run with `pytest`. MongoDB-related tests require either a mocked or live MongoDB instance. +- When discussing or generating code, prefer concise, readable, and well-documented Python code, and follow the established conventions in the codebase and README. +- For documentation, follow numpy docstring conventions and validate changes to `README.rst` with `python setup.py checkdocs`. diff --git a/.github/workflows/safety.yml b/.github/workflows/safety.yml index 50f38831..725ffb3f 100644 --- a/.github/workflows/safety.yml +++ b/.github/workflows/safety.yml @@ -22,6 +22,6 @@ jobs: pip install uv uv pip compile pyproject.toml -o requirements.txt - name: Security vulnerabilities scan - uses: shaypal5/python-safety-checker@v1.0.6 + uses: aufdenpunkt/python-safety-check@v1.0.6 with: scan_requirements_file_only: "true" diff --git a/README.rst b/README.rst index fc9c8e90..6daa1e55 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,7 @@ Features ======== * Pure Python. -* Compatible with Python 3.8+ (Python 2.7 was discontinued in version 1.2.8). +* Compatible with Python 3.9+ (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. From 9fb54b14f7ee9f0728dedc89fcee363238d65565 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 09:22:32 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 956ef265..8d7baa2f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,4 +9,4 @@ - When reviewing code, ensure new features or bugfixes maintain compatibility with Python 3.9+, preserve thread safety, and follow the numpy docstring conventions for documentation. - Tests are located in the `tests/` directory and should be run with `pytest`. MongoDB-related tests require either a mocked or live MongoDB instance. - When discussing or generating code, prefer concise, readable, and well-documented Python code, and follow the established conventions in the codebase and README. -- For documentation, follow numpy docstring conventions and validate changes to `README.rst` with `python setup.py checkdocs`. +- For documentation, follow numpy docstring conventions and validate changes to `README.rst` with `python setup.py checkdocs`. From 9894ba49483ebaa1e764e13e59a09da7c62b578f Mon Sep 17 00:00:00 2001 From: Shay Palachy Date: Thu, 3 Jul 2025 12:33:34 +0300 Subject: [PATCH 3/3] remove the safety check workflow --- .github/workflows/safety.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/safety.yml diff --git a/.github/workflows/safety.yml b/.github/workflows/safety.yml deleted file mode 100644 index 725ffb3f..00000000 --- a/.github/workflows/safety.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Check safety - -on: - pull_request: - branches: [master] - push: - branches: [master] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} - -jobs: - safety: - runs-on: "ubuntu-latest" - environment: safety_check - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - name: create requirements.txt - run: | - pip install uv - uv pip compile pyproject.toml -o requirements.txt - - name: Security vulnerabilities scan - uses: aufdenpunkt/python-safety-check@v1.0.6 - with: - scan_requirements_file_only: "true"