Skip to main content

Efficiently cache calls to functions

Project description

cacholote

Efficiently cache calls to functions

Quick Start

>>> import cacholote
>>> cacholote.config.set(cache_db_urlpath="sqlite://")
<cacholote.config.set ...

>>> @cacholote.cacheable
... def now():
...     import datetime
...     return datetime.datetime.now()

>>> with cacholote.config.set(use_cache=True):
...     now() == now()
True

>>> with cacholote.config.set(use_cache=False):
...     now() == now()
False

Workflow for developers/contributors

For best experience create a new conda environment (e.g. DEVELOP) with Python 3.10:

conda create -n DEVELOP -c conda-forge python=3.10
conda activate DEVELOP

Before pushing to GitHub, run the following commands:

  1. Update conda environment: make conda-env-update
  2. Install this package: pip install -e .
  3. Sync with the latest template (optional): make template-update
  4. Run quality assurance checks: make qa
  5. Run tests: make unit-tests
  6. Run the static type checker: make type-check
  7. Build the documentation (see Sphinx tutorial): make docs-build

License

Copyright 2019, B-Open Solutions srl.
Copyright 2022, European Union.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cacholote-0.1.3.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

cacholote-0.1.3-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file cacholote-0.1.3.tar.gz.

File metadata

  • Download URL: cacholote-0.1.3.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for cacholote-0.1.3.tar.gz
Algorithm Hash digest
SHA256 dea7a3c82edd77b29c28193358f2df6d8e4009d0daa71de6f41059ae90a064a5
MD5 1ce5279413504a2bc8a6c3fe7b103fd0
BLAKE2b-256 22b2c77b094e1f3a1922924b13afb21f2f68b45adf02806cc76c5916bb291d27

See more details on using hashes here.

File details

Details for the file cacholote-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cacholote-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for cacholote-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fbb028ced8c0238c1ba77c365fbd41bd0d675c7ca0af569d2389ec6f95a21a3e
MD5 58c1c587a0a90ab3d95602840d35b6d8
BLAKE2b-256 a8d88529b701d630b046e0b3b62092ab3b39d755efae525170cca5bba793f725

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page