Skip to content

Commit bfc95de

Browse files
committed
Changes after review
1 parent af23c5b commit bfc95de

12 files changed

+45
-44
lines changed

.circleci/config.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ jobs:
4343
sudo pip install virtualenv --upgrade
4444
python -m venv venv && . venv/bin/activate
4545
set -eo pipefail
46-
pip install -e .[testing,dev,celery-manager,diskcache-manager] --progress-bar off
47-
pip install -r ./requires-ci.txt --progress-bar off
46+
pip install -e .[ci,dev,testing,celery,diskcache] --progress-bar off
4847
pip list | grep dash
4948
npm i
5049
npm run build
@@ -78,7 +77,7 @@ jobs:
7877
command: |
7978
sudo pip install --upgrade virtualenv --progress-bar off
8079
python -m venv venv || virtualenv venv && . venv/bin/activate
81-
pip install -e .[dev,testing] --no-cache-dir -r requires-ci.txt --progress-bar off
80+
pip install -e .[ci,dev,testing] --no-cache-dir --progress-bar off
8281
- save_cache:
8382
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-dev.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
8483
paths:
@@ -224,8 +223,7 @@ jobs:
224223
command: |
225224
. venv/bin/activate
226225
npm install --production
227-
pip install --no-cache-dir --upgrade --ignore-installed dash-package/dash-package.tar.gz --progress-bar off
228-
pip install -r requires-install.txt -r requires-ci.txt -r requires-dev.txt -r requires-testing.txt -r requires-celery-manager.txt -r requires-diskcache-manager.txt --progress-bar off
226+
pip install --no-cache-dir --upgrade --ignore-installed dash-package/dash-package.tar.gz[ci,dev,testing,celery,diskcache] --progress-bar off
229227
sed -i '/dash/d' requires-install.txt
230228
pip list | grep dash
231229
- run:
@@ -267,18 +265,18 @@ jobs:
267265
path: ~/dash
268266
- run: echo $PYTHON_VERSION > ver.txt
269267
- restore_cache:
270-
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}-{{ checksum "../../requires-ci.txt" }}
268+
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
271269
- attach_workspace:
272270
at: ~/dash/components/dash-core-components
273271
- run:
274272
name: 🐍 pip dev requirements
275273
command: |
276274
sudo pip install virtualenv --upgrade
277275
python -m venv venv || virtualenv venv && . venv/bin/activate
278-
pip install dash-package/dash-package.tar.gz[dev,testing]
279-
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt -r ../../requires-ci.txt
276+
pip install dash-package/dash-package.tar.gz[ci,dev,testing]
277+
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt
280278
- save_cache:
281-
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}-{{ checksum "../../requires-ci.txt" }}
279+
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
282280
paths:
283281
- venv
284282
- run:
@@ -422,8 +420,8 @@ jobs:
422420
sudo pip install virtualenv --upgrade
423421
python -m venv venv || virtualenv venv
424422
. venv/bin/activate
425-
pip install dash-package/dash-package.tar.gz[dev,testing]
426-
pip install -r dev-requirements.txt -r ../../requires-ci.txt
423+
pip install dash-package/dash-package.tar.gz[ci,dev,testing]
424+
pip install -r dev-requirements.txt
427425
npm ci
428426
429427
- run:
@@ -495,8 +493,7 @@ jobs:
495493
. venv/bin/activate
496494
pip install -r dev-requirements.txt --quiet
497495
pip install -r python-requirements.txt --quiet
498-
pip install -r ../../requires-ci.txt
499-
pip install dash-package/dash-package.tar.gz[dev,testing]
496+
pip install dash-package/dash-package.tar.gz[ci,dev,testing]
500497
- run:
501498
name: Build
502499
command: |
@@ -600,8 +597,8 @@ jobs:
600597
name: Install requirements
601598
command: |
602599
. venv/bin/activate
603-
pip install -r dev-requirements.txt -r ../../requires-ci.txt --quiet
604-
pip install dash-package/dash-package.tar.gz[dev,testing]
600+
pip install -r dev-requirements.txt --quiet
601+
pip install dash-package/dash-package.tar.gz[ci,dev,testing]
605602
606603
- run:
607604
name: Run eslint

