{"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-1689153446", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 1689153446, "node_id": "IC_kwDOBm6k_c5krm-m", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-08-23T02:06:35Z", "updated_at": "2023-08-23T02:06:35Z", "author_association": "OWNER", "body": "I just tried this again today by dropping this into `.isort.cfg`:\r\n```ini\r\n[settings]\r\nmulti_line_output=3\r\ninclude_trailing_comma=True\r\nforce_grid_wrap=0\r\nuse_parentheses=True\r\nline_length=88\r\nknown_first_party=datasette\r\n```\r\nAnd running this in the root of the project:\r\n```\r\nisort .\r\n```\r\nIt produced a huge diff, but when I ran the tests:\r\n```bash\r\npytest -n auto\r\n```\r\nThe tests all passed. I'll push a PR.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-1689154837", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 1689154837, "node_id": "IC_kwDOBm6k_c5krnUV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-08-23T02:08:33Z", "updated_at": "2023-08-23T02:08:50Z", "author_association": "OWNER", "body": "Browse this commit to see the result: https://github.com/simonw/datasette/tree/59a5d336bd4336bc53103922ada4bf726f4336c9", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-1689158712", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 1689158712, "node_id": "IC_kwDOBm6k_c5kroQ4", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-08-23T02:14:45Z", "updated_at": "2023-08-23T02:14:45Z", "author_association": "OWNER", "body": "Thinking about this again today. Posted about it on Discord: https://discord.com/channels/823971286308356157/823971286941302908/1143729300349132933\r\n\r\nI won't enforce it in a `pytest` test, I'll enforce it with a CI lint check that's also in the `Justfile` here instead:\r\n\r\nhttps://github.com/simonw/datasette/blob/17ec309e14f9c2e90035ba33f2f38ecc5afba2fa/Justfile#L19-L23", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-1689159200", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 1689159200, "node_id": "IC_kwDOBm6k_c5kroYg", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-08-23T02:15:36Z", "updated_at": "2023-08-23T02:15:36Z", "author_association": "OWNER", "body": "This could play havoc with unmerged PRs. I should merge any big ones (like the JavaScript plugins work) first.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-504696610", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 504696610, "node_id": "MDEyOklzc3VlQ29tbWVudDUwNDY5NjYxMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-06-22T20:36:57Z", "updated_at": "2019-06-22T20:36:57Z", "author_association": "OWNER", "body": "According to [the black documentation](https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=isort.cfg) the following config file is necessary to avoid isort and black getting into an edit war with each other:\r\n```\r\n[settings]\r\nmulti_line_output=3\r\ninclude_trailing_comma=True\r\nforce_grid_wrap=0\r\nuse_parentheses=True\r\nline_length=88\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-504696638", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 504696638, "node_id": "MDEyOklzc3VlQ29tbWVudDUwNDY5NjYzOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-06-22T20:37:25Z", "updated_at": "2019-06-22T20:38:42Z", "author_association": "OWNER", "body": "This test added do `test_black.py` seems to do the trick:\r\n```python\r\n@pytest.mark.parametrize(\"path\", code_root.glob(\"**/*.py\"))\r\ndef test_isort(path):\r\n # Have to capture stdout because isort uses print() directly\r\n stdout = sys.stdout\r\n sys.stdout = io.StringIO()\r\n result = isort.SortImports(path, check=True)\r\n assert (\r\n not result.incorrectly_sorted\r\n ), \"{} has incorrectly sorted imports, fix with 'isort -rc . && black .'\"\r\n sys.stdout = stdout\r\n```\r\nI'll rename `test_black.py` to `test_lint.py` to reflect that it now covers more forms of linting.\r\n\r\nAlso needed: add `move_to_front(items, \"test_isort\")` to `conftest.py`. And add `isort` to `extras_require` in `setup.py`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-504697187", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 504697187, "node_id": "MDEyOklzc3VlQ29tbWVudDUwNDY5NzE4Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-06-22T20:46:35Z", "updated_at": "2019-06-22T20:46:35Z", "author_association": "OWNER", "body": "I'm going to resist the temptation to do this until I've merged the `asgi` branch from #272 ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/516#issuecomment-504768147", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/516", "id": 504768147, "node_id": "MDEyOklzc3VlQ29tbWVudDUwNDc2ODE0Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-06-23T16:43:23Z", "updated_at": "2019-06-23T16:43:23Z", "author_association": "OWNER", "body": "The Starlette lint and test scripts do this, and also apply autoflake to remove any unnecessary imports: https://github.com/encode/starlette/tree/8c8cc2ec0a5cb834a9a15b871ae8b480503abb67/scripts", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459509126, "label": "Enforce import sort order with isort"}, "performed_via_github_app": null}