Skip to main content

A bunch of caches

Project description

pycaches

PyPI Travis build on master Travis build on develop Codecov coverage Chat on Gitter License

A bunch of caches

Installation

$ pip install pycaches

Usage

Decorator

from pycaches import cache


@cache()
def example():
    print("Hi, I will be called once!")

example()  # Prints "Hi, I will be called once!"
example()  # Is not called
import time

from pycaches import cache


@cache()
def long_computation(x):
    print("Performing long computation...")
    time.sleep(1)
    return x + 1

long_computation(5)  # Sleeps for 1 second and returns 6
long_computation(5)  # Immediately returns 6

long_computation(6)  # Sleeps for 1 second and returns 7
long_computation(6)  # Immediately returns 7
long_computation(6)  # And again

Contribution

Just clone repository, make your changes and create a pull request.

Do not forget to make sure code quality is high: run linters, typecheckers, check code coverage, etc. You can do it all with make:

  1. make lint: pylint and pycodestyle
  2. make typecheck: mypy
  3. make test: pytest
  4. make coverage: pytest with pytest-cov
  5. make quality: radon
  6. make build: setup.py

And just make or make all to run all these targets

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

pycaches-0.0.2.tar.gz (1.8 kB view hashes)

Uploaded Source

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