Skip to content

Commit

Permalink
feat: Add support for globs in paths configuration
Browse files Browse the repository at this point in the history
This change allows for values in the paths configuration option to be
globs by resolving them before passing them off to griffe.
  • Loading branch information
AndrewGuenther committed Aug 10, 2022
1 parent e2719e6 commit 5a41773
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ plugins:
- https://mkdocstrings.github.io/objects.inv
- https://mkdocstrings.github.io/griffe/objects.inv
options:
paths:
- src/*
docstring_style: google
docstring_options:
ignore_init_summary: yes
Expand Down
3 changes: 3 additions & 0 deletions src/mkdocstrings_handlers/python/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import glob
import os
import posixpath
import re
Expand Down Expand Up @@ -127,6 +128,8 @@ def __init__(
super().__init__(*args, **kwargs)
self._config_file_path = config_file_path
paths = paths or []
resolved_globs = [glob.glob(path) for path in paths]
paths = [path for glob_list in resolved_globs for path in glob_list]
if not paths and config_file_path:
paths.append(os.path.dirname(config_file_path))
search_paths = [path for path in sys.path if path] # eliminate empty path
Expand Down

0 comments on commit 5a41773

Please sign in to comment.