Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: "Check out repository code"
uses: "actions/checkout@v5"
- name: "Setup environment"
run: "pip install ruff==0.11.0"
run: "pip install ruff==0.14.5"
- name: "Linting: ruff check"
run: "ruff check ."
- name: "Linting: ruff format"
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ cd docs && npm start

### Code Quality

- **Ruff**: Comprehensive linting and formatting (0.11.0)
- **Ruff**: Comprehensive linting and formatting (0.14.5)
- **mypy**: Type checking with strict configuration
- **yamllint**: YAML file validation
- **markdownlint**: Documentation consistency
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/ctl/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def export_schema(
schema_text = await client.schema.get_graphql_schema()

destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(schema_text)
destination.write_text(schema_text, encoding="utf-8")
console.print(f"[green]Schema exported to {destination}")


Expand Down
16 changes: 8 additions & 8 deletions infrahub_sdk/node/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def __init__(self, name: str, schema: AttributeSchemaAPI, data: Any | dict) -> N

self._read_only = ["updated_at", "is_inherited"]

self.id: str | None = data.get("id", None)
self.id: str | None = data.get("id")

self._value: Any | None = data.get("value", None)
self._value: Any | None = data.get("value")
self.value_has_been_mutated = False
self.is_default: bool | None = data.get("is_default", None)
self.is_from_profile: bool | None = data.get("is_from_profile", None)
self.is_default: bool | None = data.get("is_default")
self.is_from_profile: bool | None = data.get("is_from_profile")

if self._value:
value_mapper: dict[str, Callable] = {
Expand All @@ -50,11 +50,11 @@ def __init__(self, name: str, schema: AttributeSchemaAPI, data: Any | dict) -> N
mapper = value_mapper.get(schema.kind, lambda value: value)
self._value = mapper(data.get("value"))

self.is_inherited: bool | None = data.get("is_inherited", None)
self.updated_at: str | None = data.get("updated_at", None)
self.is_inherited: bool | None = data.get("is_inherited")
self.updated_at: str | None = data.get("updated_at")

self.is_visible: bool | None = data.get("is_visible", None)
self.is_protected: bool | None = data.get("is_protected", None)
self.is_visible: bool | None = data.get("is_visible")
self.is_protected: bool | None = data.get("is_protected")

self.source: NodeProperty | None = None
self.owner: NodeProperty | None = None
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/node/related_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, branch: str, schema: RelationshipSchemaAPI, data: Any | dict,
self._display_label = node_data.get("display_label", None)
self._typename = node_data.get("__typename", None)

self.updated_at: str | None = data.get("updated_at", data.get("_relation__updated_at", None))
self.updated_at: str | None = data.get("updated_at", data.get("_relation__updated_at"))

# FIXME, we won't need that once we are only supporting paginated results
if self._typename and self._typename.startswith("Related"):
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/pytest_plugin/items/jinja2_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def repr_failure(self, excinfo: ExceptionInfo, style: str | None = None) -> str:
class InfrahubJinja2TransformSmokeItem(InfrahubJinja2Item):
def runtest(self) -> None:
file_path: Path = self.session.infrahub_config_path.parent / self.resource_config.template_path # type: ignore[attr-defined]
self.get_jinja2_environment().parse(file_path.read_text(), filename=file_path.name)
self.get_jinja2_environment().parse(file_path.read_text(encoding="utf-8"), filename=file_path.name)


class InfrahubJinja2TransformUnitRenderItem(InfrahubJinja2Item):
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/transfer/importer/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async def update_optional_relationships(self) -> None:
await self.execute_batches([update_batch], "Adding optional relationships to nodes")

async def update_many_to_many_relationships(self, file: Path) -> None:
relationships = ujson.loads(file.read_text())
relationships = ujson.loads(file.read_text(encoding="utf-8"))
update_batch = await self.client.create_batch(return_exceptions=True)

for relationship in relationships:
Expand Down
2 changes: 1 addition & 1 deletion infrahub_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def write_to_file(path: Path, value: Any) -> bool:
raise FileExistsError(f"{path} is a directory")

to_write = str(value)
written = path.write_text(to_write)
written = path.write_text(to_write, encoding="utf-8")

return written is not None

Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ tests = [
lint = [
"yamllint",
"mypy==1.11.2",
"ruff==0.11.0",
"ruff==0.14.5",
"astroid>=3.1,<4.0",
]
types = [
Expand Down Expand Up @@ -246,8 +246,9 @@ max-complexity = 17
##################################################################################################
# Review and change the below later #
##################################################################################################
"ANN202", # Missing return type annotation for private function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ANN202", # Missing return type annotation for private function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ASYNC240", # Async functions should not use pathlib.Path methods, use trio.Path or anyio.path
]

"infrahub_sdk/client.py" = [
Expand Down
47 changes: 24 additions & 23 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.