Skip to content

Commit

Permalink
Split dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer committed Sep 4, 2021
1 parent d5df9a7 commit bb7ad85
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 51 deletions.
25 changes: 14 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
sudo pip install virtualenv --upgrade
python -m venv venv && . venv/bin/activate
set -eo pipefail
pip install -e .[testing,dev] --progress-bar off && pip list | grep dash
pip install -e .[testing,dev,celery-manager,diskcache-manager] --progress-bar off
pip install -r ./requires-ci.txt --progress-bar off
pip list | grep dash
npm i
npm run build
python setup.py sdist
Expand All @@ -70,15 +72,15 @@ jobs:
- checkout
- run: echo $PYVERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requires-dev.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
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" }}
- run:
name: ️️🏗️ pip dev requirements
command: |
sudo pip install --upgrade virtualenv --progress-bar off
python -m venv venv || virtualenv venv && . venv/bin/activate
pip install -e . --no-cache-dir -r requires-install.txt -r requires-dev.txt -r requires-testing.txt --progress-bar off
pip install -e .[dev,testing] --no-cache-dir -r requires-ci.txt --progress-bar off
- save_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requires-dev.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
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" }}
paths:
- venv
- run:
Expand Down Expand Up @@ -214,7 +216,7 @@ jobs:
- checkout
- run: echo $PYVERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requires-dev.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-dev.txt" }}
- attach_workspace:
at: ~/dash
- run:
Expand All @@ -223,7 +225,7 @@ jobs:
. venv/bin/activate
npm install --production
pip install --no-cache-dir --upgrade --ignore-installed dash-package/dash-package.tar.gz --progress-bar off
pip install -r requires-install.txt -r requires-dev.txt -r requires-testing.txt --progress-bar off
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
sed -i '/dash/d' requires-install.txt
pip list | grep dash
- run:
Expand Down Expand Up @@ -265,7 +267,7 @@ jobs:
path: ~/dash
- run: echo $PYTHON_VERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}-{{ checksum "../../requires-ci.txt" }}
- attach_workspace:
at: ~/dash/components/dash-core-components
- run:
Expand All @@ -274,9 +276,9 @@ jobs:
sudo pip install virtualenv --upgrade
python -m venv venv || virtualenv venv && . venv/bin/activate
pip install dash-package/dash-package.tar.gz[dev,testing]
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt -r ../../requires-ci.txt
- save_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}-{{ checksum "../../requires-ci.txt" }}
paths:
- venv
- run:
Expand Down Expand Up @@ -421,7 +423,7 @@ jobs:
python -m venv venv || virtualenv venv
. venv/bin/activate
pip install dash-package/dash-package.tar.gz[dev,testing]
pip install -r dev-requirements.txt
pip install -r dev-requirements.txt -r ../../requires-ci.txt
npm ci
- run:
Expand Down Expand Up @@ -493,6 +495,7 @@ jobs:
. venv/bin/activate
pip install -r dev-requirements.txt --quiet
pip install -r python-requirements.txt --quiet
pip install -r ../../requires-ci.txt
pip install dash-package/dash-package.tar.gz[dev,testing]
- run:
name: Build
Expand Down Expand Up @@ -597,7 +600,7 @@ jobs:
name: Install requirements
command: |
. venv/bin/activate
pip install -r dev-requirements.txt --quiet
pip install -r dev-requirements.txt -r ../../requires-ci.txt --quiet
pip install dash-package/dash-package.tar.gz[dev,testing]
- run:
Expand Down
16 changes: 12 additions & 4 deletions dash/long_callback/managers/celery_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ def __init__(self, celery_app, cache_by=None, expire=None):
for ``expire`` seconds. If not provided, the lifetime of cache entries
is determined by the default behavior of the celery result backend.
"""
import celery # pylint: disable=import-outside-toplevel,import-error
from celery.backends.base import ( # pylint: disable=import-outside-toplevel,import-error
DisabledBackend,
)
try:
import celery # pylint: disable=import-outside-toplevel,import-error
from celery.backends.base import ( # pylint: disable=import-outside-toplevel,import-error
DisabledBackend,
)
except ImportError as missing_imports:
raise ImportError(
"""\
CeleryLongCallbackManager requires extra dependencies which can be installed doing
$ pip install "dash[celery-manager]"\n"""
) from missing_imports

if not isinstance(celery_app, celery.Celery):
raise ValueError("First argument must be a celery.Celery object")
Expand Down
9 changes: 2 additions & 7 deletions dash/long_callback/managers/diskcache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@ def __init__(self, cache, cache_by=None, expire=None):
except ImportError as missing_imports:
raise ImportError(
"""\
DiskcacheLongCallbackManager requires the multiprocess, diskcache, and psutil packages
which can be installed using pip...
DiskcacheLongCallbackManager requires extra dependencies which can be installed doing
$ pip install multiprocess diskcache psutil
or conda.
$ conda install -c conda-forge multiprocess diskcache psutil\n"""
$ pip install "dash[diskcache-manager]"\n"""
) from missing_imports

