Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyright incorrectly resolving internal paths on files #8541

Closed
1 task done
creda-technologies opened this issue Feb 28, 2024 · 2 comments
Closed
1 task done

Pyright incorrectly resolving internal paths on files #8541

creda-technologies opened this issue Feb 28, 2024 · 2 comments
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors python Python programming language support stale Label used by `stale` action

Comments

@creda-technologies
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I'm currently using Zed to write a python package. However, I'm having some issues with getting PyRight to understand the internal structure of the package.

My package possesses the following file structure:

anchor_sdk
├── default_sep10_handler
│   ├── util
│   └── handler.py
├── sep_endpoints
│   ├── __init__.py
│   ├── sep10_endpoints.py
│   ├── sep12_endpoints.py
│   ├── sep1_endpoints.py
│   └── sep6_endpoints.py
├── sep_handlers
│   ├── __init__.py
│   ├── sep10_handler.py
│   ├── sep12_handler.py
│   ├── sep1_handler.py
│   └── sep6_handler.py
├── sep_serializations
│   ├── __init__.py
│   ├── common.py
│   ├── sep10_serializations.py
│   ├── sep12_serializations.py
│   ├── sep6_fields.py
│   └── sep9_fields.py
├── venv
├── .gitignore
├── __init__.py
├── exceptions.py
├── models.py
├── pyproject.toml
└── util.py

When running my web server, the following import statements are used (for example)

from anchor_sdk.exceptions import Sep9InvalidFieldResponded, Sep9InvalidType
from anchor_sdk import SEP9_FIELDS, SEP9_VERIFICATION_FIELDS

This correctly works internally when running or using anything from the package. However, pyright throws an issue:
import anchor_sdk could not be resolved (reportMissingImports) in the IDE. If I change the above snippet to:

from exceptions import Sep9InvalidFieldResponded, Sep9InvalidType
from . import SEP9_FIELDS, SEP9_VERIFICATION_FIELDS

The issue is then resolved in Pyright, however when running anything from the library causes the runtime error:

  File "/Users/amrithsrinivas/Projects/anchor-sdk/anchor_sdk/models.py", line 1, in <module>
    from exceptions import Sep9InvalidFieldResponded, Sep9InvalidType
ModuleNotFoundError: No module named 'exceptions'

How can I make it so pyright is able to either understand that anchor_sdk is a valid way to access the files, or make my python package able to read those references as valid file paths? I appreciate the help!

Environment

Zed: v0.123.6 (Zed)
OS: macOS 13.0.0
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

Screenshot 2024-02-28 at 11 39 02 AM

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

@creda-technologies creda-technologies added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Feb 28, 2024
@Moshyfawn Moshyfawn added python Python programming language support language server An umbrella label for all language servers and removed triage Maintainer needs to classify the issue labels Feb 28, 2024
@JosephTLyons JosephTLyons added language An umbrella label for all programming languages syntax behaviors and removed admin read Pending admin review labels Feb 29, 2024
Copy link

Hi there! 👋
We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed.
Thanks for your help!

@github-actions github-actions bot added the stale Label used by `stale` action label Sep 24, 2024
Copy link

github-actions bot commented Oct 8, 2024

This issue was closed due to inactivity; feel free to open a new issue if you're still experiencing this problem!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors python Python programming language support stale Label used by `stale` action
Projects
None yet
Development

No branches or pull requests

3 participants