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

vendored toml parser cannot handle inline comment following multiline string #1796

Closed
Jasha10 opened this issue Jul 29, 2021 · 2 comments
Closed

Comments

@Jasha10
Copy link

@Jasha10 Jasha10 commented Jul 29, 2021

My pyproject.toml file looks like this:

xyz = ''' pdq
''' # heres an inline comment after a multiline string

[tool.isort]
profile = "black"
multi_line_output = 3

It seems that isort is not able to handle this toml file. In particular, the use of an inline comment after a multi-line string makes isort incompatible with black. I assume that it is not parsing the toml file properly:

$ black . && isort .
reformatted dtcio.py
All done! ✨ 🍰 ✨
1 file reformatted.
Fixing /home/jasha10/tmp/dtcio.py
Skipped 1 files
$ black . && isort .
reformatted dtcio.py
All done! ✨ 🍰 ✨
1 file reformatted.
Fixing /home/jasha10/tmp/dtcio.py
Skipped 1 files

The problem goes away if I do one of the following:

  • remove the inline comment in the toml file
  • use a single-line string instead of a multi-line string
black version: 21.7b0
isort version: 5.9.2

Both inline comments and multi-line strings are officially supported by the toml spec.
The use of inline comments after a multi-line string is not explicitly mentioned in the toml spec :)

@timothycrosley
Copy link
Member

@timothycrosley timothycrosley commented Jul 29, 2021

A quick check shows that this is an issue with the upstream toml parsing library, and not specific to the vendored copy. I would raise an issue there: https://github.com/uiri/toml

However, it does look like most of the community has largely switched to tomli (including black) so it likely makes sense for isort to do the same. That will need to wait for the next minor release.

@timothycrosley
Copy link
Member

@timothycrosley timothycrosley commented Aug 3, 2021

isort develop has now switched over to tomli, and this will go live in isort 5.10.0

Thanks!

~Timothy

bors bot added a commit to ChrisRBe/PP-P2P-Parser that referenced this issue Nov 3, 2021
430: build(deps): bump isort from 5.9.3 to 5.10.0 r=ChrisRBe a=dependabot[bot]

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li><a href="https://github.com/PyCQA/isort/commit/488cdcac10d4775d9ac2b63401a9a024a43705cf"><code>488cdca</code></a> Fix formatting</li>
<li><a href="https://github.com/PyCQA/isort/commit/1f093f691038e35303eb326e5a82b7cfcd918753"><code>1f093f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1833">#1833</a> from chrisdecker1201/bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/3c5da48559a4052b47f170c1a3fe3cdd5bd928da"><code>3c5da48</code></a> use regex to mach file_skip</li>
<li><a href="https://github.com/PyCQA/isort/commit/4e3f64bf91b50c9d2923c60853e0701ab04f388f"><code>4e3f64b</code></a> fix linter</li>
<li><a href="https://github.com/PyCQA/isort/commit/ba81f1c933a11e3391af3ad89d6cf2b38dcdf4ee"><code>ba81f1c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1834">#1834</a> from pzelnip/patch-1</li>
<li><a href="https://github.com/PyCQA/isort/commit/b1c5d7b2768f6c575929a6d9d1c7c6731454f670"><code>b1c5d7b</code></a> Minor improvements to pre-commit.md</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mergify bot pushed a commit to awslabs/aws-lambda-powertools-python that referenced this issue Nov 17, 2021
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some time.

Note: if you make any changes to this PR yourself, they will take precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h3>5.10.1 November 8 2021</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a>: skip_file ignored when on the first docstring line</li>
</ul>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.1 November 8 2021</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a>: skip_file ignored when on the first docstring line</li>
</ul>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c5e8fa75dda5f764d20f66a215d71c21cfa198e1"><code>c5e8fa7</code></a> Fix membership check</li>
<li><a href="https://github.com/PyCQA/isort/commit/3ce9f8f77fddd5eeda4b890b87979bd5f1815af5"><code>3ce9f8f</code></a> Bump version to 5.10.1</li>
<li><a href="https://github.com/PyCQA/isort/commit/fa2de4761040a9fd82339fccc7cc42391eb082cf"><code>fa2de47</code></a> Mark <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a> as fixed</li>
<li><a href="https://github.com/PyCQA/isort/commit/ca084113ad381db3a9497bdabdf5c1de39706cb1"><code>ca08411</code></a> Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li><a href="https://github.com/PyCQA/isort/commit/dbd18429cf566e9554842c9322515237bd8efb49"><code>dbd1842</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1845">#1845</a> from PyCQA/revert-1833-bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/dcbf92fbaaf1a971e96746c47eb91e35e7badc07"><code>dcbf92f</code></a> Revert &quot;only skip real comments&quot;</li>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
qujingpengf added a commit to qujingpengf/ChrisRBe that referenced this issue Jan 22, 2022
430: build(deps): bump isort from 5.9.3 to 5.10.0 r=ChrisRBe a=dependabot[bot]

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li><a href="https://github.com/PyCQA/isort/commit/488cdcac10d4775d9ac2b63401a9a024a43705cf"><code>488cdca</code></a> Fix formatting</li>
<li><a href="https://github.com/PyCQA/isort/commit/1f093f691038e35303eb326e5a82b7cfcd918753"><code>1f093f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1833">#1833</a> from chrisdecker1201/bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/3c5da48559a4052b47f170c1a3fe3cdd5bd928da"><code>3c5da48</code></a> use regex to mach file_skip</li>
<li><a href="https://github.com/PyCQA/isort/commit/4e3f64bf91b50c9d2923c60853e0701ab04f388f"><code>4e3f64b</code></a> fix linter</li>
<li><a href="https://github.com/PyCQA/isort/commit/ba81f1c933a11e3391af3ad89d6cf2b38dcdf4ee"><code>ba81f1c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1834">#1834</a> from pzelnip/patch-1</li>
<li><a href="https://github.com/PyCQA/isort/commit/b1c5d7b2768f6c575929a6d9d1c7c6731454f670"><code>b1c5d7b</code></a> Minor improvements to pre-commit.md</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants