Skip to content

Commit 465a416

Browse files
Misc tasks (#20)
- Updated dependencies - Update badges - Tidy status messages - Sort Metron results by name then by volume
1 parent 4afd3a0 commit 465a416

7 files changed

Lines changed: 79 additions & 71 deletions

File tree

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.4.8
3+
rev: v0.5.1
44
hooks:
55
- id: ruff-format
66
- id: ruff
@@ -22,6 +22,8 @@ repos:
2222
- id: check-case-conflict
2323
- id: check-docstring-first
2424
- id: check-merge-conflict
25+
args:
26+
- --assume-in-merge
2527
- id: check-toml
2628
- id: check-yaml
2729
args:
@@ -30,9 +32,12 @@ repos:
3032
exclude_types:
3133
- json
3234
- xml
35+
- id: fix-byte-order-marker
36+
- id: forbid-submodules
3337
- id: mixed-line-ending
3438
args:
3539
- --fix=auto
40+
# - id: name-tests-test
3641
- id: trailing-whitespace
3742
args:
3843
- --markdown-linebreak-ext=md

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
[![PyPI - Version](https://img.shields.io/pypi/v/Perdoo.svg?logo=PyPI&label=Version&style=flat-square)](https://pypi.python.org/pypi/Perdoo/)
66
[![PyPI - License](https://img.shields.io/pypi/l/Perdoo.svg?logo=PyPI&label=License&style=flat-square)](https://opensource.org/licenses/MIT)
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/badge/Rye-informational?style=flat-square&logo=rye&labelColor=grey)](https://rye.astral.sh)
9+
[![Pre-Commit](https://img.shields.io/badge/Pre--Commit-informational?style=flat-square&logo=pre-commit&labelColor=grey)](https://github.com/pre-commit/pre-commit)
10+
[![Ruff](https://img.shields.io/badge/Ruff-informational?style=flat-square&logo=ruff&labelColor=grey)](https://github.com/astral-sh/ruff)
1211

1312
[![Github - Contributors](https://img.shields.io/github/contributors/ComicCorps/Perdoo.svg?logo=Github&label=Contributors&style=flat-square)](https://github.com/ComicCorps/Perdoo/graphs/contributors)
1413

@@ -115,5 +114,4 @@ Collection Root
115114

116115
## Socials
117116

118-
[![Social - Mastodon](https://img.shields.io/badge/%40ComicCorps-teal?label=Mastodon&logo=mastodon&style=for-the-badge)](https://mastodon.social/@ComicCorps)\
119-
[![Social - Matrix](https://img.shields.io/badge/%23ComicCorps-teal?label=Matrix&logo=matrix&style=for-the-badge)](https://matrix.to/#/#ComicCorps:matrix.org)
117+
[![Social - Matrix](https://img.shields.io/matrix/The-Dev-Environment:matrix.org?label=The-Dev-Environment&logo=matrix&style=for-the-badge)](https://matrix.to/#/#The-Dev-Environment:matrix.org)

perdoo/__main__.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,17 @@ def load_archives(
167167
path: Path, output: OutputFormat, force: bool = False
168168
) -> list[tuple[Path, BaseArchive, Details | None]]:
169169
archives = []
170-
with CONSOLE.status(f"Searching for {output} files"):
171-
for file in list_files(path, f".{output}"):
172-
archive = get_archive(path=file)
173-
LOGGER.debug("Reading %s", file.stem)
174-
meta, details = read_meta(archive=archive)
175-
if not meta or not details:
176-
archives.append((file, archive, details))
177-
continue
178-
difference = abs(date.today() - meta.date_)
179-
if force or meta.tool != Tool() or difference.days >= 28:
180-
archives.append((file, archive, details))
181-
continue
170+
for file in list_files(path, f".{output}"):
171+
archive = get_archive(path=file)
172+
LOGGER.debug("Reading %s", file.stem)
173+
meta, details = read_meta(archive=archive)
174+
if not meta or not details:
175+
archives.append((file, archive, details))
176+
continue
177+
difference = abs(date.today() - meta.date_)
178+
if force or meta.tool != Tool() or difference.days >= 28:
179+
archives.append((file, archive, details))
180+
continue
182181
return archives
183182

184183

@@ -304,15 +303,19 @@ def process_pages(
304303

305304
def start(settings: Settings, force: bool = False) -> None:
306305
LOGGER.info("Starting Perdoo")
307-
convert_collection(path=settings.collection_folder, output=settings.output.format)
308-
archives = load_archives(
309-
path=settings.collection_folder, output=settings.output.format, force=force
310-
)
306+
307+
with CONSOLE.status(f"Searching for non-{settings.output.format} files"):
308+
convert_collection(path=settings.collection_folder, output=settings.output.format)
309+
310+
with CONSOLE.status(f"Searching for {settings.output.format} files"):
311+
archives = load_archives(
312+
path=settings.collection_folder, output=settings.output.format, force=force
313+
)
311314

312315
for file, archive, details in archives:
313316
CONSOLE.rule(file.stem)
314317
LOGGER.info("Processing %s", file.stem)
315-
details = details or Details( # noqa: PLW2901
318+
details = details or Details(
316319
series=Identifications(search=Prompt.ask("Series title", console=CONSOLE)),
317320
issue=Identifications(),
318321
)

perdoo/services/metron.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def _get_series_id(self: Metron, title: str | None) -> int | None:
4646
title = title or Prompt.ask("Series title", console=CONSOLE)
4747
try:
4848
options = sorted(
49-
self.session.series_list(params={"name": title}), key=lambda x: x.display_name
49+
self.session.series_list(params={"name": title}),
50+
key=lambda x: (x.display_name, x.volume),
5051
)
5152
if not options:
5253
LOGGER.warning("Unable to find any Series with the title: '%s'", title)

pyproject.toml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ classifiers = [
2626
dependencies = [
2727
"esak >= 1.3.2",
2828
"eval-type-backport >= 0.2.0 ; python_version < \"3.10\"",
29-
"himon >= 0.5.0",
29+
"himon >= 0.6.1",
3030
"mokkari >= 3.1.0 ; python_version >= \"3.10\"",
3131
"mokkari@git+https://github.com/Buried-In-Code/mokkari ; python_version < \"3.10\"",
3232
"natsort >= 8.4.0",
33-
"pillow >= 10.3.0",
34-
"pydantic >= 2.7.3",
33+
"pillow >= 10.4.0",
34+
"pydantic >= 2.8.2",
3535
"rarfile >= 4.2",
3636
"rich >= 13.7.1",
37-
"simyan >= 1.2.1",
37+
"simyan >= 1.2.2",
3838
"tomli >= 2.0.1 ; python_version < \"3.11\"",
3939
"tomli-w >= 1.0.0",
4040
"xmltodict >= 0.13.0"
@@ -49,17 +49,16 @@ requires-python = ">= 3.8"
4949

5050
[project.optional-dependencies]
5151
cb7 = [
52-
"py7zr >= 0.21.0"
52+
"py7zr >= 0.21.1"
5353
]
5454

5555
[project.scripts]
5656
Perdoo = "perdoo.__main__:main"
5757

5858
[project.urls]
59-
Documentation = "https://github.com/ComicCorps/Perdoo#readme"
6059
Homepage = "https://pypi.org/project/Perdoo"
61-
Issues = "https://github.com/ComicCorps/Perdoo/issues"
62-
Source = "https://github.com/ComicCorps/Perdoo"
60+
Issues = "https://github.com/Buried-In-Code/Perdoo/issues"
61+
Source = "https://github.com/Buried-In-Code/Perdoo"
6362

6463
[tool.hatch.metadata]
6564
allow-direct-references = true
@@ -81,22 +80,21 @@ skip-magic-trailing-comma = true
8180

8281
[tool.ruff.lint]
8382
ignore = [
84-
"C90",
83+
"C901",
8584
"COM812",
8685
"D",
86+
"D107",
8787
"DTZ",
88-
"EM",
89-
"ERA001",
88+
"EM101",
89+
"EM102",
9090
"EXE",
9191
"FBT",
92-
"PLR0912",
93-
"PLR0915",
9492
"PLR2004",
93+
"PLW2901",
9594
"TCH",
9695
"TRY003",
9796
"TRY300"
9897
]
99-
ignore-init-module-imports = true
10098
select = ["ALL"]
10199

102100
[tool.ruff.lint.flake8-annotations]
@@ -117,7 +115,6 @@ split-on-trailing-comma = false
117115
classmethod-decorators = ["classmethod", "pydantic.field_validator"]
118116

119117
[tool.ruff.lint.per-file-ignores]
120-
"perdoo/models/_base.py" = ["PLW2901"]
121118

122119
[tool.ruff.lint.pydocstyle]
123120
convention = "google"

requirements-dev.lock

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
#
44
# last locked with the following flags:
55
# pre: false
6-
# features: ["cb7"]
7-
# all-features: false
6+
# features: []
7+
# all-features: true
88
# with-sources: false
99
# generate-hashes: false
10+
# universal: false
1011

1112
-e file:.
1213
annotated-types==0.7.0
1314
# via pydantic
1415
brotli==1.1.0
1516
# via py7zr
16-
certifi==2024.6.2
17+
certifi==2024.7.4
1718
# via requests
1819
cfgv==3.4.0
1920
# via pre-commit
@@ -24,54 +25,55 @@ distlib==0.3.8
2425
esak==1.3.2
2526
# via perdoo
2627
eval-type-backport==0.2.0
28+
# via himon
2729
# via mokkari
2830
# via perdoo
2931
# via simyan
30-
filelock==3.14.0
32+
filelock==3.15.4
3133
# via virtualenv
32-
himon==0.5.0
34+
himon==0.6.1
3335
# via perdoo
34-
identify==2.5.36
36+
identify==2.6.0
3537
# via pre-commit
3638
idna==3.7
3739
# via requests
3840
inflate64==1.0.0
3941
# via py7zr
4042
markdown-it-py==3.0.0
4143
# via rich
42-
marshmallow==3.21.2
44+
marshmallow==3.21.3
4345
# via esak
4446
mdurl==0.1.2
4547
# via markdown-it-py
46-
mokkari @ git+https://github.com/Buried-In-Code/mokkari@44658ea65af15a672f52bd8b9572ee43ce41238b
48+
mokkari @ git+https://github.com/Buried-In-Code/mokkari@e55697cb7eb0d52d206cd5df5af300752d86dd38
4749
# via perdoo
4850
multivolumefile==0.2.3
4951
# via py7zr
5052
natsort==8.4.0
5153
# via perdoo
5254
nodeenv==1.9.1
5355
# via pre-commit
54-
packaging==24.0
56+
packaging==24.1
5557
# via marshmallow
56-
pillow==10.3.0
58+
pillow==10.4.0
5759
# via perdoo
5860
platformdirs==4.2.2
5961
# via virtualenv
6062
pre-commit==3.5.0
61-
psutil==5.9.8
63+
psutil==6.0.0
6264
# via py7zr
63-
py7zr==0.21.0
65+
py7zr==0.21.1
6466
# via perdoo
6567
pybcj==1.0.2
6668
# via py7zr
6769
pycryptodomex==3.20.0
6870
# via py7zr
69-
pydantic==2.7.3
71+
pydantic==2.8.2
7072
# via himon
7173
# via mokkari
7274
# via perdoo
7375
# via simyan
74-
pydantic-core==2.18.4
76+
pydantic-core==2.20.1
7577
# via pydantic
7678
pygments==2.18.0
7779
# via rich
@@ -94,22 +96,22 @@ requests==2.32.3
9496
# via simyan
9597
rich==13.7.1
9698
# via perdoo
97-
simyan==1.2.1
99+
simyan==1.2.2
98100
# via perdoo
99101
texttable==1.7.0
100102
# via py7zr
101103
tomli==2.0.1
102104
# via perdoo
103105
tomli-w==1.0.0
104106
# via perdoo
105-
typing-extensions==4.12.1
107+
typing-extensions==4.12.2
106108
# via annotated-types
107109
# via pydantic
108110
# via pydantic-core
109111
# via rich
110-
urllib3==2.2.1
112+
urllib3==2.2.2
111113
# via requests
112-
virtualenv==20.26.2
114+
virtualenv==20.26.3
113115
# via pre-commit
114116
xmltodict==0.13.0
115117
# via perdoo

0 commit comments

Comments
 (0)