astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.13k stars 1.07k forks source link

Packages installed by uv fail resolving to a module #13011

Open MichaReiser opened 2 months ago

MichaReiser commented 2 months ago

I used black to test this:

2024-08-20 16:59:18.065251480 DEBUG Searching for workspace in '/home/micha/astral/black'
2024-08-20 16:59:18.065424219 DEBUG Attempting to parse virtual environment metadata at /home/micha/astral/black/.venv/pyvenv.cfg
2024-08-20 16:59:18.065507259 DEBUG Searching for site-packages directory in `sys.prefix` path /home/micha/astral/black/.venv
2024-08-20 16:59:18.065548759 DEBUG Resolved site-packages directories for this virtual environment are: ["/home/micha/astral/black/.venv/lib/python3.12/site-packages"]
2024-08-20 16:59:18.065812788 INFO Target version: 3.8
2024-08-20 16:59:18.065858488 DEBUG Adding static search path '/home/micha/astral/black'
2024-08-20 16:59:18.065932048 DEBUG Adding site-package path '/home/micha/astral/black/.venv/lib/python3.12/site-packages'
2024-08-20 16:59:18.066177617 DEBUG Starting main loop
2024-08-20 16:59:18.067171654 DEBUG Waiting for next main loop message.
2024-08-20 16:59:18.067282073 DEBUG Checking workspace
2024-08-20 16:59:18.067466473 DEBUG Checking package /home/micha/astral/black
2024-08-20 16:59:18.079524922 INFO Indexed 277 files for package 'black'
2024-08-20 16:59:18.079658642 DEBUG Checking file /home/micha/astral/black/src/black/lines.py
2024-08-20 16:59:18.094895321 DEBUG Resolved module 'itertools' to 'vendored://stdlib/itertools.pyi'.
2024-08-20 16:59:18.095079480 DEBUG Resolved module 'math' to 'vendored://stdlib/math.pyi'.
2024-08-20 16:59:18.095239220 DEBUG Resolved module 'dataclasses' to 'vendored://stdlib/dataclasses.pyi'.
2024-08-20 16:59:18.100269214 DEBUG Resolved module 'typing' to 'vendored://stdlib/typing.pyi'.
2024-08-20 16:59:18.120247046 DEBUG Resolved module 'builtins' to 'vendored://stdlib/builtins.pyi'.
2024-08-20 16:59:18.173641168 DEBUG Resolved module 'collections.abc' to 'vendored://stdlib/collections/abc.pyi'.
2024-08-20 16:59:18.176923056 DEBUG Resolving dynamic module resolution paths
2024-08-20 16:59:18.177091826 DEBUG Adding editable installation to module resolution path /home/micha/astral/black/src
2024-08-20 16:59:18.177234815 DEBUG Resolved module 'black.brackets' to '/home/micha/astral/black/src/black/brackets.py'.
2024-08-20 16:59:18.181370692 DEBUG Resolved module 'black.mode' to '/home/micha/astral/black/src/black/mode.py'.
2024-08-20 16:59:18.184211353 DEBUG Resolved module 'enum' to 'vendored://stdlib/enum.pyi'.
2024-08-20 16:59:18.190560312 DEBUG Resolved module 'black.nodes' to '/home/micha/astral/black/src/black/nodes.py'.
2024-08-20 16:59:18.201385585 DEBUG Resolved module 'blib2to3.pgen2' to '/home/micha/astral/black/src/blib2to3/pgen2/__init__.py'.
2024-08-20 16:59:18.203056430 DEBUG Resolved module 'blib2to3' to '/home/micha/astral/black/src/blib2to3/__init__.py'.
2024-08-20 16:59:18.203674348 DEBUG Resolved module 'blib2to3.pytree' to '/home/micha/astral/black/src/blib2to3/pytree.py'.
2024-08-20 16:59:18.216170146 DEBUG Resolved module 'black.strings' to '/home/micha/astral/black/src/black/strings.py'.
2024-08-20 16:59:18.243074876 DEBUG Resolved module '_typeshed' to 'vendored://stdlib/_typeshed/__init__.pyi'.
2024-08-20 16:59:18.251812406 DEBUG Resolved module 'types' to 'vendored://stdlib/types.pyi'.
2024-08-20 16:59:18.264188346 DEBUG Resolved module 'typing_extensions' to 'vendored://stdlib/typing_extensions.pyi'.
2024-08-20 16:59:18.306658834 DEBUG Checking file /home/micha/astral/black/tests/data/cases/preview_hug_parens_with_braces_and_square_brackets_no_ll1.py
2024-08-20 16:59:18.310508060 DEBUG Checking file /home/micha/astral/black/tests/data/cases/bracketmatch.py
2024-08-20 16:59:18.312287704 DEBUG Checking file /home/micha/astral/black/profiling/dict_huge.py
2024-08-20 16:59:19.032030798 DEBUG Checking file /home/micha/astral/black/tests/data/jupyter/notebook_no_trailing_newline.ipynb
2024-08-20 16:59:19.033466554 DEBUG Checking file /home/micha/astral/black/tests/data/cases/linelength6.py
2024-08-20 16:59:19.033866562 DEBUG Checking file /home/micha/astral/black/tests/data/cases/prefer_rhs_split_reformatted.py
2024-08-20 16:59:19.034952929 DEBUG Checking file /home/micha/astral/black/profiling/mix_big.py
2024-08-20 16:59:19.161122956 DEBUG Checking file /home/micha/astral/black/tests/data/jupyter/notebook_empty_metadata.ipynb
2024-08-20 16:59:19.161707584 DEBUG Checking file /home/micha/astral/black/tests/data/cases/import_spacing.py
2024-08-20 16:59:19.162747351 DEBUG Resolved module 'logging' to 'vendored://stdlib/logging/__init__.pyi'.
2024-08-20 16:59:19.174090333 DEBUG Resolved module 'sys' to 'vendored://stdlib/sys/__init__.pyi'.
2024-08-20 16:59:19.174362742 DEBUG Resolved module 'tests.data.cases.import_spacing' to '/home/micha/astral/black/tests/data/cases/import_spacing.py'.
2024-08-20 16:59:19.174613431 DEBUG Module 'tests.data.cases.base_events' not found in the search paths.
2024-08-20 16:59:19.174865420 DEBUG Module 'tests.data.cases.coroutines' not found in the search paths.
2024-08-20 16:59:19.175107970 DEBUG Module 'tests.data.cases.events' not found in the search paths.
2024-08-20 16:59:19.175338769 DEBUG Module 'tests.data.cases.futures' not found in the search paths.
2024-08-20 16:59:19.175571188 DEBUG Module 'tests.data.cases.locks' not found in the search paths.
2024-08-20 16:59:19.175806187 DEBUG Module 'tests.data.cases.protocols' not found in the search paths.
2024-08-20 16:59:19.176023947 DEBUG Module 'tests.data.runners' not found in the search paths.
2024-08-20 16:59:19.176239326 DEBUG Module 'tests.data.queues' not found in the search paths.
2024-08-20 16:59:19.176461505 DEBUG Module 'tests.data.streams' not found in the search paths.
2024-08-20 16:59:19.176710424 DEBUG Module 'some_library' not found in the search paths.
2024-08-20 16:59:19.177577222 DEBUG Module 'name_of_a_company.extremely_long_project_name.component.ttypes' not found in the search paths.
2024-08-20 16:59:19.177748271 DEBUG Module 'name_of_a_company.extremely_long_project_name.extremely_long_component_name.ttypes' not found in the search paths.
2024-08-20 16:59:19.177969320 DEBUG Module 'tests.data.cases.a.b.c.subprocess' not found in the search paths.
2024-08-20 16:59:19.178175870 DEBUG Module 'tests.data.cases' not found in the search paths.
2024-08-20 16:59:19.181821398 DEBUG Checking file /home/micha/astral/black/tests/data/cases/remove_for_brackets.py
2024-08-20 16:59:19.183914501 DEBUG Checking file /home/micha/astral/black/tests/test_no_ipynb.py
2024-08-20 16:59:19.184656698 DEBUG Resolved module 'pathlib' to 'vendored://stdlib/pathlib.pyi'.
2024-08-20 16:59:19.184952697 DEBUG Resolved module 'pytest' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/pytest/__init__.py'.
2024-08-20 16:59:19.185164156 DEBUG Resolved module 'click.testing' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/testing.py'.
2024-08-20 16:59:19.190536508 DEBUG Resolved module 'black' to '/home/micha/astral/black/src/black/__init__.py'.
2024-08-20 16:59:19.206788334 DEBUG Resolved module 'black.handle_ipynb_magics' to '/home/micha/astral/black/src/black/handle_ipynb_magics.py'.
2024-08-20 16:59:19.210888981 DEBUG Resolved module 'functools' to 'vendored://stdlib/functools.pyi'.
2024-08-20 16:59:19.216441541 DEBUG Resolved module 'click' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py'.
2024-08-20 16:59:19.217243859 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.217386688 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.217605007 DEBUG Resolved module 'black.const' to '/home/micha/astral/black/src/black/const.py'.
2024-08-20 16:59:19.218122556 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.218245345 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.218363705 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.218460505 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.220783447 DEBUG Resolved module 're' to 'vendored://stdlib/re.pyi'.
2024-08-20 16:59:19.228374032 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.228716351 DEBUG Resolved module '_black_version' to '/home/micha/astral/black/src/_black_version.py'.
2024-08-20 16:59:19.236492925 DEBUG Resolved module 'os' to 'vendored://stdlib/os/__init__.pyi'.
2024-08-20 16:59:19.271307288 DEBUG Resolved module 'platform' to 'vendored://stdlib/platform.pyi'.
2024-08-20 16:59:19.273239241 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.273386701 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.273491920 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.273930889 DEBUG Failed to resolve file File { [salsa id]: Id(408), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/click/__init__.py"), permissions: Some(33188), revision: FileRevision(31776459385816825380651368099), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.275675123 DEBUG Resolved module 'tests.util' to '/home/micha/astral/black/tests/util.py'.
2024-08-20 16:59:19.281222065 DEBUG Resolved module '_pytest.mark' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/mark/__init__.py'.
2024-08-20 16:59:19.284353215 DEBUG Failed to resolve file File { [salsa id]: Id(458), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/mark/__init__.py"), permissions: Some(33188), revision: FileRevision(31805140660203790096836446635), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module
2024-08-20 16:59:19.286279339 DEBUG Checking file /home/micha/astral/black/tests/data/nested_gitignore_tests/x.py
2024-08-20 16:59:19.286519818 DEBUG Checking file /home/micha/astral/black/tests/data/cases/module_docstring_1.py
2024-08-20 16:59:19.287103536 DEBUG Checking file /home/micha/astral/black/tests/data/cases/no_blank_line_before_docstring.py
2024-08-20 16:59:19.288637880 DEBUG Checking file /home/micha/astral/black/tests/optional.py
2024-08-20 16:59:19.290911622 DEBUG Resolved module '_pytest.stash' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/stash.py'.
2024-08-20 16:59:19.292303628 DEBUG Module '_pytest.store' not found in the search paths.
2024-08-20 16:59:19.292823396 DEBUG Resolved module '_pytest.config' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py'.
2024-08-20 16:59:19.310887056 DEBUG Resolved module '_pytest.config.argparsing' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/config/argparsing.py'.
2024-08-20 16:59:19.317633624 DEBUG Resolved module '_pytest.mark.structures' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/mark/structures.py'.
2024-08-20 16:59:19.324712560 DEBUG Resolved module '_pytest.nodes' to '/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/nodes.py'.
2024-08-20 16:59:19.332191135 DEBUG Resolved module 'abc' to 'vendored://stdlib/abc.pyi'.
2024-08-20 16:59:19.339355691 DEBUG Checking file /home/micha/astral/black/tests/data/cases/pep_604.py
2024-08-20 16:59:19.340468787 DEBUG Checking file /home/micha/astral/black/tests/data/cases/pattern_matching_complex.py
thread '<unnamed>' panicked at crates/red_knot_python_semantic/src/types/infer.rs:143:25:
no entry found for key
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Rayon: detected unexpected panic; aborting
fish: Job 1, 'cargo run --bin red_knot -- --c…' terminated by signal SIGABRT (Abort)

We should also improve the tracing log

MichaReiser commented 2 months ago

I'm actually not sure if this is a bug. It's just something we should look into

AlexWaygood commented 2 months ago

I'm actually not sure if this is a bug. It's just something we should look into

These look suspicious to me:

2024-08-20 16:59:19.284353215 DEBUG Failed to resolve file File { [salsa id]: Id(458), path: System("/home/micha/astral/black/.venv/lib/python3.12/site-packages/_pytest/mark/init.py"), permissions: Some(33188), revision: FileRevision(31805140660203790096836446635), status: Exists, count: Count { ghost: PhantomData<fn(ruff_db::files::File)> } } to a module