mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Add note about how Ruff handles PYI files wrt target version (#13111)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
parent
aba1802828
commit
eb3dc37faa
2 changed files with 11 additions and 1 deletions
|
@ -308,6 +308,16 @@ pub struct Options {
|
|||
///
|
||||
/// If both are specified, `target-version` takes precedence over
|
||||
/// `requires-python`.
|
||||
///
|
||||
/// Note that a stub file can [sometimes make use of a typing feature](https://typing.readthedocs.io/en/latest/spec/distributing.html#syntax)
|
||||
/// before it is available at runtime, as long as the stub does not make
|
||||
/// use of new *syntax*. For example, a type checker will understand
|
||||
/// `int | str` in a stub as being a `Union` type annotation, even if the
|
||||
/// type checker is run using Python 3.9, despite the fact that the `|`
|
||||
/// operator can only be used to create union types at runtime on Python
|
||||
/// 3.10+. As such, Ruff will often recommend newer features in a stub
|
||||
/// file than it would for an equivalent runtime file with the same target
|
||||
/// version.
|
||||
#[option(
|
||||
default = r#""py38""#,
|
||||
value_type = r#""py37" | "py38" | "py39" | "py310" | "py311" | "py312""#,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue