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

fix(deducer): correct package directory resolution and METADATA parsing #330

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

jianzs
Copy link
Contributor

@jianzs jianzs commented Aug 9, 2024

This commit addresses two separate issues identified in the deducer:

  • The deducer incorrectly searched for distribution information within the stub type directory, which lacks the required dist info. The resolution has been updated to check for the presence of nonStubImportResult within the ImportResult. If present, it is now utilized to determine the correct package directory.
  • The parsing of the dist-info/METADATA file was flawed due to the possibility of encountering multiple Name lines. The parser has been adjusted to only consider lines that begin with Name: and are not preceded by any spaces.

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N
  • Y

2. What is the scope of this PR (e.g. component or file name):

  • Pyright Deducer

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

This commit addresses two separate issues identified in the deducer:
- The deducer incorrectly searched for distribution information within the stub type directory, which lacks the required dist info. The resolution has been updated to check for the presence of `nonStubImportResult` within the `ImportResult`. If present, it is now utilized to determine the correct package directory.
- The parsing of the `dist-info/METADATA` file was flawed due to the possibility of encountering multiple `Name` lines. The parser has been adjusted to only consider lines that begin with `Name:` and are not preceded by any spaces.
@jianzs jianzs added bug Something isn't working deducer Deducer labels Aug 9, 2024
Copy link

changeset-bot bot commented Aug 9, 2024

🦋 Changeset detected

Latest commit: d6b477c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@plutolang/pyright-deducer Patch
@plutolang/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jianzs jianzs merged commit f6b3536 into pluto-lang:main Aug 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deducer Deducer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant