Skip to content

Make directory.get_tree() ignore patterns configurable #133

@hbisneto

Description

@hbisneto

Problem: get_tree() hardcodes an ignore list (.git, pycache, node_modules, .venv) and provides no way for callers to exclude additional project-specific directories

Why it matters: Large directories (e.g., node_modules, build, dist) make tree output verbose and slow, especially in CI or file-manager UIs. Users need project-specific control without forking the function.

Proposed solution: Add an optional ignore_patterns parameter (list[str] or None). If provided, use it; otherwise, fall back to the current default set. Support glob-style patterns via fnmatch so users can pass exact names or wildcards. Update the docstring and examples accordingly.

Notes: Maintain backward compatibility by keeping the current default when ignore_patterns=None. The module’s README already suggests customizing ignore_list for project-specific skips. This change formalizes that capability without breaking existing code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Directory ModuleRelated to the "Directory" module inside FileSystemPro

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions