plotly / plotly/dash

add `assets_ignore` to include full path in regex search

Open
#2,584 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Is your feature request related to a problem? Please describe.
We structure our assets folders to have different subfolders inside of them, and in a path we have css files we'd like to ignore (used for pdf generation with weasyprint).

so for example:
assets/subpath/base.css

The behavior I'd have expected is to be able to pass ".*\/subpath\/.*" as a valid regex string to ignore all files in the subpath dir. But instead https://github.com/plotly/dash/blob/a7a12d180e16eac0a84b88e2b8dc8f7c7601cbaf/dash/dash.py#L1344 does the regex match only against the file name itself.

I'm curious if others have run into this behavior/issue before.

Describe the solution you'd like
Simplest version is:

files_gen = (x for x in files if not ignore_filter.search("/".join([base, x]) if base else x)

This would obviously be a breaking change for those that prefix scan in their ignore patterns, so might just be me that needs to change. Maybe just a documentation fix that declares that these regex patterns are for the filename and not full path?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in dash/dash.py around line 1344, where the ignore regex is matched against asset filenames. Check the surrounding asset-discovery logic and existing tests or documentation to determine the current contract. Done means the requested full-path matching behavior, or an explicit filename-only contract, is covered by tests or documentation without leaving the breaking-change question ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.