Skip to content

Commit

Permalink
Pydantic v2 (#170)
Browse files Browse the repository at this point in the history
- Updated dependencies, notably pydantic v2
- Updated/simplified ruff rules
- Remove deprecated functions
  • Loading branch information
Buried-In-Code committed Aug 23, 2023
1 parent cbfd151 commit 642b252
Show file tree
Hide file tree
Showing 37 changed files with 577 additions and 1,291 deletions.
12 changes: 3 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.285
hooks:
- id: ruff
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
Expand Down Expand Up @@ -51,7 +45,7 @@ repos:
# - --autofix
# - --indent=2
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/pappasam/toml-sort
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ from simyan.sqlite_cache import SQLiteCache
session = Comicvine(api_key="Comicvine API Key", cache=SQLiteCache())

# Search for Publisher
results = session.publisher_list(params={"filter": "name:DC Comics"})
results = session.list_publishers(params={"filter": "name:DC Comics"})
for publisher in results:
print(f"{publisher.publisher_id} | {publisher.name} - {publisher.site_url}")

# Get details for a Volume
result = session.volume(volume_id=26266)
result = session.get_volume(volume_id=26266)
print(result.summary)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/simyan/schemas/generic_entries.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generic Entries

::: simyan.schemas.generic_entries.AlternativeImageEntry
::: simyan.schemas.generic_entries.AssociatedImage
::: simyan.schemas.generic_entries.CountEntry
::: simyan.schemas.generic_entries.CreatorEntry
::: simyan.schemas.generic_entries.GenericEntry
::: simyan.schemas.generic_entries.ImageEntry
::: simyan.schemas.generic_entries.Image
::: simyan.schemas.generic_entries.IssueEntry
81 changes: 15 additions & 66 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ classifiers = [
"Typing :: Typed"
]
dependencies = [
"pydantic >= 1.10.7",
"pydantic >= 2.2.1",
"ratelimit >= 2.2.1",
"requests >= 2.30.0"
"requests >= 2.31.0"
]
description = "A Python wrapper for the Comicvine API."
dynamic = ["version"]
Expand All @@ -41,17 +41,17 @@ requires-python = ">= 3.8"

[project.optional-dependencies]
dev = [
"pre-commit >= 2.21.0"
"pre-commit >= 3.3.3"
]
docs = [
"mkdocs >= 1.4.3",
"mkdocs-include-markdown-plugin >= 4.0.4",
"mkdocs-material >= 9.1.11",
"mkdocstrings[python] >= 0.21.2"
"mkdocs >= 1.5.2",
"mkdocs-include-markdown-plugin >= 6.0.0",
"mkdocs-material >= 9.2.1",
"mkdocstrings[python] >= 0.22.0"
]
test = [
"pytest >= 7.3.1",
"pytest-cov >= 4.0.0",
"pytest >= 7.4.0",
"pytest-cov >= 4.1.0",
"pytest-pretty >= 1.2.0"
]

Expand Down Expand Up @@ -81,65 +81,13 @@ addopts = ["--cov"]
fix = true
format = "grouped"
ignore = [
"A001",
"A003",
"ANN101",
"ANN102",
"ANN204",
"ANN206",
"ANN401",
"C901",
"D107",
"D212",
"RET504",
"SIM105"
"EXE",
"FBT",
"PLR2004"
]
line-length = 100
select = [
"A",
"ANN",
"ARG",
"B",
"BLE",
"C40",
"C90",
"COM",
"D",
"DJ",
"E",
"ERA",
"F",
"G",
"I",
"ICN",
"INP",
"ISC",
"N",
"NPY",
"PD",
"PGH",
"PIE",
"PLC",
"PLE",
"PLW",
"PT",
"PTH",
"PYI",
"Q",
"RET",
"RSE",
"RUF",
"S",
"SIM",
"SLF",
"T10",
"T20",
"TCH",
"TID",
"UP",
"W",
"YTT"
]
select = ["ALL"]
show-fixes = true
target-version = "py38"

Expand All @@ -157,9 +105,10 @@ combine-as-imports = true
max-complexity = 18

[tool.ruff.pep8-naming]
classmethod-decorators = ["classmethod", "pydantic.validator"]
classmethod-decorators = ["classmethod", "pydantic.field_validator"]

[tool.ruff.per-file-ignores]
"simyan/schemas/*.py" = ["FA100"]
"tests/test_*.py" = ["S101", "SLF001"]

[tool.ruff.pydocstyle]
Expand Down
5 changes: 2 additions & 3 deletions simyan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""simyan package entry file."""
__version__ = "1.0.0"
__version__ = "1.1.0"
__all__ = ["__version__", "get_cache_root"]

import os
from pathlib import Path


def get_cache_root() -> Path:
"""
Create and return the path to the cache for simyan, supports XDG_CACHE_HOME env.
"""Create and return the path to the cache for simyan, supports XDG_CACHE_HOME env.
Returns:
The path to the simyan cache folder.
Expand Down

0 comments on commit 642b252

Please sign in to comment.