Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point mypy at redwood type stub directly #6971

Merged
merged 1 commit into from
Oct 11, 2023
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
2 changes: 1 addition & 1 deletion redwood/redwood/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import BinaryIO

def generate_source_key_pair(passphrase: str, email: str) -> (str, str, str): ...
def generate_source_key_pair(passphrase: str, email: str) -> tuple[str, str, str]: ...
def is_valid_public_key(input: str) -> str: ...
def encrypt_message(recipients: list[str], plaintext: str, destination: Path) -> None: ...
def encrypt_stream(recipients: list[str], plaintext: BinaryIO, destination: Path) -> None: ...
Expand Down
5 changes: 3 additions & 2 deletions securedrop/bin/run-mypy
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ REPOROOT=$(git rev-parse --show-toplevel)
cd "${REPOROOT}"

if [ "$(command -v mypy)" ]; then
source "securedrop/bin/dev-deps"
build_redwood
# Point mypy at the redwood package with type stub, see second option on
# <https://mypy.readthedocs.io/en/stable/stubs.html#creating-a-stub>.
export MYPYPATH="./redwood"
mypy ./securedrop ./admin --namespace-packages --explicit-package-bases "$@"
elif [ -d "/opt/venvs/securedrop-app-code/" ]; then
# Inside the dev container, but no mypy
Expand Down