Requests-cache is in a relatively mature state, but is still under active maintenance. Contributions are welcome, and will be attributed on the Contributors page.
If you discover a bug or want to request a new feature, please create an issue.
If you want to discuss ideas about the project in general, or have a more open-ended question or feedback, please use Discussions.
If you are interested in helping out, here are a few ways to get started:
Here are some general guidelines for submitting a pull request:
main branchTo setup requests-cache for development, first install these tools:
Next, clone the repository and install dependencies:
git clone https://github.com/requests-cache/requests-cache.git cd requests-cache uv sync --frozen --all-extras --all-groups uv tool install prek
uv will automatically install python and create a new virtual environment if needed.
Code linting and formatting tools used include:
All of these will be run by GitHub Actions on pull requests. You can also run them locally with prek (or pre-commit, if you prefer):
prek run -a
Optionally, you can use prek to automatically
prek install
To disable hooks:
prek uninstall
This can save you some time in that it will show you errors immediately rather than waiting for CI jobs to complete, or if you forget to manually run the checks before committing.
Tests are divided into unit and integration tests:
Have a look at conftest.py for pytest fixtures that apply the most common mocking steps and other test setup.
Overview:
uv run pytest to run all testsuv run pytest tests/unit to run only unit testsuv run pytest tests/integration to run only integration testsUnit tests can be run without running any additional services:
uv run pytest tests/unit
A live web server and backend databases are required to run integration tests, and a docker-compose config is included to make this easier. First, install docker and docker compose.
Start the docker containers:
docker compose up -d
After this, you can run all the tests:
uv run pytest
or just the integration tests:
uv run pytest tests/integration
After, you are done testing, shutdown the docker containers:
docker compose down
If you can't easily run Docker containers in your environment but still want to run some of the integration tests, you can use pytest-httpbin instead of the httpbin container. This just requires installing an extra package and setting an environment variable:
export USE_PYTEST_HTTPBIN=true uv pip install pytest-httpbin uv run pytest tests/integration/test_sqlite.py
For backend databases, you can install and run them on the host instead of in a container, as long as they are running on the default port.
Sphinx is used to generate documentation.
To build the docs locally:
uv run sphinx-build docs docs/_build/html
To preview:
open docs/_build/html/index.html
Alternatively, you also use sphinx-autobuild to rebuild the docs and live reload in the browser whenever doc contents change:
uv run sphinx-autobuild --open-browser docs docs/_build/html
Sometimes, there are differences in the Readthedocs build environment that can cause builds to succeed locally but fail remotely. To help debug this, you can use the readthedocs/build container to build the docs. A configured build container is included in docs/docker-compose.yml to simplify this.
Run with:
# Optionally add --build to rebuild with updated dependencies docker-compose -f docs/docker-compose.yml up -d docker exec readthedocs make all
main branch.Release steps:
pyproject.toml and requests_cache/__init__.pyHISTORY.mdpython tests/generate_test_db.pymain branchgit tag v0.1 && git push origin --tagspip installDownstream builds:
Pre-release builds are convenient for letting testers try out in-development changes. Versions with the suffix .dev (among others) can be deployed to PyPI and installed by users with pip install --pre, and are otherwise ignored by pip install:
# Install latest pre-release build: pip install -U --pre requests-cache # Install latest stable build pip install -U requests-cache
Notes: