You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The repo currently has Pyright configured in dify-agent/pyproject.toml[1] and MyPy as a dev dependency in api/pyproject.toml[2] but without an explicit [tool.mypy] section.
To enable stricter type checking:
For Pyright (dify-agent/pyproject.toml) — add typeCheckingMode or specific error rules:
To use Pyrefly (Facebook's fast Python type checker) with strict settings, you'd add a [tool.pyrefly] section to your pyproject.toml (e.g., api/pyproject.toml):
[tool.pyrefly]
project-includes = ["src"] # adjust to your source directoriespython-version = "3.12"preset = "strict"
Activity
asukaminato0721 commentedon May 18, 2026
@dosu how to do it
dosubot commentedon May 18, 2026
The repo currently has Pyright configured in
dify-agent/pyproject.toml[1] and MyPy as a dev dependency inapi/pyproject.toml[2] but without an explicit[tool.mypy]section.To enable stricter type checking:
For Pyright (dify-agent/pyproject.toml) — add
typeCheckingModeor specific error rules:For the API (api/pyproject.toml) — add a new MyPy config section:
Since enabling strict mode will likely surface many existing type errors across the codebase, a common approach is to:
# type: ignoreto suppress known issues temporarily.Would you like me to look into what CI checks are currently configured for type checking, or estimate how many errors strict mode would surface?
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
asukaminato0721 commentedon May 18, 2026
@dosu no, use pyrefly
dosubot commentedon May 18, 2026
To use Pyrefly (Facebook's fast Python type checker) with strict settings, you'd add a
[tool.pyrefly]section to yourpyproject.toml(e.g.,api/pyproject.toml):The
"strict"preset automatically enables [1]:strict-callable-subtyping = trueimplicit-anyerrors (covers all implicit-Anysub-kinds, including implicit-any-parameter)missing-override-decoratorerrorsunused-ignoreerrorsIf you want more granular control instead of the full preset, you can configure individual error codes:
To run it:
You can also use a baseline file to suppress existing errors and only enforce strict checking on new code going forward:
pyrefly check --baseline="pyrefly-baseline.json" --update-baselineThen subsequent runs will only report newly introduced errors [1].
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.