scrapyrus 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. scrapyrus-0.0.1/LICENSE.md +8 -0
  2. scrapyrus-0.0.1/PKG-INFO +114 -0
  3. scrapyrus-0.0.1/README.md +85 -0
  4. scrapyrus-0.0.1/pyproject.toml +68 -0
  5. scrapyrus-0.0.1/setup.cfg +4 -0
  6. scrapyrus-0.0.1/src/scrapyrus/__init__.py +21 -0
  7. scrapyrus-0.0.1/src/scrapyrus/__main__.py +510 -0
  8. scrapyrus-0.0.1/src/scrapyrus/idpdata.py +177 -0
  9. scrapyrus-0.0.1/src/scrapyrus/image_manifest.py +213 -0
  10. scrapyrus-0.0.1/src/scrapyrus/images.py +601 -0
  11. scrapyrus-0.0.1/src/scrapyrus/images_broken.txt +1110 -0
  12. scrapyrus-0.0.1/src/scrapyrus/ingestion.py +132 -0
  13. scrapyrus-0.0.1/src/scrapyrus/metadata/__init__.py +15 -0
  14. scrapyrus-0.0.1/src/scrapyrus/metadata/ancient_edition.py +191 -0
  15. scrapyrus-0.0.1/src/scrapyrus/metadata/base.py +95 -0
  16. scrapyrus-0.0.1/src/scrapyrus/metadata/keywords.py +151 -0
  17. scrapyrus-0.0.1/src/scrapyrus/metadata/origdate.py +201 -0
  18. scrapyrus-0.0.1/src/scrapyrus/metadata/origplace.py +195 -0
  19. scrapyrus-0.0.1/src/scrapyrus/metadata/papyri.py +207 -0
  20. scrapyrus-0.0.1/src/scrapyrus/metadata/principal_edition.py +201 -0
  21. scrapyrus-0.0.1/src/scrapyrus/metadata/xmlutils.py +56 -0
  22. scrapyrus-0.0.1/src/scrapyrus/saxon_xml.py +261 -0
  23. scrapyrus-0.0.1/src/scrapyrus/scrapers/__init__.py +50 -0
  24. scrapyrus-0.0.1/src/scrapyrus/scrapers/aphrodito.py +90 -0
  25. scrapyrus-0.0.1/src/scrapyrus/scrapers/berlpap.py +118 -0
  26. scrapyrus-0.0.1/src/scrapyrus/scrapers/bodleian.py +43 -0
  27. scrapyrus-0.0.1/src/scrapyrus/scrapers/british_museum.py +147 -0
  28. scrapyrus-0.0.1/src/scrapyrus/scrapers/cairo_museum.py +110 -0
  29. scrapyrus-0.0.1/src/scrapyrus/scrapers/doi.py +37 -0
  30. scrapyrus-0.0.1/src/scrapyrus/scrapers/egnet.py +136 -0
  31. scrapyrus-0.0.1/src/scrapyrus/scrapers/iiif.py +208 -0
  32. scrapyrus-0.0.1/src/scrapyrus/scrapers/louvre.py +89 -0
  33. scrapyrus-0.0.1/src/scrapyrus/scrapers/met_museum.py +116 -0
  34. scrapyrus-0.0.1/src/scrapyrus/scrapers/nakala.py +74 -0
  35. scrapyrus-0.0.1/src/scrapyrus/scrapers/onb.py +277 -0
  36. scrapyrus-0.0.1/src/scrapyrus/scrapers/oxford.py +194 -0
  37. scrapyrus-0.0.1/src/scrapyrus/scrapers/papyrus_portal.py +301 -0
  38. scrapyrus-0.0.1/src/scrapyrus/scrapers/psi_online.py +96 -0
  39. scrapyrus-0.0.1/src/scrapyrus/scrapers/ubhd.py +43 -0
  40. scrapyrus-0.0.1/src/scrapyrus/scrapers/uc_berkeley.py +120 -0
  41. scrapyrus-0.0.1/src/scrapyrus/scrapers/ucl.py +175 -0
  42. scrapyrus-0.0.1/src/scrapyrus/scrapers/umichigan.py +34 -0
  43. scrapyrus-0.0.1/src/scrapyrus/scrapers/uni_hamburg.py +36 -0
  44. scrapyrus-0.0.1/src/scrapyrus/scrapers/uni_koeln.py +110 -0
  45. scrapyrus-0.0.1/src/scrapyrus/scrapers/warsaw.py +65 -0
  46. scrapyrus-0.0.1/src/scrapyrus/scrapers/yale.py +51 -0
  47. scrapyrus-0.0.1/src/scrapyrus/transcriptions/__init__.py +65 -0
  48. scrapyrus-0.0.1/src/scrapyrus/transcriptions/core.py +369 -0
  49. scrapyrus-0.0.1/src/scrapyrus/transcriptions/embeddings.py +820 -0
  50. scrapyrus-0.0.1/src/scrapyrus/transcriptions/evaluation.py +696 -0
  51. scrapyrus-0.0.1/src/scrapyrus/transcriptions/lemmatization.py +134 -0
  52. scrapyrus-0.0.1/src/scrapyrus/transcriptions/llms.py +287 -0
  53. scrapyrus-0.0.1/src/scrapyrus/transcriptions/search.py +295 -0
  54. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/choices.xsl +50 -0
  55. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/editorial.xsl +20 -0
  56. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/epidoc-to-text.xsl +47 -0
  57. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/expansion.xsl +16 -0
  58. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/structure.xsl +41 -0
  59. scrapyrus-0.0.1/src/scrapyrus/transcriptions/xslt/translation-epidoc-to-text.xsl +75 -0
  60. scrapyrus-0.0.1/src/scrapyrus.egg-info/PKG-INFO +114 -0
  61. scrapyrus-0.0.1/src/scrapyrus.egg-info/SOURCES.txt +68 -0
  62. scrapyrus-0.0.1/src/scrapyrus.egg-info/dependency_links.txt +1 -0
  63. scrapyrus-0.0.1/src/scrapyrus.egg-info/entry_points.txt +2 -0
  64. scrapyrus-0.0.1/src/scrapyrus.egg-info/requires.txt +18 -0
  65. scrapyrus-0.0.1/src/scrapyrus.egg-info/top_level.txt +1 -0
  66. scrapyrus-0.0.1/tests/test_cli.py +672 -0
  67. scrapyrus-0.0.1/tests/test_idpdata.py +221 -0
  68. scrapyrus-0.0.1/tests/test_image_manifest.py +39 -0
  69. scrapyrus-0.0.1/tests/test_images.py +1025 -0
  70. scrapyrus-0.0.1/tests/test_ingestion.py +734 -0
