Skip to content

Commit 21d76d2

Browse files
committed
Add tutorial doc
1 parent 79eb572 commit 21d76d2

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

docs/source/tutorials/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ write leapp actors for **In-Place Upgrades (IPU)** with the leapp framework.
1818
:glob:
1919

2020
setup-devel-env
21+
setup-devel-tools
2122
howto-first-actor-upgrade
2223
howto-single-actor-run
2324
custom-content
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Making development tools work
2+
3+
The Leapp framework uses dynamic import mechanisms to load entities from repositories at runtime. While this keeps import paths concise, the non-standard setup often causes development tools—such as language servers and type checkers—to behave unreliably or fail entirely.
4+
5+
Fortunately, some tools, such as [Pyright](https://github.com/microsoft/pyright) and [Pylance](https://github.com/microsoft/pylance-release), can be tricked to work using standard Python type stub files. Scripts are used to generate type stubs reflecting the runtime module layout and tools can then be configured to prioritize these stubs over real source files. To get started follow the setup instructions:
6+
7+
1. Configure your tool of choice to use the `typings` directory in the root of the project as the type stub directory.
8+
For example to configure this in Pyright, add the following to `pyrightconfig.json`:
9+
```json
10+
"stubPath": "./typings",
11+
"reportMissingTypeStubs": false,
12+
```
13+
14+
```{note}
15+
A `pyrightconfig.json` with reasonable configuration for the project is already included in the repository.
16+
```
17+
18+
2. Install `mypy` (used for stub generation): `pip install mypy`.
19+
3. Generate the stubs by running the `make stubgen` command. Note that the generated stubs are static, i.e. regeneration is required to reflect new changes in source files.

0 commit comments

Comments
 (0)