Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Add typeChecker to project file and language docs (#4186)
Browse files Browse the repository at this point in the history
* Add typeChecker to project file and language docs

Fixes https://github.com/pulumi/pulumi-hugo/issues/4181.

* Update themes/default/content/docs/languages-sdks/python/_index.md

Co-authored-by: Will Jones <[email protected]>

* typeChecker -> typechecker

* Update themes/default/content/docs/languages-sdks/python/_index.md

Co-authored-by: Christian Nunciato <[email protected]>

* Update themes/default/content/docs/concepts/projects/project-file.md

Co-authored-by: Christian Nunciato <[email protected]>

---------

Co-authored-by: Will Jones <[email protected]>
Co-authored-by: Christian Nunciato <[email protected]>
  • Loading branch information
3 people authored Apr 19, 2024
1 parent e1b8c3f commit 281e41d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions themes/default/content/docs/concepts/projects/project-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The runtime attribute has an additional property called `options` where you can
| `buildTarget` | Only applies to the `go` runtime | Path to save the compiled go binary to. |
| `binary` | applies to the `go`, `dotnet`, and `java` runtimes | Path to a pre-built executable. |
| `virtualenv` | Only applies to the `python` runtime | Virtual environment path. |
| `typechecker` | Only applies to the `python` runtime | Type checker library to use. |
| `compiler` | Only applies to the `yaml` runtime | Executable and arguments issued to standard out. |

#### About `nodeargs`
Expand All @@ -82,6 +83,10 @@ Arguments specified here are passed to `node` when running the Pulumi program. F

New Python projects created with `pulumi new` have this option set by default. If not specified, Pulumi will invoke the `python3` command it finds on `$PATH` (falling back to `python`) to run the Python program. To use a virtual environment without the `virtualenv` option, run `pulumi` commands (such as `pulumi up`) from an activated virtual environment shell. Or, if using a tool like [Pipenv](https://github.com/pypa/pipenv), prefix `pulumi` commands with `pipenv run pulumi ...`.

#### About `typechecker`

This option can be set to `mypy` or `pyright`. (For additional type checkers, file an issue at [https://github.com/pulumi/pulumi/issues](https://github.com/pulumi/pulumi/issues).). If set, the given type checker will be invoked to check the Python code before running the Pulumi program.

### `config` options

`config` is a map of config property keys to either values or structured declarations.
Expand Down
15 changes: 15 additions & 0 deletions themes/default/content/docs/languages-sdks/python/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ runtime: python

When managing the virtual environment on your own, you'll need to run any `pulumi` commands (such as `pulumi up`) from an activated virtual environment shell (or, if using a tool like [Pipenv](https://github.com/pypa/pipenv), prefix any `pulumi` commands with `pipenv run pulumi ...`).

### Type Checking

Pulumi Python libraries ship with type hints. You can manually run a type checking system of your choice when developing with Pulumi to make use of these type hints. As of 3.113.0 Pulumi also has first class support for `mypy` and `pyright` when running your program.

This behavior is controlled by the following `typechecker` `runtime` option in `Pulumi.yaml`:

```yaml
runtime:
name: python
options:
typechecker: mypy
```

When set, Pulumi will invoke the type checker before running your program. This can be used to ensure your program is always type safe when running `pulumi up` without you having to remember to run a separate checking command beforehand.

### Adding a new dependency {#packages}

There are many [Pulumi Python packages](/registry) available.
Expand Down

0 comments on commit 281e41d

Please sign in to comment.