dash/long_callback/managers/celery_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, celery_app, cache_by=None, expire=None):
3535
"""\
3636
CeleryLongCallbackManager requires extra dependencies which can be installed doing
3737
38-
$ pip install "dash[celery-manager]"\n"""
38+
$ pip install "dash[celery]"\n"""
3939
) from missing_imports
4040

4141
if not isinstance(celery_app, celery.Celery):

dash/long_callback/managers/diskcache_manager.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55

66
class DiskcacheLongCallbackManager(BaseLongCallbackManager):
7-
def __init__(self, cache, cache_by=None, expire=None):
7+
def __init__(self, cache=None, cache_by=None, expire=None):
88
"""
99
Long callback manager that runs callback logic in a subprocess and stores
1010
results on disk using diskcache
1111
1212
:param cache:
1313
A diskcache.Cache or diskcache.FanoutCache instance. See the diskcache
14-
documentation for information on configuration options.
14+
documentation for information on configuration options. If not provided,
15+
a diskcache.Cache instance will be created with default values.
1516
:param cache_by:
1617
A list of zero-argument functions. When provided, caching is enabled and
1718
the return values of these functions are combined with the callback
@@ -30,13 +31,20 @@ def __init__(self, cache, cache_by=None, expire=None):
3031
"""\
3132
DiskcacheLongCallbackManager requires extra dependencies which can be installed doing
3233
33-
$ pip install "dash[diskcache-manager]"\n"""
34+
$ pip install "dash[diskcache]"\n"""
3435
) from missing_imports
3536

36-
if not isinstance(cache, (diskcache.Cache, diskcache.FanoutCache)):
37-
raise ValueError("First argument must be a diskcache.Cache object")
37+
if cache is None:
38+
self.handle = diskcache.Cache()
39+
else:
40+
if not isinstance(cache, (diskcache.Cache, diskcache.FanoutCache)):
41+
raise ValueError(
42+
"First argument must be a diskcache.Cache "
43+
"or diskcache.FanoutCache object"
44+
)
45+
self.handle = cache
46+
3847
super().__init__(cache_by)
39-
self.handle = cache
4048
self.expire = expire
4149

4250
def terminate_job(self, job):

dash/testing/plugin.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,8 @@ def dashjl(request, dashjl_server, tmpdir):
189189

190190
@pytest.fixture
191191
def diskcache_manager():
192-
try:
193-
from dash.long_callback import ( # pylint: disable=import-outside-toplevel
194-
DiskcacheLongCallbackManager,
195-
)
196-
import diskcache # pylint: disable=import-outside-toplevel
197-
except ImportError as missing_imports:
198-
raise ImportError(
199-
"""\
200-
DiskcacheLongCallbackManager requires extra dependencies which can be installed doing
201-
202-
$ pip install "dash[diskcache-manager]"\n"""
203-
) from missing_imports
204-
205-
cache = diskcache.Cache()
206-
return DiskcacheLongCallbackManager(cache)
192+
from dash.long_callback import ( # pylint: disable=import-outside-toplevel
193+
DiskcacheLongCallbackManager,
194+
)
195+
196+
return DiskcacheLongCallbackManager()

requires-celery-manager.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requires-celery.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Dependencies used by the CeleryLongCallbackManager
2+
redis>=3.5.3
3+
celery[redis]>=5.1.2

requires-ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Dependencies used by CI on github.com/plotly/dash
12
black==21.6b0
23
dash-flow-example==0.0.5
34
dash-dangerously-set-inner-html

requires-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Dependencies used for development new Dash components
12
coloredlogs>=15.0.1
23
fire>=0.4.0
34
PyYAML>=5.4.1

requires-diskcache-manager.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

requires-diskcache.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Dependencies used by the DiskcacheLongCallbackManager
2+
diskcache>=5.2.1
3+
multiprocess>=0.70.12
4+
psutil>=5.8.0

0 commit comments

Comments
 (0)