Skip to content

Commit

Permalink
fix: Use Pydantic model_dump_json method instead of deprecated json
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 28, 2024
1 parent cba9d3e commit a0c2a39
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ on:
workflow_dispatch:
inputs: {}

env:
FORCE_COLOR: 1

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions meltano/edk/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ def describe_formatted( # type: ignore[return]
if output_format == DescribeFormat.text:
return pformat(self.describe())
elif output_format == DescribeFormat.json:
return self.describe().json(indent=2)
return self.describe().model_dump_json(indent=2)
elif output_format == DescribeFormat.yaml:
# just calling describe().dict() and dumping that to yaml yields a yaml that
# is subtly different to the json variant in that it you have an additional
# level of nesting.
return yaml.dump(
yaml.safe_load(self.describe().json()), sort_keys=False, indent=2
yaml.safe_load(self.describe().model_dump_json()),
sort_keys=False,
indent=2,
)

def pass_through_invoker(
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ typer = ">=0.6.1,<0.16.0"
target-version = "py38"

[tool.ruff.lint]
ignore = [
"ANN101",
]
select = [
"E",
"F",
Expand All @@ -87,6 +84,9 @@ select = [
"ANN",
"D",
"UP",
"SIM",
"PERF",
"FURB",
]

[tool.ruff.lint.flake8-annotations]
Expand Down

0 comments on commit a0c2a39

Please sign in to comment.