Skip to content
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

Replace webpub manifest parser with pydantic (PP-1367) #2163

Merged
merged 2 commits into from
Nov 20, 2024
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
8 changes: 1 addition & 7 deletions bin/opds2_import_monitor
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
#!/usr/bin/env python
"""Update the circulation manager server with new books from OPDS 2.0 import collections."""
from webpub_manifest_parser.opds2 import OPDS2FeedParserFactory

from palace.manager.core.opds2_import import (
OPDS2Importer,
OPDS2ImportMonitor,
RWPMManifestParser,
)
from palace.manager.core.opds2_import import OPDS2Importer, OPDS2ImportMonitor
from palace.manager.scripts.opds_import import OPDSImportScript

import_script = OPDSImportScript(
importer_class=OPDS2Importer,
monitor_class=OPDS2ImportMonitor,
protocol=OPDS2Importer.NAME,
parser=RWPMManifestParser(OPDS2FeedParserFactory()),
)

import_script.run()
4 changes: 0 additions & 4 deletions bin/opds2_odl_import_monitor
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
OPDS 2.x + ODL collections."""


from webpub_manifest_parser.odl import ODLFeedParserFactory

from palace.manager.api.odl.importer import (
OPDS2WithODLImporter,
OPDS2WithODLImportMonitor,
)
from palace.manager.core.opds2_import import RWPMManifestParser
from palace.manager.scripts.monitor import RunCollectionMonitorScript

RunCollectionMonitorScript(
OPDS2WithODLImportMonitor,
import_class=OPDS2WithODLImporter,
parser=RWPMManifestParser(ODLFeedParserFactory()),
).run()
4 changes: 0 additions & 4 deletions bin/opds2_odl_schema_validate
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
OPDS import collections."""


from webpub_manifest_parser.odl import ODLFeedParserFactory

from palace.manager.api.odl.importer import OPDS2WithODLImporter
from palace.manager.core.opds2_import import RWPMManifestParser
from palace.manager.core.opds_schema import OPDS2WithODLSchemaValidation
from palace.manager.scripts.monitor import RunCollectionMonitorScript

import_script = RunCollectionMonitorScript(
OPDS2WithODLSchemaValidation,
import_class=OPDS2WithODLImporter,
parser=RWPMManifestParser(ODLFeedParserFactory()),
)

import_script.run()
9 changes: 1 addition & 8 deletions bin/opds2_reaper_monitor
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ from collections.abc import Generator
from typing import Any, cast

from sqlalchemy.orm import raiseload
from webpub_manifest_parser.opds2 import OPDS2FeedParserFactory

from palace.manager.core.coverage import CoverageFailure
from palace.manager.core.metadata_layer import TimestampData
from palace.manager.core.opds2_import import (
OPDS2API,
OPDS2Importer,
OPDS2ImportMonitor,
RWPMManifestParser,
)
from palace.manager.core.opds2_import import OPDS2API, OPDS2Importer, OPDS2ImportMonitor
from palace.manager.scripts.input import CollectionInputScript
from palace.manager.sqlalchemy.model.collection import Collection
from palace.manager.sqlalchemy.model.edition import Edition
Expand All @@ -28,7 +22,6 @@ def main():
importer_class=OPDS2Importer,
monitor_class=OPDS2ReaperMonitor,
protocol=OPDS2Importer.NAME,
parser=RWPMManifestParser(OPDS2FeedParserFactory()),
)

reaper_script.run()
Expand Down
6 changes: 1 addition & 5 deletions bin/opds2_schema_validate
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
"""Update the circulation manager server with new books from
OPDS import collections."""


from webpub_manifest_parser.opds2 import OPDS2FeedParserFactory

from palace.manager.core.opds2_import import OPDS2Importer, RWPMManifestParser
from palace.manager.core.opds2_import import OPDS2Importer
from palace.manager.core.opds_schema import OPDS2SchemaValidation
from palace.manager.scripts.opds_import import OPDSImportScript

import_script = OPDSImportScript(
importer_class=OPDS2Importer,
monitor_class=OPDS2SchemaValidation,
protocol=OPDS2Importer.NAME,
parser=RWPMManifestParser(OPDS2FeedParserFactory()),
)

import_script.run()
75 changes: 1 addition & 74 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module = [
"palace.manager.api.opds_for_distributors",
"palace.manager.core.opds2_import",
"palace.manager.core.opds_import",
"palace.manager.core.opds_schema",
"palace.manager.core.selftest",
"palace.manager.feed.*",
"palace.manager.integration.*",
Expand Down Expand Up @@ -198,7 +199,6 @@ module = [
"unicodecsv",
"uwsgi",
"wcag_contrast_ratio",
"webpub_manifest_parser.*",
]

[tool.poetry]
Expand Down Expand Up @@ -243,7 +243,6 @@ multipledispatch = "^1.0"
nameparser = "^1.1" # nameparser is for author name manipulations
opensearch-dsl = "~1.0"
opensearch-py = "~1.1"
palace-webpub-manifest-parser = "^4.0.0"
pillow = "^11.0"
pycountry = "^24.6.1"
pycryptodome = "^3.18"
Expand Down
Loading