From 960463c95a32b0051101ef34368a9c2e75436bda Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Mon, 16 Oct 2023 12:01:09 -0400 Subject: [PATCH] Update backend typing section --- src/docs/workflow.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/docs/workflow.mdx b/src/docs/workflow.mdx index 6be3bfbc07..13be57ab77 100644 --- a/src/docs/workflow.mdx +++ b/src/docs/workflow.mdx @@ -35,10 +35,10 @@ apply the revert directly to the primary branch. ## Python typechecking -We're slowing working to add typing to our Python codebase, using `mypy` to check types. While we do that, there are a few useful things to know: +We're slowly working to add typing to our Python codebase, using `mypy` to check types. While we do that, there are a few useful things to know: - As you create or work on Python files, please add typing where you can. If possible, try to follow the [Python typing best practices](https://typing.readthedocs.io/en/latest/source/best_practices.html), which may mean you also have to add `from __future__ import annotations` as the first line of your file. For more information about using types in Python, see [the typing docs](https://typing.readthedocs.io/en/latest/index.html). -- In some repos not all files currently pass a typecheck, so in those repos we're enabling checking on a file-by-file basis. (Look for a `files` entry in the `[mypy]` section of the repo's `mypy.ini` file to see if that's the case for a given repo.) This means that in those repos, adding new files and/or moving or renaming existing files may necessitate a change in the `mypy.ini` file, to add or update the files' paths. Also, if you update a file to include typing, please add it to the list! +- Check that the file you're modifying is not on the exclude list from `pyproject.toml`. In other words, you need to opt-in the file for type checking to happen. -- To test types locally, many repos have a `make` command you can run. (The exact command varies by repo. In both `sentry` and `getsentry` it is `make backend-typing`.) In repos which don't have a make command, you can run `mypy --strict --warn-unreachable --config-file mypy.ini` at the root level of the repo. +- To test types locally, you can run `mypy path/to/file` or just `mypy` to run against all files.