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

Regression: pre-release fails to parse pyproject.toml with comments #6621

Closed
Enegg opened this issue Oct 31, 2024 · 4 comments
Closed

Regression: pre-release fails to parse pyproject.toml with comments #6621

Enegg opened this issue Oct 31, 2024 · 4 comments
Assignees
Labels
bug Something isn't working fixed in next version (release) A fix has been implemented and will appear in an upcoming version regression

Comments

@Enegg
Copy link

Enegg commented Oct 31, 2024

Environment data

  • Pylance version: v2024.10.103 (pre-release)
  • OS and version: Windows 11 Pro 22H2
  • Python version: 3.11.9.final.0

Code Snippet

This section begins at line 51, the inline comment is on line 53

[tool.ruff.lint]
select = [
    "I",     # isort
    "E",
    "F",
]

Expected behavior

Comments are allowed and should have no impact on parsing the file.

Actual behavior

Pre-release version of Pylance fails to parse the pyproject.toml file containing comments (separate and inline).
This does not happen in the current release version, v2024.10.1.

Logs

2024-10-31 19:54:23.923 [info] [Info  - 7:54:23 PM] (17312) Pylance language server 2024.10.103 (pyright version 1.1.386, commit 4180fa21) starting
2024-10-31 19:54:23.934 [info] [Info  - 7:54:23 PM] (17312) Starting service instance "project"
2024-10-31 19:54:24.034 [info] [Info  - 7:54:24 PM] (17312) Loading pyproject.toml file at c:\Code\project\pyproject.toml
2024-10-31 19:54:24.039 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 1 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.040 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 2 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.041 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 3 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.042 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 4 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.043 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 5 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.044 [info] [Error - 7:54:24 PM] (17312) Pyproject file parse attempt 6 error: {"name":"TomlError","fromTOML":true,"wrapped":null,"line":52,"col":20,"pos":1326}
2024-10-31 19:54:24.045 [info] [Error - 7:54:24 PM] (17312) Config file "c:\Code\project\pyproject.toml" could not be parsed. Verify that format is correct.
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 31, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Oct 31, 2024

This is likely the change from Pyright that Eric made here:
microsoft/pyright#9326

@rchiodo
Copy link
Contributor

rchiodo commented Oct 31, 2024

According to https://www.npmjs.com/package/js-toml it's supposed to support comments (which are supposed to be # AFAICT) but it doesn't seem to work.

@erictraut could we switch to this one instead?
https://www.npmjs.com/package/smol-toml

@rchiodo
Copy link
Contributor

rchiodo commented Oct 31, 2024

Oh sorry, we don't actually have that fix yet. We need to update the Pyright in Pylance to 1.1.387. Eric actually fixed this exact problem in 1.1.387

@debonte debonte added bug Something isn't working regression and removed needs repro Issue has not been reproduced yet labels Oct 31, 2024
@debonte debonte assigned rchiodo and unassigned StellaHuang95 Oct 31, 2024
@bschnurr bschnurr added the fixed in next version (release) A fix has been implemented and will appear in an upcoming version label Oct 31, 2024
@debonte
Copy link
Contributor

debonte commented Oct 31, 2024

This issue has been fixed in prerelease version 2024.10.104, which we've just released. You can find the changelog here: CHANGELOG.md

@debonte debonte closed this as completed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (release) A fix has been implemented and will appear in an upcoming version regression
Projects
None yet
Development

No branches or pull requests

5 participants