if not isinstance(cache, (diskcache.Cache, diskcache.FanoutCache)):
Expand Down
16 changes: 12 additions & 4 deletions dash/testing/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,18 @@ def dashjl(request, dashjl_server, tmpdir):

@pytest.fixture
def diskcache_manager():
from dash.long_callback import ( # pylint: disable=import-outside-toplevel
DiskcacheLongCallbackManager,
)
import diskcache # pylint: disable=import-outside-toplevel
try:
from dash.long_callback import ( # pylint: disable=import-outside-toplevel
DiskcacheLongCallbackManager,
)
import diskcache # pylint: disable=import-outside-toplevel
except ImportError as missing_imports:
raise ImportError(
"""\
DiskcacheLongCallbackManager requires extra dependencies which can be installed doing
$ pip install "dash[diskcache-manager]"\n"""
) from missing_imports

cache = diskcache.Cache()
return DiskcacheLongCallbackManager(cache)
2 changes: 2 additions & 0 deletions requires-celery-manager.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
redis>=3.5.3
celery[redis]>=5.1.2
13 changes: 13 additions & 0 deletions requires-ci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
black==21.6b0
dash-flow-example==0.0.5
dash-dangerously-set-inner-html
flake8==3.9.2
flaky==3.7.0
flask-talisman==0.8.1
isort==4.3.21;python_version<"3.7"
mock==4.0.3
orjson==3.3.1;python_version<"3.7"
orjson==3.6.1;python_version>="3.7"
pylint==2.10.2
pytest-mock==3.2.0
pytest-sugar==0.9.4
16 changes: 3 additions & 13 deletions requires-dev.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
dash_flow_example==0.0.5
dash-dangerously-set-inner-html
isort==4.3.21;python_version<"3.7"
mock==4.0.3
flake8==3.9.2
PyYAML==5.4.1
pylint==2.10.2
black==21.6b0
fire==0.4.0
coloredlogs==15.0.1
flask-talisman==0.8.1
orjson==3.3.1;python_version<"3.7"
orjson==3.6.1;python_version>="3.7"
coloredlogs>=15.0.1
fire>=0.4.0
PyYAML>=5.4.1
3 changes: 3 additions & 0 deletions requires-diskcache-manager.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
diskcache>=5.2.1
multiprocess>=0.70.12
psutil>=5.8.0
16 changes: 4 additions & 12 deletions requires-testing.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
pytest>=6.0.2
pytest-sugar>=0.9.4
pytest-mock>=3.2.0
beautifulsoup4>=4.8.2
cryptography<3.4;python_version<"3.7"
lxml>=4.6.2
selenium>=3.141.0
percy>=2.0.2
cryptography<3.4;python_version<"3.7"
pytest>=6.0.2
requests[security]>=2.21.0
beautifulsoup4>=4.8.2
selenium>=3.141.0
waitress>=1.4.4
diskcache>=5.2.1
multiprocess>=0.70.12
redis>=3.5.3
psutil>=5.8.0
celery[redis]>=5.1.2
flaky>=3.7.0
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def read_req_file(req_type):
extras_require={
"dev": read_req_file("dev"),
"testing": read_req_file("testing"),
"celery-manager": read_req_file("celery-manager"),
"diskcache-manager": read_req_file("diskcache-manager"),
},
entry_points={
"console_scripts": [
Expand Down

0 comments on commit bb7ad85

Please sign in to comment.