Skip to content

Commit c4e39ae

Browse files
Merge branch 'astral-sh:main' into pylint/chained-comparison
2 parents 0b8ea97 + 7441da2 commit c4e39ae

File tree

614 files changed

+371
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

614 files changed

+371
-318
lines changed

.github/workflows/sync_typeshed.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
- name: Sync typeshed
3838
id: sync
3939
run: |
40-
rm -rf ruff/crates/red_knot_python_semantic/vendor/typeshed
41-
mkdir ruff/crates/red_knot_python_semantic/vendor/typeshed
42-
cp typeshed/README.md ruff/crates/red_knot_python_semantic/vendor/typeshed
43-
cp typeshed/LICENSE ruff/crates/red_knot_python_semantic/vendor/typeshed
44-
cp -r typeshed/stdlib ruff/crates/red_knot_python_semantic/vendor/typeshed/stdlib
45-
rm -rf ruff/crates/red_knot_python_semantic/vendor/typeshed/stdlib/@tests
46-
git -C typeshed rev-parse HEAD > ruff/crates/red_knot_python_semantic/vendor/typeshed/source_commit.txt
40+
rm -rf ruff/crates/ruff_vendored/vendor/typeshed
41+
mkdir ruff/crates/ruff_vendored/vendor/typeshed
42+
cp typeshed/README.md ruff/crates/ruff_vendored/vendor/typeshed
43+
cp typeshed/LICENSE ruff/crates/ruff_vendored/vendor/typeshed
44+
cp -r typeshed/stdlib ruff/crates/ruff_vendored/vendor/typeshed/stdlib
45+
rm -rf ruff/crates/ruff_vendored/vendor/typeshed/stdlib/@tests
46+
git -C typeshed rev-parse HEAD > ruff/crates/ruff_vendored/vendor/typeshed/source_commit.txt
4747
- name: Commit the changes
4848
id: commit
4949
if: ${{ steps.sync.outcome == 'success' }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fail_fast: true
22

33
exclude: |
44
(?x)^(
5-
crates/red_knot_python_semantic/vendor/.*|
5+
crates/ruff_vendored/vendor/.*|
66
crates/red_knot_workspace/resources/.*|
77
crates/ruff_linter/resources/.*|
88
crates/ruff_linter/src/rules/.*/snapshots/.*|

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 0.6.7
4+
5+
### Preview features
6+
7+
- Add Python version support to ruff analyze CLI ([#13426](https://github.com/astral-sh/ruff/pull/13426))
8+
- Add `exclude` support to `ruff analyze` ([#13425](https://github.com/astral-sh/ruff/pull/13425))
9+
- Fix parentheses around return type annotations ([#13381](https://github.com/astral-sh/ruff/pull/13381))
10+
11+
### Rule changes
12+
13+
- \[`pycodestyle`\] Fix: Don't autofix if the first line ends in a question mark? (D400) ([#13399](https://github.com/astral-sh/ruff/pull/13399))
14+
15+
### Bug fixes
16+
17+
- Respect `lint.exclude` in ruff check `--add-noqa` ([#13427](https://github.com/astral-sh/ruff/pull/13427))
18+
19+
### Performance
20+
21+
- Avoid tracking module resolver files in Salsa ([#13437](https://github.com/astral-sh/ruff/pull/13437))
22+
- Use `forget` for module resolver database ([#13438](https://github.com/astral-sh/ruff/pull/13438))
23+
324
## 0.6.6
425

526
### Preview features

Cargo.lock

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ license = "MIT"
1414
[workspace.dependencies]
1515
ruff = { path = "crates/ruff" }
1616
ruff_cache = { path = "crates/ruff_cache" }
17-
ruff_db = { path = "crates/ruff_db" }
17+
ruff_db = { path = "crates/ruff_db", default-features = false }
1818
ruff_diagnostics = { path = "crates/ruff_diagnostics" }
1919
ruff_formatter = { path = "crates/ruff_formatter" }
2020
ruff_graph = { path = "crates/ruff_graph" }
@@ -34,11 +34,12 @@ ruff_python_trivia = { path = "crates/ruff_python_trivia" }
3434
ruff_server = { path = "crates/ruff_server" }
3535
ruff_source_file = { path = "crates/ruff_source_file" }
3636
ruff_text_size = { path = "crates/ruff_text_size" }
37+
ruff_vendored = { path = "crates/ruff_vendored" }
3738
ruff_workspace = { path = "crates/ruff_workspace" }
3839

3940
red_knot_python_semantic = { path = "crates/red_knot_python_semantic" }
4041
red_knot_server = { path = "crates/red_knot_server" }
41-
red_knot_workspace = { path = "crates/red_knot_workspace" }
42+
red_knot_workspace = { path = "crates/red_knot_workspace", default-features = false }
4243

4344
aho-corasick = { version = "1.1.3" }
4445
annotate-snippets = { version = "0.9.2", features = ["color"] }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
136136
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
137137

138138
# For a specific version.
139-
curl -LsSf https://astral.sh/ruff/0.6.6/install.sh | sh
140-
powershell -c "irm https://astral.sh/ruff/0.6.6/install.ps1 | iex"
139+
curl -LsSf https://astral.sh/ruff/0.6.7/install.sh | sh
140+
powershell -c "irm https://astral.sh/ruff/0.6.7/install.ps1 | iex"
141141
```
142142

143143
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
@@ -170,7 +170,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
170170
```yaml
171171
- repo: https://github.com/astral-sh/ruff-pre-commit
172172
# Ruff version.
173-
rev: v0.6.6
173+
rev: v0.6.7
174174
hooks:
175175
# Run the linter.
176176
- id: ruff

crates/red_knot/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ license.workspace = true
1313

1414
[dependencies]
1515
red_knot_python_semantic = { workspace = true }
16-
red_knot_workspace = { workspace = true }
16+
red_knot_workspace = { workspace = true, features = ["zstd"] }
1717
red_knot_server = { workspace = true }
18-
1918
ruff_db = { workspace = true, features = ["os", "cache"] }
2019

2120
anyhow = { workspace = true }

crates/red_knot_python_semantic/Cargo.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ bitflags = { workspace = true }
2424
camino = { workspace = true }
2525
compact_str = { workspace = true }
2626
countme = { workspace = true }
27-
once_cell = { workspace = true }
2827
ordermap = { workspace = true }
2928
salsa = { workspace = true }
3029
thiserror = { workspace = true }
@@ -35,20 +34,14 @@ smallvec = { workspace = true }
3534
static_assertions = { workspace = true }
3635
test-case = { workspace = true }
3736

38-
[build-dependencies]
39-
path-slash = { workspace = true }
40-
walkdir = { workspace = true }
41-
zip = { workspace = true, features = ["zstd", "deflate"] }
42-
4337
[dev-dependencies]
4438
ruff_db = { workspace = true, features = ["os", "testing"] }
4539
ruff_python_parser = { workspace = true }
40+
ruff_vendored = { workspace = true }
4641

4742
anyhow = { workspace = true }
4843
insta = { workspace = true }
4944
tempfile = { workspace = true }
50-
walkdir = { workspace = true }
51-
zip = { workspace = true }
5245

5346
[lints]
5447
workspace = true

crates/red_knot_python_semantic/src/db.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub trait Db: SourceDb + Upcast<dyn SourceDb> {
1111
pub(crate) mod tests {
1212
use std::sync::Arc;
1313

14-
use crate::module_resolver::vendored_typeshed_stubs;
1514
use ruff_db::files::{File, Files};
1615
use ruff_db::system::{DbWithTestSystem, System, TestSystem};
1716
use ruff_db::vendored::VendoredFileSystem;
@@ -33,7 +32,7 @@ pub(crate) mod tests {
3332
Self {
3433
storage: salsa::Storage::default(),
3534
system: TestSystem::default(),
36-
vendored: vendored_typeshed_stubs().clone(),
35+
vendored: ruff_vendored::file_system().clone(),
3736
events: std::sync::Arc::default(),
3837
files: Files::default(),
3938
}

crates/red_knot_python_semantic/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use rustc_hash::FxHasher;
44

55
pub use db::Db;
66
pub use module_name::ModuleName;
7-
pub use module_resolver::{
8-
resolve_module, system_module_search_paths, vendored_typeshed_stubs, Module,
9-
};
7+
pub use module_resolver::{resolve_module, system_module_search_paths, Module};
108
pub use program::{Program, ProgramSettings, SearchPathSettings, SitePackages};
119
pub use python_version::PythonVersion;
1210
pub use semantic_model::{HasTy, SemanticModel};

crates/red_knot_python_semantic/src/module_resolver/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub use module::Module;
44
pub use resolver::resolve_module;
55
pub(crate) use resolver::{file_to_module, SearchPaths};
66
use ruff_db::system::SystemPath;
7-
pub use typeshed::vendored_typeshed_stubs;
87

98
use crate::module_resolver::resolver::search_paths;
109
use crate::Db;

crates/red_knot_python_semantic/src/module_resolver/resolver.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
use rustc_hash::{FxBuildHasher, FxHashSet};
21
use std::borrow::Cow;
32
use std::iter::FusedIterator;
4-
use std::ops::Deref;
3+
4+
use rustc_hash::{FxBuildHasher, FxHashSet};
55

66
use ruff_db::files::{File, FilePath, FileRootKind};
77
use ruff_db::system::{DirectoryEntry, System, SystemPath, SystemPathBuf};
88
use ruff_db::vendored::{VendoredFileSystem, VendoredPath};
99

10-
use super::module::{Module, ModuleKind};
11-
use super::path::{ModulePath, SearchPath, SearchPathValidationError};
1210
use crate::db::Db;
1311
use crate::module_name::ModuleName;
1412
use crate::module_resolver::typeshed::{vendored_typeshed_versions, TypeshedVersions};
1513
use crate::site_packages::VirtualEnvironment;
1614
use crate::{Program, PythonVersion, SearchPathSettings, SitePackages};
1715

16+
use super::module::{Module, ModuleKind};
17+
use super::path::{ModulePath, SearchPath, SearchPathValidationError};
18+
1819
/// Resolves a module name to a module.
1920
pub fn resolve_module(db: &dyn Db, module_name: ModuleName) -> Option<Module> {
2021
let interned_name = ModuleNameIngredient::new(db, module_name);
@@ -136,7 +137,7 @@ pub(crate) struct SearchPaths {
136137
/// for the first `site-packages` path
137138
site_packages: Vec<SearchPath>,
138139

139-
typeshed_versions: ResolvedTypeshedVersions,
140+
typeshed_versions: TypeshedVersions,
140141
}
141142

142143
impl SearchPaths {
@@ -202,11 +203,11 @@ impl SearchPaths {
202203

203204
let search_path = SearchPath::custom_stdlib(db, &custom_typeshed)?;
204205

205-
(ResolvedTypeshedVersions::Custom(parsed), search_path)
206+
(parsed, search_path)
206207
} else {
207208
tracing::debug!("Using vendored stdlib");
208209
(
209-
ResolvedTypeshedVersions::Vendored(vendored_typeshed_versions()),
210+
vendored_typeshed_versions(db),
210211
SearchPath::vendored_stdlib(),
211212
)
212213
};
@@ -279,23 +280,6 @@ impl SearchPaths {
279280
}
280281
}
281282

282-
#[derive(Debug, PartialEq, Eq)]
283-
enum ResolvedTypeshedVersions {
284-
Vendored(&'static TypeshedVersions),
285-
Custom(TypeshedVersions),
286-
}
287-
288-
impl Deref for ResolvedTypeshedVersions {
289-
type Target = TypeshedVersions;
290-
291-
fn deref(&self) -> &Self::Target {
292-
match self {
293-
ResolvedTypeshedVersions::Vendored(versions) => versions,
294-
ResolvedTypeshedVersions::Custom(versions) => versions,
295-
}
296-
}
297-
}
298-
299283
/// Collect all dynamic search paths. For each `site-packages` path:
300284
/// - Collect that `site-packages` path
301285
/// - Collect any search paths listed in `.pth` files in that `site-packages` directory

0 commit comments

Comments
 (0)