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

[pre-commit.ci] pre-commit autoupdate #243

Merged
merged 4 commits into from
Jan 3, 2024
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
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
Expand Down Expand Up @@ -37,44 +37,44 @@ repos:

# Linter for json, yaml, md, css and more
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: d2425a6
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [--autofix]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.261
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.1
hooks:
- id: black

- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.6
hooks:
- id: bandit
args: [-c, pyproject.toml, -ll]
additional_dependencies: ["bandit[toml]"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.8.0
hooks:
- id: mypy
files: ^vizro-core/src/
additional_dependencies:
- pydantic>=1.10.13, <2 # deliberately pinned to <2 until we bump our pydantic requirement to strictly >=2

- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.4
rev: v8.18.1
hooks:
- id: gitleaks
name: gitleaks (protect)
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ target-version = "py38"
known-first-party = ["vizro"]

[tool.ruff.per-file-ignores]
# Ignore current false positives for pydantic models subclassing across files
# See: https://github.com/astral-sh/ruff/issues/5243#issuecomment-1860776975
"**/models/**" = ["RUF012"]
# Tests can use magic values, assertions, and relative imports, ignore missing docstrings,
# compare to empty string
"**/tests/**" = ["PLR2004", "S101", "TID252", "D100", "D101", "D102", "D103", "PLC1901"]
"**/tests/**" = ["PLR2004", "S101", "TID252", "D100", "D101", "D102", "D103", "PLC1901", "RUF012"]
Comment on lines +71 to +76
Copy link
Contributor

@huong-li-nguyen huong-li-nguyen Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be aware of this ignores and check the issue comment to understand why it's ok to ignore for now. Ruff might fix this in the future (given that they already ignore this error for subclasses within the same file), so we can eventually remove it later.

# Ignore import violations in all __init__.py files
"__init__.py" = ["E402", "F401"]

Expand Down
2 changes: 1 addition & 1 deletion tools/check_package_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ def _check_no_dev_version(package_name, package_version):
package_version = attempted_package_version

with open(env_file, "a") as f:
f.write(f"NEW_RELEASE={str(new_release)}\n")
f.write(f"NEW_RELEASE={new_release!s}\n")
if new_release:
f.write(f"PACKAGE_NAME={package_name}\nPACKAGE_VERSION={package_version}\n")
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨

- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Changed

- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/models/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _is_discriminated_union(field):
new_annotation = _add_to_discriminated_union(field.outer_type_)
elif sub_field is not None and _is_discriminated_union(sub_field):
# Field is a list of discriminated union e.g. components: List[ComponentType].
new_annotation = List[_add_to_discriminated_union(sub_field.outer_type_)] # type: ignore[misc,index]
new_annotation = List[_add_to_discriminated_union(sub_field.outer_type_)] # type: ignore[misc]
else:
raise ValueError(
f"Field '{field_name}' must be a discriminated union or list of discriminated union type. "
Expand Down
6 changes: 3 additions & 3 deletions vizro-core/src/vizro/models/_components/_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ def _make_form_layout(self, component_container):
style={
"gridRowGap": self.layout.row_gap,
"gridColumnGap": self.layout.col_gap,
"gridTemplateColumns": f"repeat({len(self.layout.grid[0])}, minmax({self.layout.col_min_width}, 1fr))", # noqa: E501
"gridTemplateRows": f"repeat({len(self.layout.grid)}, minmax({self.layout.row_min_height}, 1fr))", # noqa: E501
"gridTemplateColumns": f"repeat({len(self.layout.grid[0])}, minmax({self.layout.col_min_width}, 1fr))",
"gridTemplateRows": f"repeat({len(self.layout.grid)}, minmax({self.layout.row_min_height}, 1fr))",
},
className="component_container_grid",
id=self.id,
)


if __name__ == "__main__":
from vizro.models import Layout # noqa: F811
from vizro.models import Layout

Form.update_forward_refs(Layout=Layout)

Expand Down
Loading