From 7523d65d84bb2c5f8355e9597e1f5cd8b7c81b93 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Thu, 2 Dec 2021 09:13:48 +0000 Subject: [PATCH] Fix caching setup for Python dependencies in CircleCI --- .circleci/config.yml | 16 ++++++++++------ setup.cfg | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b666ce1d02..5a433b1a57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,17 +4,21 @@ jobs: backend: docker: - image: cimg/python:3.8.11 + environment: + PIPENV_VENV_IN_PROJECT: true steps: - checkout - restore_cache: - keys: - - pip-packages-v1-{{ .Branch }} - - pip-packages-v1- - - run: pipenv install -e .[testing] + key: pipenv-v1-{{ checksum "setup.py" }} + # Only install if .venv wasn’t cached. + - run: | + if [[ ! -e ".venv" ]]; then + pipenv install -e .[testing] + fi - save_cache: + key: pipenv-v1-{{ checksum "setup.py" }} paths: - - ~/.local/ - key: pip-package-v1-{{ .Branch }} + - .venv - run: pipenv run flake8 - run: pipenv run isort --check-only --diff . # Filter out known false positives, while preserving normal output and error codes. diff --git a/setup.cfg b/setup.cfg index 5951b68235..e3189b7bae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ python-tag = py3 # W503: line break before binary operator (superseded by W504 line break after binary operator) # N806: Variable in function should be lowercase ignore = D100,D101,D102,D103,D105,E501,W503,N806 -exclude = wagtail/project_template/*,node_modules,venv +exclude = wagtail/project_template/*,node_modules,venv,.venv max-line-length = 120 [doc8] @@ -21,7 +21,7 @@ ignore-path = _build,docs/_build [isort] line_length=100 multi_line_output=4 -skip=migrations,project_template,node_modules,.git,__pycache__,LC_MESSAGES,venv +skip=migrations,project_template,node_modules,.git,__pycache__,LC_MESSAGES,venv,.venv blocked_extensions=rst,html,js,svg,txt,css,scss,png,snap,tsx known_first_party=wagtail default_section=THIRDPARTY