Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hooks: dask: collect template files from dask/widgets/templates #852

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions _pyinstaller_hooks_contrib/stdhooks/hook-dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
#-----------------------------------------------------------------------------
"""
Collects in-repo dask.yaml and dask-schema.yaml data files.
"""

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('dask', includes=['*.yml', '*.yaml'])
# Collect data files:
# - dask.yaml
# - dask-schema.yaml
# - widgets/templates/*.html.j2 (but avoid collecting files from `widgets/tests/templates`!)
datas = collect_data_files('dask', includes=['*.yml', '*.yaml', 'widgets/templates/*.html.j2'])
3 changes: 3 additions & 0 deletions news/852.update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Update ``dask`` hook to collect template files from ``dask/widgets/templates``
directory; these file become mandatory when using ``dask.array`` and
``jinja2`` is available.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cryptography==44.0.0
dash==2.18.2
dash-bootstrap-components==1.6.0
dash-uploader==0.6.1
dask[array,diagnostics]==2024.12.1; python_version >= '3.10'
# discid requires libdiscid to be provided by the system.
# We install it via apt-get and brew on ubuntu and macOS CI runners, respectively.
discid==1.2.0; sys_platform != 'win32'
Expand Down
12 changes: 12 additions & 0 deletions tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,18 @@ def test_xarray_chunk(pyi_builder):
""")


# Test that we can import `dask.array` when `jinja2` is also available. In this case, `dask.array.core` ends up loading
# template files from `dask.widgets.templates`. Requires `numpy` (or `dask[array]`) for `dask.array` to be importable,
# and `jinja2` (`dask[diagnostics]`) for template files to become mandatory.
@importorskip('dask')
@importorskip('jinja2')
@importorskip('numpy')
def test_dask_array(pyi_builder):
pyi_builder.test_source("""
import dask.array
""")


@importorskip('tables')
def test_pytables(pyi_builder):
# NOTE: run_from_path=True prevents `pyi_builder` from completely clearing the `PATH` environment variable. At the
Expand Down
Loading