Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit 3db2ff6

Browse files
Dev (#40)
- Migrate to using [rye](https://rye.astral.sh/) - Rename `SearchResult` to `GenericComic` - Minor tidyups
1 parent d268ca4 commit 3db2ff6

28 files changed

Lines changed: 688 additions & 334 deletions

.github/dependabot.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
3+
- package-ecosystem: github-actions
44
directory: /
55
schedule:
66
interval: daily
7-
- package-ecosystem: github-actions
7+
groups:
8+
github_actions:
9+
patterns:
10+
- "*"
11+
12+
- package-ecosystem: pip
813
directory: /
914
schedule:
1015
interval: daily
16+
groups:
17+
python:
18+
patterns:
19+
- "*"

.github/workflows/testing.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
python-version:
25-
- 3.8
26-
- 3.9
25+
- '3.8'
26+
- '3.9'
2727
- '3.10'
2828
- '3.11'
2929
- '3.12'

.pre-commit-config.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.0.292
3+
rev: v0.5.0
44
hooks:
5+
- id: ruff-format
56
- id: ruff
67
- repo: https://github.com/executablebooks/mdformat
78
rev: 0.7.17
@@ -14,7 +15,7 @@ repos:
1415
- --number
1516
- --wrap=keep
1617
- repo: https://github.com/pre-commit/pre-commit-hooks
17-
rev: v4.5.0
18+
rev: v4.6.0
1819
hooks:
1920
- id: check-ast
2021
- id: check-builtin-literals
@@ -38,10 +39,6 @@ repos:
3839
- id: trailing-whitespace
3940
args:
4041
- --markdown-linebreak-ext=md
41-
- repo: https://github.com/psf/black
42-
rev: 23.9.1
43-
hooks:
44-
- id: black
4542
- repo: https://github.com/pappasam/toml-sort
4643
rev: v0.23.1
4744
hooks:

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-22.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212

1313
mkdocs:
1414
configuration: mkdocs.yaml
File renamed without changes.

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
[![PyPI - Version](https://img.shields.io/pypi/v/Himon.svg?logo=Python&label=Version&style=flat-square)](https://pypi.python.org/pypi/Himon/)
66
[![PyPI - License](https://img.shields.io/pypi/l/Himon.svg?logo=Python&label=License&style=flat-square)](https://opensource.org/licenses/GPL-3.0)
77

8-
[![Hatch](https://img.shields.io/badge/Packaging-Hatch-4051b5?style=flat-square)](https://github.com/pypa/hatch)
9-
[![Pre-Commit](https://img.shields.io/badge/Pre--Commit-Enabled-informational?style=flat-square&logo=pre-commit)](https://github.com/pre-commit/pre-commit)
10-
[![Black](https://img.shields.io/badge/Code--Style-Black-000000?style=flat-square)](https://github.com/psf/black)
11-
[![Ruff](https://img.shields.io/badge/Linter-Ruff-informational?style=flat-square)](https://github.com/charliermarsh/ruff)
8+
[![Rye](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/rye/main/artwork/badge.json)](https://rye.astral.sh)
9+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
10+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1211

1312
[![Github - Contributors](https://img.shields.io/github/contributors/Buried-In-Code/Himon.svg?logo=Github&label=Contributors&style=flat-square)](https://github.com/Buried-In-Code/Himon/graphs/contributors)
1413
[![Github Action - Testing](https://img.shields.io/github/actions/workflow/status/Buried-In-Code/Himon/testing.yaml?branch=main&logo=Github&label=Testing&style=flat-square)](https://github.com/Buried-In-Code/Himon/actions/workflows/testing.yaml)
@@ -37,33 +36,25 @@ session = LeagueofComicGeeks(client_id="Client Id", client_secret="Client Secret
3736

3837
# Generate an access token if not supplied
3938
if not session.access_token:
40-
session.access_token = session.generate_access_token()
39+
session.access_token = session.generate_access_token()
4140

4241
# Search for Comic
43-
for search in session.search(search_term="Blackest Night"):
44-
print(f"Search result: {search.publisher_name} - {search.series_name} - {search.title}")
42+
for result in session.search(search_term="Blackest Night"):
43+
print(f"Result: {result.publisher_name} - {result.series_name} - {result.title}")
4544

4645
# Get Series by id
47-
series = session.series(series_id=100096)
48-
print(f"Series: {series.series_id} - {series.title}")
46+
series = session.get_series(series_id=100096)
47+
print(f"Series: {series.id} - {series.title}")
4948

5049
# Get Comic by id
51-
comic = session.comic(comic_id=2710631)
52-
print(f"Comic: {comic.comic_id} - {comic.title}")
50+
comic = session.get_comic(comic_id=2710631)
51+
print(f"Comic: {comic.id} - {comic.title}")
5352
```
5453

5554
## Bugs/Requests
5655

5756
Please use the [GitHub issue tracker](https://github.com/Buried-In-Code/Himon/issues) to submit bugs or request features.
5857

59-
## Notes
60-
61-
Who or what is Himon?
62-
63-
> Himon is a citizen of New Genesis who secretly lives on the planet Apokolips, which is ruled by Darkseid.
64-
>
65-
> More details at [Himon (New Earth)](<https://dc.fandom.com/wiki/Himon_(New_Earth)>)
66-
6758
## Socials
6859

6960
[![Social - Matrix](https://img.shields.io/matrix/The-Dev-Environment:matrix.org?label=The%20Dev%20Environment&logo=matrix&style=for-the-badge)](https://matrix.to/#/#The-Dev-Environment:matrix.org)

docs/himon/schemas/generic.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generic
2+
3+
::: himon.schemas.generic.GenericComic
4+
::: himon.schemas.generic.GenericCover

docs/himon/schemas/search_result.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

himon/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""himon package entry file."""
2-
__version__ = "0.5.0"
2+
3+
__version__ = "0.6.0"
34
__all__ = ["__version__", "get_cache_root"]
45

56
import os

himon/league_of_comic_geeks.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
- LeagueofComicGeeks
66
"""
7+
78
from __future__ import annotations
89

910
__all__ = ["LeagueofComicGeeks"]
@@ -19,7 +20,7 @@
1920
from himon import __version__
2021
from himon.exceptions import AuthenticationError, ServiceError
2122
from himon.schemas.comic import Comic
22-
from himon.schemas.search_result import SearchResult
23+
from himon.schemas.generic import GenericComic
2324
from himon.schemas.series import Series
2425
from himon.sqlite_cache import SQLiteCache
2526

@@ -68,9 +69,7 @@ def __init__(
6869
@sleep_and_retry
6970
@limits(calls=20, period=MINUTE)
7071
def _perform_get_request(
71-
self: LeagueofComicGeeks,
72-
url: str,
73-
params: dict[str, str] | None = None,
72+
self: LeagueofComicGeeks, url: str, params: dict[str, str] | None = None
7473
) -> dict[str, Any]:
7574
"""Make GET request to League of Comic Geeks.
7675
@@ -153,9 +152,7 @@ def _get_request(
153152
@sleep_and_retry
154153
@limits(calls=20, period=MINUTE)
155154
def _str_get_request(
156-
self: LeagueofComicGeeks,
157-
endpoint: str,
158-
params: dict[str, str] | None = None,
155+
self: LeagueofComicGeeks, endpoint: str, params: dict[str, str] | None = None
159156
) -> str:
160157
"""Make GET request to League of Comic Geeks, expecting a str response.
161158
@@ -211,7 +208,7 @@ def generate_access_token(self: LeagueofComicGeeks) -> str:
211208
self.headers["X-API-KEY"] = self.client_secret
212209
return self._str_get_request("/authorize/format/json")
213210

214-
def search(self: LeagueofComicGeeks, search_term: str) -> list[SearchResult]:
211+
def search(self: LeagueofComicGeeks, search_term: str) -> list[GenericComic]:
215212
"""Request a list of search results.
216213
217214
Args:
@@ -225,7 +222,7 @@ def search(self: LeagueofComicGeeks, search_term: str) -> list[SearchResult]:
225222
try:
226223
self.headers["X-API-KEY"] = self.access_token
227224
results = self._get_request("/search/format/json", params={"query": search_term})
228-
adapter = TypeAdapter(List[SearchResult])
225+
adapter = TypeAdapter(List[GenericComic])
229226
return adapter.validate_python(results)
230227
except ValidationError as err:
231228
raise ServiceError(err) from err
@@ -244,10 +241,7 @@ def get_series(self: LeagueofComicGeeks, series_id: int) -> Series:
244241
"""
245242
try:
246243
self.headers["X-API-KEY"] = self.access_token
247-
result = self._get_request(
248-
"/series/format/json",
249-
params={"series_id": str(series_id)},
250-
)
244+
result = self._get_request("/series/format/json", params={"series_id": str(series_id)})
251245
if "details" in result:
252246
result = result["details"]
253247
adapter = TypeAdapter(Series)
@@ -269,10 +263,7 @@ def get_comic(self: LeagueofComicGeeks, comic_id: int) -> Comic:
269263
"""
270264
try:
271265
self.headers["X-API-KEY"] = self.access_token
272-
result = self._get_request(
273-
"/comic/format/json",
274-
params={"comic_id": str(comic_id)},
275-
)
266+
result = self._get_request("/comic/format/json", params={"comic_id": str(comic_id)})
276267
adapter = TypeAdapter(Comic)
277268
return adapter.validate_python(result)
278269
except ValidationError as err:

0 commit comments

Comments
 (0)