-
Notifications
You must be signed in to change notification settings - Fork 3
chore: enable isort #28
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
Changes from 3 commits
ec5f887
16d1c1b
8f397f7
aa63628
71c6570
8c779be
c32c15a
2ba4cec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,16 +10,16 @@ | |
| # Standard | ||
| from contextlib import contextmanager | ||
| from functools import lru_cache | ||
| import os | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks wrong.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. **ignore my previous comment, I see what you mean, import os is in the middle of the from imports; for some reason this does pass the isort --check-only command - will take a look
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typically, I've used imports like the following: from baz import bat
from foo import bar
# ^ alpha sort for all `from ...` imports
import asdf
import qwer
# ^ alpha sort for all `import ...` imports(but without the editorial comments in between)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gotcha- i found the issue: I got rid of that, then added force_alphabetical_sort_within_sections = true to sort each by alphabetical order |
||
| from pathlib import Path | ||
| from typing import Generator, Optional, Self | ||
| import os | ||
|
|
||
| # Third-Party | ||
| from pydantic import model_validator | ||
|
|
||
| # First-Party | ||
| from mcpgateway.config import Settings | ||
| from mcpgateway.config import get_settings as cf_get_settings | ||
| from mcpgateway.config import Settings | ||
|
|
||
| HOME_DIR_NAME = ".contextforge" | ||
| DEFAULT_HOME = Path.home() / HOME_DIR_NAME | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| # Third-Party | ||
| from cryptography.hazmat.backends import default_backend | ||
| from cryptography.hazmat.primitives import hashes | ||
| from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | ||
| from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is doing case-insensitive alphabetical sort. In other projects, I've used case-sensitive so all capitalized come first (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good, changed it to case sensitive (set case_sensitive = true in config) |
||
| from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC | ||
|
|
||
| # First-Party | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,14 +10,14 @@ | |
|
|
||
| # Standard | ||
| from datetime import datetime | ||
| import json | ||
| from pathlib import Path | ||
| from typing import Dict, List, Optional | ||
| import json | ||
|
|
||
| # Third-Party | ||
| from pydantic import BaseModel, Field, ValidationInfo, field_validator | ||
| from pydantic import BaseModel, Field, field_validator, ValidationInfo | ||
|
|
||
| # Local | ||
| # First-Party | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checked and cforge was set as a known first party in the isort config in the toml, I'll adjust it to known local package!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeesh, this is what I get for copying all this config from the upstream project rather than starting from scratch! |
||
| from cforge.config import get_settings | ||
|
|
||
| # Virtual default profile ID for local development | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,9 +171,8 @@ target-version = "py311" | |
|
|
||
| [tool.ruff.lint] | ||
| # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. | ||
| # Also "D1" for docstring present checks. | ||
| # TODO: Enable "I" for import sorting as a separate PR. | ||
| select = ["E3", "E4", "E7", "E9", "F", "D1"] | ||
| # Also "D1" for docstring present checks and "I" for import sorting. | ||
| select = ["E3", "E4", "E7", "E9", "F", "D1", "I"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not clear whether it's this change or the one above to enable the pre-commit hook that actually caused all the changes. I'm also concerned that Here's an example of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was the change to enable the isort pre-commit hook that caused these changes. i do see ruff's I is causing some sort of issue in the pre-hook.. just tried it again and it fails the black python reformatter and the isort formatting; I'll re-disable it |
||
| ignore = [] | ||
|
|
||
| # Allow fix for all enabled rules (when `--fix`) is provided. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,8 @@ | |
|
|
||
| # Standard | ||
| import json | ||
| import tempfile | ||
| from pathlib import Path | ||
| import tempfile | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, I think the isort settings must be a bit off from what I'm used to |
||
| from unittest.mock import patch | ||
|
|
||
| # Third-Party | ||
|
|
@@ -28,6 +28,8 @@ | |
| a2a_toggle, | ||
| a2a_update, | ||
| ) | ||
|
|
||
| # Local | ||
| from tests.conftest import patch_functions | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to remove the duplicate
# Third Partyheading