Skip to content

Commit

Permalink
Change default for Python version from 3.8 to 3.9 (#13896)
Browse files Browse the repository at this point in the history
Co-authored-by: Micha Reiser <[email protected]>
  • Loading branch information
takaya0 and MichaReiser authored Nov 18, 2024
1 parent aa9ecbd commit 6dffcf8
Show file tree
Hide file tree
Showing 125 changed files with 168 additions and 5,488 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ exclude = [
line-length = 88
indent-width = 4
# Assume Python 3.8
target-version = "py38"
# Assume Python 3.9
target-version = "py39"
[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
Expand Down
14 changes: 14 additions & 0 deletions crates/red_knot/src/target_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ impl From<TargetVersion> for red_knot_python_semantic::PythonVersion {
}
}
}

#[cfg(test)]
mod tests {
use crate::target_version::TargetVersion;
use red_knot_python_semantic::PythonVersion;

#[test]
fn same_default_as_python_version() {
assert_eq!(
PythonVersion::from(TargetVersion::default()),
PythonVersion::default()
);
}
}
14 changes: 14 additions & 0 deletions crates/red_knot_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,17 @@ impl System for WasmSystem {
fn not_found() -> std::io::Error {
std::io::Error::new(std::io::ErrorKind::NotFound, "No such file or directory")
}

#[cfg(test)]
mod tests {
use crate::TargetVersion;
use red_knot_python_semantic::PythonVersion;

#[test]
fn same_default_as_python_version() {
assert_eq!(
PythonVersion::from(TargetVersion::default()),
PythonVersion::default()
);
}
}
6 changes: 5 additions & 1 deletion crates/ruff_linter/src/settings/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ use crate::{display_settings, fs};
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum PythonVersion {
Py37,
Py38,
// Make sure to also change the default for `ruff_python_formatter::PythonVersion`
// when changing the default here.
#[default]
Py38,
Py39,
Py310,
Py311,
Expand All @@ -68,6 +68,10 @@ impl PythonVersion {
Self::Py313
}

pub const fn minimal_supported() -> Self {
Self::Py37
}

pub const fn as_tuple(&self) -> (u8, u8) {
match self {
Self::Py37 => (3, 7),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"target_version": "py38"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"target_version": "py38"}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6dffcf8

Please sign in to comment.