Skip to content

Commit

Permalink
Treat Python 3.7 as minimum supported version
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 25, 2023
1 parent 63b4f60 commit 3d4e444
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ruff_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ quoting the executed command, along with the relevant file contents and `pyproje
if cache {
// `--no-cache` doesn't respect code changes, and so is often confusing during
// development.
warn_user_once!("debug build without --no-cache.");
warn_user_once!("Detected debug build without --no-cache.");
}

let printer = Printer::new(&format, &log_level, &autofix, &violations);
Expand Down
2 changes: 1 addition & 1 deletion src/rules/pyupgrade/rules/unnecessary_future_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn unnecessary_future_import(checker: &mut Checker, stmt: &Stmt, names: &[Lo
if alias.node.asname.is_some() {
continue;
}
if (target_version >= PythonVersion::Py33
if (target_version >= PythonVersion::Py37
&& PY33_PLUS_REMOVE_FUTURES.contains(&alias.node.name.as_str()))
|| (target_version >= PythonVersion::Py37
&& PY37_PLUS_REMOVE_FUTURES.contains(&alias.node.name.as_str()))
Expand Down
17 changes: 8 additions & 9 deletions src/settings/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ use schemars::JsonSchema;
use serde::{de, Deserialize, Deserializer, Serialize};

use super::hashable::HashableHashSet;
use crate::fs;
use crate::registry::Rule;
use crate::rule_selector::RuleSelector;
use crate::{fs, warn_user_once};

#[derive(
Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema,
)]
#[serde(rename_all = "lowercase")]
pub enum PythonVersion {
Py33,
Py34,
Py35,
Py36,
Py37,
Py38,
Py39,
Expand All @@ -36,10 +32,13 @@ impl FromStr for PythonVersion {

fn from_str(string: &str) -> Result<Self, Self::Err> {
match string {
"py33" => Ok(PythonVersion::Py33),
"py34" => Ok(PythonVersion::Py34),
"py35" => Ok(PythonVersion::Py35),
"py36" => Ok(PythonVersion::Py36),
"py33" | "py34" | "py35" | "py36" => {
warn_user_once!(
"Specified a version below the minimum supported Python version. Defaulting \
to Python 3.7."
);
Ok(PythonVersion::Py37)
}
"py37" => Ok(PythonVersion::Py37),
"py38" => Ok(PythonVersion::Py38),
"py39" => Ok(PythonVersion::Py39),
Expand Down

0 comments on commit 3d4e444

Please sign in to comment.