@@ -0,0 +1,8 @@
1
+ Copyright 2026, The copyright holders according to COPYING.md
2
+
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: scrapyrus
3
+ Version: 0.0.1
4
+ Summary: Add short description here
5
+ Maintainer-email: Dominic Kempf <your@email.com>
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.13
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.md
12
+ Requires-Dist: beautifulsoup4
13
+ Requires-Dist: cltk[stanza]>=2.5.1
14
+ Requires-Dist: click
15
+ Requires-Dist: saxonche
16
+ Requires-Dist: pydantic>=2
17
+ Requires-Dist: psycopg[binary]>=3
18
+ Requires-Dist: requests
19
+ Requires-Dist: termgraph>=0.7.6
20
+ Requires-Dist: tqdm
21
+ Provides-Extra: tests
22
+ Requires-Dist: pytest; extra == "tests"
23
+ Requires-Dist: pytest-cov; extra == "tests"
24
+ Provides-Extra: docs
25
+ Requires-Dist: sphinx; extra == "docs"
26
+ Requires-Dist: sphinx_mdinclude; extra == "docs"
27
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
28
+ Dynamic: license-file
29
+
30
+ # Welcome to scrapyrus
31
+
32
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
33
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ssciwr/scrapyrus/ci.yml?branch=main)](https://github.com/ssciwr/scrapyrus/actions/workflows/ci.yml)
34
+ [![codecov](https://codecov.io/gh/ssciwr/scrapyrus/branch/main/graph/badge.svg)](https://codecov.io/gh/ssciwr/scrapyrus)
35
+
36
+ ## Installation
37
+
38
+ The Python package `scrapyrus` can be installed from PyPI:
39
+
40
+ ```
41
+ python -m pip install scrapyrus
42
+ ```
43
+
44
+ ## Development installation
45
+
46
+ If you want to contribute to the development of `scrapyrus`, we recommend
47
+ the following editable installation from this repository:
48
+
49
+ ```
50
+ git clone git@github.com:ssciwr/scrapyrus.git
51
+ cd scrapyrus
52
+ python -m pip install --editable .[tests]
53
+ ```
54
+
55
+ Having done so, the test suite can be run using `pytest`:
56
+
57
+ ```
58
+ python -m pytest
59
+ ```
60
+
61
+ ## Docker Compose
62
+
63
+ The repository includes a Docker Compose setup with PostgreSQL and a profiled
64
+ `scrapyrus` execution container. The PostgreSQL service uses a pgvector-enabled
65
+ image because `scrapyrus embeddings` commands require the `vector` extension:
66
+
67
+ ```
68
+ docker compose up -d postgres
69
+ ```
70
+
71
+ The `scrapyrus` container mounts this repository at `/workspace` and sets
72
+ `SCRAPYRUS_DATABASE_URL` to the PostgreSQL service. It also mounts the local
73
+ `./exchange` directory at `/exchange` for moving data between the host and the
74
+ container. Start it as a one-off shell when you need to run the CLI:
75
+
76
+ ```
77
+ docker compose run --build --rm scrapyrus bash
78
+ scrapyrus metadata ingest
79
+ scrapyrus transcriptions ingest
80
+ scrapyrus embeddings ingest \
81
+ --inference-server-url <url> --model-name <model> --api-key <key>
82
+ ```
83
+
84
+ Embedding ingestion reads the XML rows created by `transcriptions ingest`, so
85
+ both commands must target the same PostgreSQL database and must run in that
86
+ order.
87
+
88
+ The `scrapyrus` service is intentionally not started by the default `up`
89
+ command. Some Snap-packaged Docker installations fail to stop idle long-lived
90
+ containers during rebuilds with `cannot stop container: ... permission denied`;
91
+ using one-off `run --rm` containers avoids that host-side recreate path.
92
+
93
+ If `idp.data` is somewhere else inside the mounted workspace, pass it explicitly:
94
+
95
+ ```
96
+ scrapyrus --idp-data /workspace/idp.data metadata ingest
97
+ ```
98
+
99
+ To export the metadata database tables as CSV files:
100
+
101
+ ```
102
+ scrapyrus metadata dump
103
+ ```
104
+
105
+ If an older checkout already started the Compose stack with the stock PostgreSQL
106
+ image, recreate the database service after updating:
107
+
108
+ ```
109
+ docker compose up -d --force-recreate postgres
110
+ ```
111
+
112
+ ## Acknowledgments
113
+
114
+ This repository was set up using the [SSC Cookiecutter for Python Packages](https://github.com/ssciwr/cookiecutter-python-package).
@@ -0,0 +1,85 @@
1
+ # Welcome to scrapyrus
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ssciwr/scrapyrus/ci.yml?branch=main)](https://github.com/ssciwr/scrapyrus/actions/workflows/ci.yml)
5
+ [![codecov](https://codecov.io/gh/ssciwr/scrapyrus/branch/main/graph/badge.svg)](https://codecov.io/gh/ssciwr/scrapyrus)
6
+
7
+ ## Installation
8
+
9
+ The Python package `scrapyrus` can be installed from PyPI:
10
+
11
+ ```
12
+ python -m pip install scrapyrus
13
+ ```
14
+
15
+ ## Development installation
16
+
17
+ If you want to contribute to the development of `scrapyrus`, we recommend
18
+ the following editable installation from this repository:
19
+
20
+ ```
21
+ git clone git@github.com:ssciwr/scrapyrus.git
22
+ cd scrapyrus
23
+ python -m pip install --editable .[tests]
24
+ ```
25
+
26
+ Having done so, the test suite can be run using `pytest`:
27
+
28
+ ```
29
+ python -m pytest
30
+ ```
31
+
32
+ ## Docker Compose
33
+
34
+ The repository includes a Docker Compose setup with PostgreSQL and a profiled
35
+ `scrapyrus` execution container. The PostgreSQL service uses a pgvector-enabled
36
+ image because `scrapyrus embeddings` commands require the `vector` extension:
37
+
38
+ ```
39
+ docker compose up -d postgres
40
+ ```
41
+
42
+ The `scrapyrus` container mounts this repository at `/workspace` and sets
43
+ `SCRAPYRUS_DATABASE_URL` to the PostgreSQL service. It also mounts the local
44
+ `./exchange` directory at `/exchange` for moving data between the host and the
45
+ container. Start it as a one-off shell when you need to run the CLI:
46
+
47
+ ```
48
+ docker compose run --build --rm scrapyrus bash
49
+ scrapyrus metadata ingest
50
+ scrapyrus transcriptions ingest
51
+ scrapyrus embeddings ingest \
52
+ --inference-server-url <url> --model-name <model> --api-key <key>
53
+ ```
54
+
55
+ Embedding ingestion reads the XML rows created by `transcriptions ingest`, so
56
+ both commands must target the same PostgreSQL database and must run in that
57
+ order.
58
+
59
+ The `scrapyrus` service is intentionally not started by the default `up`
60
+ command. Some Snap-packaged Docker installations fail to stop idle long-lived
61
+ containers during rebuilds with `cannot stop container: ... permission denied`;
62
+ using one-off `run --rm` containers avoids that host-side recreate path.
63
+
64
+ If `idp.data` is somewhere else inside the mounted workspace, pass it explicitly:
65
+
66
+ ```
67
+ scrapyrus --idp-data /workspace/idp.data metadata ingest
68
+ ```
69
+
70
+ To export the metadata database tables as CSV files:
71
+
72
+ ```
73
+ scrapyrus metadata dump
74
+ ```
75
+
76
+ If an older checkout already started the Compose stack with the stock PostgreSQL
77
+ image, recreate the database service after updating:
78
+
79
+ ```
80
+ docker compose up -d --force-recreate postgres
81
+ ```
82
+
83
+ ## Acknowledgments
84
+
85
+ This repository was set up using the [SSC Cookiecutter for Python Packages](https://github.com/ssciwr/cookiecutter-python-package).
@@ -0,0 +1,68 @@
1
+ # This section describes the requirements of the build/installation
2
+ # process itself. Being able to do this was the original reason to
3
+ # introduce pyproject.toml
4
+ [build-system]
5
+ requires = [
6
+ "setuptools >=61",
7
+ ]
8
+ build-backend = "setuptools.build_meta"
9
+
10
+ # This section provides general project metadata that is used across
11
+ # a variety of build tools. Notably, the version specified here is the
12
+ # single source of truth for scrapyrus's version
13
+ [project]
14
+ name = "scrapyrus"
15
+ description = "Add short description here"
16
+ readme = "README.md"
17
+ maintainers = [
18
+ { name = "Dominic Kempf", email = "your@email.com" },
19
+ ]
20
+ version = "0.0.1"
21
+ requires-python = ">=3.13"
22
+ license-files = ["LICEN[CS]E*"]
23
+ license = "MIT"
24
+ classifiers = [
25
+ "Programming Language :: Python :: 3",
26
+ "Operating System :: OS Independent",
27
+ ]
28
+ dependencies = [
29
+ "beautifulsoup4",
30
+ "cltk[stanza] >=2.5.1",
31
+ "click",
32
+ "saxonche",
33
+ "pydantic >=2",
34
+ "psycopg[binary] >=3",
35
+ "requests",
36
+ "termgraph >=0.7.6",
37
+ "tqdm",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ tests = [
42
+ "pytest",
43
+ "pytest-cov",
44
+ ]
45
+ docs = [
46
+ "sphinx",
47
+ "sphinx_mdinclude",
48
+ "sphinx_rtd_theme",
49
+ ]
50
+
51
+ # Command line scripts installed as part of the installation
52
+ [project.scripts]
53
+ scrapyrus = "scrapyrus.__main__:main"
54
+
55
+ # The following section contains setuptools-specific configuration
56
+ # options. For a full reference of available options, check the overview
57
+ # at https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+
61
+ [tool.setuptools.package-data]
62
+ scrapyrus = ["images_broken.txt", "transcriptions/xslt/*.xsl"]
63
+
64
+ # The following is the configuration for the pytest test suite
65
+ [tool.pytest.ini_options]
66
+ testpaths = [
67
+ "tests",
68
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,21 @@
1
+ from importlib import metadata as importlib_metadata
2
+
3
+ from scrapyrus.metadata.base import catalog, table_summary
4
+ from scrapyrus.transcriptions.core import (
5
+ epidoc_xml_to_text,
6
+ translation_epidoc_xml_to_text,
7
+ )
8
+ from scrapyrus.transcriptions.search import BM25SearchHit, MetadataFilter, bm25_search
9
+
10
+ __version__ = importlib_metadata.version(__package__)
11
+
12
+ __all__ = [
13
+ "__version__",
14
+ "BM25SearchHit",
15
+ "MetadataFilter",
16
+ "bm25_search",
17
+ "catalog",
18
+ "epidoc_xml_to_text",
19
+ "table_summary",
20
+ "translation_epidoc_xml_to_text",
21
+ ]