Skip to content

Commit ebca858

Browse files
committed
Fix CLI glue code
1 parent 4886bdb commit ebca858

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

packages/griffelib/src/griffe/__init__.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -593,22 +593,21 @@
593593
"vtree",
594594
]
595595

596-
__cli_all__ = [
597-
"DEFAULT_LOG_LEVEL",
598-
"check",
599-
"dump",
600-
"get_parser",
601-
"main",
602-
]
603-
604-
__all__ += __cli_all__ # noqa: PLE0605
605-
606596
try: # noqa: SIM105
607597
from griffecli import DEFAULT_LOG_LEVEL, check, dump, get_parser, main # noqa: F401
608598
except ImportError:
609-
pass
599+
_CLI_MISSING_FEATURES = {
600+
"DEFAULT_LOG_LEVEL",
601+
"check",
602+
"dump",
603+
"get_parser",
604+
"main",
605+
}
606+
else:
607+
_CLI_MISSING_FEATURES = set()
608+
610609

611610
def __getattr__(attr: str) -> object:
612-
if attr in __cli_all__:
613-
raise ImportError(f'Install `griffecli` to use {"griffe." + attr!r}')
611+
if attr in _CLI_MISSING_FEATURES:
612+
raise ImportError(f'Please install `griffecli` to use {"griffe." + attr!r}')
614613
raise AttributeError(attr)

tests/test_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def test_inventory_matches_api(
177177
not_in_api = []
178178
public_api_paths = {obj.path for obj in public_objects}
179179
public_api_paths.add("griffe")
180+
public_api_paths.add("griffecli")
180181
for item in inventory.values():
181182
if item.domain == "py" and "(" not in item.name:
182183
obj = loader.modules_collection[item.name]

0 commit comments

Comments
 (0)