diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..8d7baa2f --- /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 deleted file mode 100644 index 50f38831..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: shaypal5/python-safety-checker@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.