Skip to content

Instantly share code, notes, and snippets.

@tgran2028
Created November 8, 2023 13:04
Show Gist options
  • Save tgran2028/1891991deb2190bc1024886de13225c6 to your computer and use it in GitHub Desktop.
Save tgran2028/1891991deb2190bc1024886de13225c6 to your computer and use it in GitHub Desktop.
Default values for pyright config. YAML format of default pyrightconfig.json
# Main Configuration Options
# Paths of directories or files that should be included. If no paths are specified, pyright defaults
# to the directory that contains the config file.
include: []
# [array of paths, optional]: Paths of directories or files that should be included. If no paths are
# specified, pyright defaults to the directory that contains the config file. Paths may contain
# wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more
# characters), or ? (a single character). If no include paths are specified, the root path for the
# workspace is assumed.
# Paths of directories or files that should not be included. These override the includes directories,
# allowing specific subdirectories to be ignored.
exclude:
- "**/node_modules"
- "**/__pycache__"
- "**/.*"
- "**/*.log"
- "**/*.lock"
- "**/.env*"
- "**/.venv*"
# [array of paths, optional]: Paths of directories or files that should not be included. These override
# the includes directories, allowing specific subdirectories to be ignored. Note that files in the
# exclude paths may still be included in the analysis if they are referenced (imported) by source files
# that are not excluded. Paths may contain wildcard characters ** (a directory or multiple levels of
# directories), * (a sequence of zero or more characters), or ? (a single character). If no exclude
# paths are specified, Pyright automatically excludes the following: **/node_modules, **/__pycache__,
# **/.* and any virtual environment directories.
# Paths of directories or files whose diagnostic output (errors and warnings) should be suppressed even
# if they are an included file or within the transitive closure of an included file.
ignore: []
# [array of paths, optional]: Paths of directories or files whose diagnostic output (errors and warnings)
# should be suppressed even if they are an included file or within the transitive closure of an included
# file. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a
# sequence of zero or more characters), or ? (a single character).
# Paths of directories or files that should use “strict” analysis if they are included.
strict: []
# array of paths, optional]: Paths of directories or files that should use “strict” analysis if they are
# included. This is the same as manually adding a “# pyright: strict” comment. In strict mode, most
# type-checking rules are enabled. Refer to this table for details about which rules are enabled in
# strict mode. Paths may contain wildcard characters ** (a directory or multiple levels of directories),
# * (a sequence of zero or more characters), or ? (a single character).
# Set of identifiers that should be assumed to contain a constant value wherever used within this program.
defineConstant: {}
# [map of constants to values (boolean or string), optional]: Set of identifiers that should be assumed
# to contain a constant value wherever used within this program. For example, { "DEBUG": true } indicates
# that pyright should assume that the identifier DEBUG will always be equal to True. If this identifier
# is used within a conditional expression (such as if not DEBUG:) pyright will use the indicated value to
# determine whether the guarded block is reachable or not. Member expressions that reference one of these
# constants (e.g. my_module.DEBUG) are also supported.
# Path to a directory that contains typeshed type stub files.
typeshedPath: ""
# [path, optional]: Path to a directory that contains typeshed type stub files. Pyright ships with a
# bundled copy of typeshed type stubs. If you want to use a different version of typeshed stubs, you can
# clone the typeshed github repo to a local directory and reference the location with this path. This
# option is useful if you’re actively contributing updates to typeshed.
# Path to a directory that contains custom type stubs.
stubPath: "./typings"
# [path, optional]: Path to a directory that contains custom type stubs. Each package's type stub file(s)
# are expected to be in its own subdirectory. The default value of this setting is "./typings".
# (typingsPath is now deprecated)
# Path to a directory containing one or more subdirectories, each of which contains a virtual environment.
venvPath: ""
# [path, optional]: Path to a directory containing one or more subdirectories, each of which
# contains a virtual environment. When used in conjunction with a venv setting (see below),
# pyright will search for imports in the virtual environment’s site-packages directory rather
# than the paths specified by the default Python interpreter. If you are working on a project
# with other developers, it is best not to specify this setting in the config file, since this
# path will typically differ for each developer. Instead, it can be specified on the command
# line or in a per-user setting. For more details, refer to the import resolution documentation.
# Used in conjunction with the venvPath, specifies the virtual environment to use.
venv: ""
# [string, optional]: Used in conjunction with the venvPath, specifies the virtual environment
# to use. For more details, refer to the import resolution documentation.
# Specifies whether output logs should be verbose.
verboseOutput: false
# verboseOutput [boolean]: Specifies whether output logs should be verbose. This is useful when
# diagnosing certain problems like import resolution issues.
# Additional search paths that will be used when searching for modules imported by files.
extraPaths: []
# [array of strings, optional]: Additional search paths that will be used when searching for
# modules imported by files.
# Specifies the version of Python that will be used to execute the source code.
pythonVersion: ""
# [string, optional]: Specifies the version of Python that will be used to execute the source
# code. The version should be specified as a string in the format "M.m" where M is the major
# version and m is the minor (e.g. "3.0" or "3.6"). If a version is provided, pyright will
# generate errors if the source code makes use of language features that are not supported in
# that version. It will also tailor its use of type stub files, which conditionalizes type
# definitions based on the version. If no version is specified, pyright will use the version
# of the current python interpreter, if one is present.
# Specifies the target platform that will be used to execute the source code.
pythonPlatform: "Linux"
# [string, optional]: Specifies the target platform that will be used to execute the source
# code. Should be one of "Windows", "Darwin", "Linux", or "All". If specified, pyright will
# tailor its use of type stub files, which conditionalize type definitions based on the
# platform. If no platform is specified, pyright will use the current platform.
# Specifies the default rule set to use.
typeCheckingMode: "basic"
# ["off", "basic", "strict"]: Specifies the default rule set to use. Some rules can be
# overridden using additional configuration flags documented below. The default value for this
# setting is "basic". If set to "off", all type-checking rules are disabled, but Python syntax
# and semantic errors are still reported.
# Determines whether pyright reads, parses and analyzes library code to extract type information
# in the absence of type stub files.
useLibraryCodeForTypes: true
# [boolean]: Determines whether pyright reads, parses and analyzes library code to extract type
# information in the absence of type stub files. Type information will typically be incomplete.
# We recommend using type stubs where possible. The default value for this option is true.
#######################################
# Type Check Diagnostics Settings
#######################################
# The following settings control pyright’s diagnostic output (warnings or errors). Unless
# otherwise specified, each diagnostic setting can specify a boolean value (`false` indicating
# that no error is generated and `true` indicating that an error is generated). Alternatively,
# a string value of `"none"`, `"warning"`, `"information"`, or `"error"` can be used to specify
# the diagnostic level.
diagnosticSeverityOverrides:
# When inferring the type of a list, use strict type assumptions.
strictListInference: false
# When inferring the type of a dictionary’s keys and values, use strict type assumptions.
strictDictionaryInference: false
# When inferring the type of a set, use strict type assumptions.
strictSetInference: false
# Analyze and report errors for functions and methods that have no type annotations for input
# parameters or return types.
analyzeUnannotatedFunctions: true
# PEP 484 indicates that when a function parameter is assigned a default value of None, its type
# should implicitly be Optional even if the explicit type is not. When enabled, this rule requires
# that parameter type annotations use Optional explicitly in this case.
strictParameterNoneValue: true
# PEP 484 defines support for "# type: ignore" comments. This switch enables or disables support
# for these comments.
enableTypeIgnoreComments: true
# PEP 585 indicates that aliases to types in standard collections that were introduced solely to
# support generics are deprecated as of Python 3.9. This switch controls whether these are treated
# as deprecated.
deprecateTypingAliases: false
# Enables a set of experimental (mostly undocumented) features that correspond to proposed or
# exploratory changes to the Python typing standard.
enableExperimentalFeatures: false
# Disables legacy behavior where `bytearray` and `memoryview` are considered subtypes of `bytes`.
disableBytesTypePromotions: false
# Generate or suppress diagnostics for general type inconsistencies, unsupported operations,
# argument/parameter mismatches, etc.
reportGeneralTypeIssues: "error"
# Generate or suppress diagnostics for properties where the type of the value passed to the setter
# is not assignable to the value returned by the getter.
reportPropertyTypeMismatch: "none"
# Generate or suppress diagnostics for non-standard member accesses for functions.
reportFunctionMemberAccess: "none"
# Generate or suppress diagnostics for imports that have no corresponding imported python file or
# type stub file.
reportMissingImports: "error"
# Generate or suppress diagnostics for imports that have no corresponding source file.
reportMissingModuleSource: "warning"
# Generate or suppress diagnostics for imports that have no corresponding type stub file.
reportMissingTypeStubs: "none"
# Generate or suppress diagnostics for cyclical import chains.
reportImportCycles: "none"
# Generate or suppress diagnostics for an imported symbol that is not referenced within that file.
reportUnusedImport: "none"
# Generate or suppress diagnostics for a class with a private name (starting with an underscore)
# that is not accessed.
reportUnusedClass: "none"
# Generate or suppress diagnostics for a function or method with a private name
# (starting with an underscore) that is not accessed.
reportUnusedFunction: "none"
# Generate or suppress diagnostics for a variable that is not accessed.
reportUnusedVariable: "none"
# Generate or suppress diagnostics for an imported symbol or module that is imported more than once.
reportDuplicateImport: "none"
# Generate or suppress diagnostics for a wildcard import from an external library.
reportWildcardImportFromLibrary: "warning"
# Generate or suppress diagnostics for an attempt to subscript (index) a variable with an Optional type.
reportOptionalSubscript: "error"
# Generate or suppress diagnostics for an attempt to access a member of a variable with an Optional type.
reportOptionalMemberAccess: "error"
# Generate or suppress diagnostics for an attempt to call a variable with an Optional type.
reportOptionalCall: "error"
# Generate or suppress diagnostics for an attempt to use an Optional type as an iterable value
# (e.g. within a `for` statement).
reportOptionalIterable: "error"
# Generate or suppress diagnostics when an `__init__` method signature is inconsistent with a `__new__` signature.
reportInconsistentConstructor: "none"
# Generate or suppress diagnostics for function overloads that overlap in signature and obscure each other
# or have incompatible return types.
reportOverlappingOverload: "none"
# Generate or suppress diagnostics for `__init__`, `__init_subclass__`, `__enter__` and `__exit__` methods
# in a subclass that fail to call through to the same-named method on a base class.
reportMissingSuperCall: "none"
# Generate or suppress diagnostics for instance variables within a class that are not initialized or declared
# within the class body or the `__init__` method.
reportUninitializedInstanceVariable: "none"
# Generate or suppress diagnostics for invalid escape sequences used within string literals. The Python
# specification indicates that such sequences will generate a syntax error in future versions.
reportInvalidStringEscapeSequence: "warning"
# Generate or suppress diagnostics for input or return parameters for functions or methods that have an unknown type.
reportUnknownParameterType: "none"
# Generate or suppress diagnostics for call arguments for functions or methods that have an unknown type.
reportUnknownArgumentType: "none"
# Generate or suppress diagnostics for input or return parameters for lambdas that have an unknown type.
reportUnknownLambdaType: "none"
# Generate or suppress diagnostics for variables that have an unknown type.
reportUnknownVariableType: "none"
# Generate or suppress diagnostics for class or instance variables that have an unknown type.
reportUnknownMemberType: "none"
# Generate or suppress diagnostics for input parameters for functions or methods that are missing a type
# annotation. The `self` and `cls` parameters used within methods are exempt from this check.
reportMissingParameterType: "none"
# Generate or suppress diagnostics when a generic class is used without providing explicit or implicit type arguments.
reportMissingTypeArgument: "none"
# Generate or suppress diagnostics when a TypeVar is used inappropriately (e.g. if a TypeVar appears only once)
# within a generic function signature.
reportInvalidTypeVarUse: "warning"
# Generate or suppress diagnostics for function calls, list expressions, set expressions, or dictionary expressions
# within a default value initialization expression. Such calls can mask expensive operations that are performed at
# module initialization time.
reportCallInDefaultInitializer: "none"
# Generate or suppress diagnostics for `isinstance` or `issubclass` calls where the result is statically determined
# to be always true. Such calls are often indicative of a programming error.
reportUnnecessaryIsInstance: "none"
# Generate or suppress diagnostics for `cast` calls that are statically determined to be unnecessary. Such calls are
# sometimes indicative of a programming error.
reportUnnecessaryCast: "none"
# Generate or suppress diagnostics for `==` or `!=` comparisons or other conditional expressions that are statically
# determined to always evaluate to False or True. Such comparisons are sometimes indicative of a programming error.
reportUnnecessaryComparison: "none"
# Generate or suppress diagnostics for `in` operations that are statically determined to always evaluate to False or
# True. Such operations are sometimes indicative of a programming error.
reportUnnecessaryContains: "none"
# Generate or suppress diagnostics for `assert` statement that will provably always assert. This can be indicative of
# a programming error.
reportAssertAlwaysTrue: "warning"
# Generate or suppress diagnostics for a missing or misnamed “self” parameter in instance methods
# and “cls” parameter in class methods. Instance methods in metaclasses (classes that derive from
# “type”) are allowed to use “cls” for instance methods.
reportSelfClsParameterName: "warning"
# Generate or suppress diagnostics for two or more string literals that follow each other, indicating
# an implicit concatenation. This is considered a bad practice and often masks bugs such as missing commas.
reportImplicitStringConcatenation: "none"
# Generate or suppress diagnostics for undefined variables.
reportUndefinedVariable: "error"
# Generate or suppress diagnostics for unbound and possibly unbound variables.
reportUnboundVariable: "error"
# Generate or suppress diagnostics for statements that are syntactically correct but have no purpose
# within a type stub file.
reportInvalidStubStatement: "none"
# Generate or suppress diagnostics for a module-level `__getattr__` call in a type stub file,
# indicating that it is incomplete.
reportIncompleteStub: "none"
# Generate or suppress diagnostics for statements that define or manipulate `__all__` in a way that
# is not allowed by a static type checker, thus rendering the contents of `__all__` to be unknown or incorrect.
# Also reports names within the `__all__` list that are not present in the module namespace.
reportUnsupportedDunderAll: "warning"
# Generate or suppress diagnostics for call statements whose return value is not used in any way and is not None.
reportUnusedCallResult: "none"
# Generate or suppress diagnostics for call statements whose return value is not used in any way and
# is a Coroutine. This identifies a common error where an `await` keyword is mistakenly omitted.
reportUnusedCoroutine: "error"
# Generate or suppress diagnostics for simple expressions whose results are not used in any way.
reportUnusedExpression: "none"
# Generate or suppress diagnostics for a `# type: ignore` or `# pyright: ignore` comment that would
# have no effect if removed.
reportUnnecessaryTypeIgnoreComment: "none"
# Generate or suppress diagnostics for a `match` statement that does not provide cases that exhaustively
# match against all potential types of the target expression.
reportMatchNotExhaustive: "none"
# Generate or suppress diagnostics for overridden methods in a class that are missing an explicit
# `@override` decorator.
reportImplicitOverride: "none"
# Generate or suppress diagnostics for files that are overriding a module in the stdlib.
reportShadowedImports: "none"
#######################################
# Execution Environment Options
#######################################
# Specifies a list of execution environments.
executionEnvironments:
# [array of objects, optional]: Specifies a list of execution environments (see below). Execution
# environments are searched from start to finish by comparing the path of a source file with the root
# path specified in the execution environment.
# Pyright allows multiple “execution environments” to be defined for different portions of your source
# tree. For example, a subtree may be designed to run with different import search paths or a different
# version of the python interpreter than the rest of the source base.
# Root path for the code that will execute within this execution environment.
- root: ""
# Additional search paths (in addition to the root path) that will be used when searching for modules
# imported by files within this execution environment.
- extraPaths:
# The version of Python used for this execution environment. If not specified, the global `pythonVersion`
# setting is used instead.
- pythonVersion: ""
# Specifies the target platform that will be used for this execution environment. If not specified,
# the global `pythonPlatform` setting is used instead.
- pythonPlatform: ""
# <default>
# rule_defaults:
# analyzeUnannotatedFunctions:
# Off: true
# Basic: true
# Strict: true
# strictParameterNoneValue:
# Off: true
# Basic: true
# Strict: true
# enableTypeIgnoreComments:
# Off: true
# Basic: true
# Strict: true
# disableBytesTypePromotions:
# Off: false
# Basic: false
# Strict: true
# strictListInference:
# Off: false
# Basic: false
# Strict: true
# strictDictionaryInference:
# Off: false
# Basic: false
# Strict: true
# strictSetInference:
# Off: false
# Basic: false
# Strict: true
# deprecateTypingAliases:
# Off: false
# Basic: false
# Strict: false
# enableExperimentalFeatures:
# Off: false
# Basic: false
# Strict: false
# reportMissingModuleSource:
# Off: "warning"
# Basic: "warning"
# Strict: "warning"
# reportMissingImports:
# Off: "warning"
# Basic: "error"
# Strict: "error"
# reportUndefinedVariable:
# Off: "warning"
# Basic: "error"
# Strict: "error"
# reportAssertAlwaysTrue:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportInvalidStringEscapeSequence:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportInvalidTypeVarUse:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportMissingTypeStubs:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportSelfClsParameterName:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportUnsupportedDunderAll:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportUnusedExpression:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportWildcardImportFromLibrary:
# Off: "none"
# Basic: "warning"
# Strict: "error"
# reportGeneralTypeIssues:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalSubscript:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalMemberAccess:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalCall:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalIterable:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalContextManager:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportOptionalOperand:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportTypedDictNotRequiredAccess:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportPrivateImportUsage:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportUnboundVariable:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportUnusedCoroutine:
# Off: "none"
# Basic: "error"
# Strict: "error"
# reportConstantRedefinition:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportDeprecated:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportDuplicateImport:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportFunctionMemberAccess:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportIncompatibleMethodOverride:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportIncompatibleVariableOverride:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportIncompleteStub:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportInconsistentConstructor:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportInvalidStubStatement:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportMatchNotExhaustive:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportMissingParameterType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportMissingTypeArgument:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportOverlappingOverload:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportPrivateUsage:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportTypeCommentUsage:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnknownArgumentType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnknownLambdaType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnknownMemberType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnknownParameterType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnknownVariableType:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnnecessaryCast:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnnecessaryComparison:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnnecessaryContains:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnnecessaryIsInstance:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnusedClass:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnusedImport:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnusedFunction:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUnusedVariable:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUntypedBaseClass:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUntypedClassDecorator:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUntypedFunctionDecorator:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportUntypedNamedTuple:
# Off: "none"
# Basic: "none"
# Strict: "error"
# reportCallInDefaultInitializer:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportImplicitOverride:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportImplicitStringConcatenation:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportImportCycles:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportMissingSuperCall:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportPropertyTypeMismatch:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportShadowedImports:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportUninitializedInstanceVariable:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportUnnecessaryTypeIgnoreComment:
# Off: "none"
# Basic: "none"
# Strict: "none"
# reportUnusedCallResult:
# Off: "none"
# Basic: "none"
# Strict: "none"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment