API discovery fails for project using namespace package
Difficulty: [2] IntermediateEffort: [2] MediumPriority: [3] HighType: ☹︎ Bug
## Description
I am trying to use great-docs in my package [firebird-base](https://github.com/FirebirdSQL/python3-base). I have created hatch environment for it in my `pyproject.toml`, initialized it and adjusted `great-docs.yml`. My package uses standard `src` scheme, but uses namespace package `firebird`, so it resides in `src/firebird/base` and imports start as `firebird.base.<module>`. File `src/firebird/base/__init__.py` does not do any imports.
The `great-docs scan` fails to locate the API with:
```
──────────────────────────────────────────────────
📡 Discovery
──────────────────────────────────────────────────
Package: firebird_base
Warning: Could not load package with griffe (ImportError)
Falling back to __all__ discovery
Could not locate __init__.py for package 'firebird_base'
No exports discovered.
```
Adding next to `great-docs.yml` does not help:
```
module: firebird.base
```
## Reproducible example
- Clone `firebird-base`
- Add next to `pyproject.toml`:
```
[tool.hatch.envs.gdocs]
dependencies = [
"great-docs",
]
[tool.hatch.envs.gdocs.scripts]
init = "great-docs init"
scan = "great-docs scan"
build = "great-docs build"
preview = "great-docs preview"
```
- Either run `hatch run gdocs:init` & `hatch run gdocs:scan` or enter the environment via `hatch shell gdocs` and run required commands from there.
1 条评论