Add basic CI configuration by lagru · Pull Request #8 · scientific-python/docstub · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ pip install 'docstub [optional] @ git+https://github.com/scientific-python/docst
## Usage & configuration

```shell
docstub example/example_pkg/
cd examples/
docstub example_pkg/
```
will create stub files for `example_pkg/` in `example/example_pkg-stubs/`.
will create stub files for `example_pkg/` in `examples/example_pkg-stubs/`.
For now, refer to `docstub --help` for more.


Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dev = [
]
test = [
"pytest >=5.0.0",
"coverage >=7.5.0",
"pytest-cov >= 5.0.0",
]

[project.urls]
Expand Down Expand Up @@ -90,6 +90,9 @@ ignore = [
]


[tool.docstub.docnames]
[tool.coverage]
run.source = ["docstub"]

[tool.docstub.known_imports]
cst = {import = "libcst", as="cst"}
lark = {import = "lark"}
11 changes: 5 additions & 6 deletions src/docstub/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
logger = logging.getLogger(__name__)


def _find_configuration(source_dir, config_path):
"""Find and load configuration from multiple possible sources.
def _load_configuration(config_path=None):
"""Load and merge configuration from CWD and optional files.

Parameters
----------
source_dir : Path
config_path : Path

Returns
Expand All @@ -31,13 +30,13 @@ def _find_configuration(source_dir, config_path):
"""
config = Config.from_toml(Config.DEFAULT_CONFIG_PATH)

pyproject_toml = source_dir.parent / "pyproject.toml"
pyproject_toml = Path.cwd() / "pyproject.toml"
if pyproject_toml.is_file():
logger.info("using %s", pyproject_toml)
add_config = Config.from_toml(pyproject_toml)
config = config.merge(add_config)

docstub_toml = source_dir.parent / "docstub.toml"
docstub_toml = Path.cwd() / "docstub.toml"
if docstub_toml.is_file():
logger.info("using %s", docstub_toml)
add_config = Config.from_toml(docstub_toml)
Expand Down Expand Up @@ -87,7 +86,7 @@ def main(source_dir, out_dir, config_path, verbose):
_setup_logging(verbose=verbose)

source_dir = Path(source_dir)
config = _find_configuration(source_dir, config_path)
config = _load_configuration(config_path)

# Build map of known imports
known_imports = common_known_imports()
Expand Down
2 changes: 1 addition & 1 deletion src/docstub/_stubs.py