Skip to content

fix: fix build by adding ruff unsafe-fixes and other build fixes #229

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

Merged
merged 10 commits into from
Nov 12, 2023
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
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ markdown_extensions:
- pymdownx.superfences
- tables
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- toc:
permalink: true

Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test-qt = ["qtpy", "pytest-qt"]
# requirements to run the autogen script in hatch_build.py
require-runtime-dependencies = true
# pin ruff for builds because it changes often
dependencies = ["black", "ruff ==0.0.291", "xsdata[cli]>=23.6"]
dependencies = ["black", "ruff ==0.1.5", "xsdata[cli]>=23.6"]


# https://hatch.pypa.io/latest/config/metadata/
Expand Down Expand Up @@ -195,6 +195,13 @@ module = ['ome_types._autogenerated.ome_2016_06.structured_annotations']
# is incompatible with definition in base class "Sequence"
disable_error_code = "misc"

[[tool.mypy.overrides]]
module = ['ome_types._autogenerated.*']
# FIXME: this is because we use type hints from pydantic2 Field
# (via pydantic_compat ... cause that's what it forwards)
# but we *have* to use pydantic v1 syntax
disable_error_code = "call-arg"

# https://coverage.readthedocs.io/en/6.4/config.html
[tool.coverage.report]
exclude_lines = [
Expand Down
2 changes: 1 addition & 1 deletion src/ome_autogen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def build_model(
def _fix_formatting(package_dir: str, ruff_ignore: list[str] = RUFF_IGNORE) -> None:
_print_gray("Running black and ruff ...")

ruff = ["ruff", "-q", "--fix", package_dir]
ruff = ["ruff", "-q", "--fix", "--unsafe-fixes", package_dir]
ruff.extend(f"--ignore={ignore}" for ignore in ruff_ignore)
subprocess.check_call(ruff) # noqa S

Expand Down
1 change: 1 addition & 0 deletions src/xsdata_pydantic_basemodel/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def move_restrictions_to_pydantic_field(
# The choice to use v1 syntax for cross-compatible mode has to do with
# https://docs.pydantic.dev/usage/schema/#unenforced-field-constraints
# There were more fields in v1 than in v2, so "min_length" is degenerate in v2
# NOTE: ... this might be fixed by using pydantic_compat?
if self.pydantic_support == "v2":
use_v2 = True
elif self.pydantic_support == "auto":
Expand Down