Add short description here
Project description
Welcome to scrapyrus
Installation
The Python package scrapyrus can be installed from PyPI:
python -m pip install scrapyrus
Development installation
If you want to contribute to the development of scrapyrus, we recommend
the following editable installation from this repository:
git clone git@github.com:ssciwr/scrapyrus.git
cd scrapyrus
uv sync --extra tests
The test suite uses generated corpus fixtures and does not require an
idp.data checkout. Run it through the worktree's environment:
.venv/bin/python -m pytest
PostgreSQL configuration
Database-backed scrapyrus commands use PostgreSQL's standard connection
defaults when no connection URL is supplied. To use a connection URL instead,
set SCRAPYRUS_DATABASE_URL once in the shell before running ingestion,
dumping, lemmatization, embedding, or evaluation commands:
export SCRAPYRUS_DATABASE_URL=postgresql://scrapyrus:secret@localhost:5432/scrapyrus
scrapyrus metadata ingest
scrapyrus transcriptions ingest
scrapyrus embeddings ingest \
--inference-server-url <url> --model-name <model> --api-key <key>
The database must already exist and be reachable. Embedding commands additionally
require the PostgreSQL vector extension. Embedding ingestion reads the XML rows
created by transcriptions ingest, so those commands must run in that order.
The --database-url option can override SCRAPYRUS_DATABASE_URL for a single
command. If neither is supplied, standard PostgreSQL parameters such as the
PGHOST, PGPORT, PGDATABASE, and PGUSER environment variables apply.
For local development, a pgvector-enabled PostgreSQL server can be started on port 5432 with Docker:
docker run --name scrapyrus-postgres \
--detach \
--publish 5432:5432 \
--env POSTGRES_DB=scrapyrus \
--env POSTGRES_USER=scrapyrus \
--env POSTGRES_PASSWORD=scrapyrus \
pgvector/pgvector:pg16
export SCRAPYRUS_DATABASE_URL=postgresql://scrapyrus:scrapyrus@localhost:5432/scrapyrus
scrapyrus metadata ingest
This container does not use persistent storage, so removing it also removes its
database data. Stop and remove it with docker stop scrapyrus-postgres followed
by docker rm scrapyrus-postgres.
Moving the database
The database can be moved to another PostgreSQL instance with the dump and
restore scripts. Set SCRAPYRUS_DATABASE_URL to the source for the dump, then
to the target for the restore:
SCRAPYRUS_DATABASE_URL=<source-url> scripts/postgres_dump.sh scrapyrus.dump
SCRAPYRUS_DATABASE_URL=<target-url> scripts/postgres_restore.sh scrapyrus.dump
The target database must already exist and be empty, and its server must have
the vector extension available. Source roles must also exist on the target;
otherwise, pass --no-owner to the restore script to make the target connection
user own the restored objects and omit source privileges. Keep the source
database until the restored database has been verified.
Depending on the setup, it might worth to run pg_restore inside the postgres Docker container:
docker exec -i papyri-prod-postgres-1 sh -c \
'pg_restore --verbose --clean --if-exists --no-owner \
--username="$POSTGRES_USER" --dbname="$POSTGRES_DB"' \
< scrapyrus.dump
Acknowledgments
This repository was set up using the SSC Cookiecutter for Python Packages.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file scrapyrus-0.1.1.tar.gz.
File metadata
- Download URL: scrapyrus-0.1.1.tar.gz
- Upload date:
- Size: 90.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52e7be43b657fa5966492c41f77bd51bcaa0d7590ccf7fa5e2f08e84cd7d4643
|
|
| MD5 |
aef911887c5246bf816144f710a2e7bb
|
|
| BLAKE2b-256 |
f677626517074cf287ad4eba52000d5a5b7ab8b68cf9e6690b31d1b316222024
|
Provenance
The following attestation bundles were made for scrapyrus-0.1.1.tar.gz:
Publisher:
pypi.yml on ssciwr/scrapyrus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scrapyrus-0.1.1.tar.gz -
Subject digest:
52e7be43b657fa5966492c41f77bd51bcaa0d7590ccf7fa5e2f08e84cd7d4643 - Sigstore transparency entry: 2205501323
- Sigstore integration time:
-
Permalink:
ssciwr/scrapyrus@ebd09cc3bff2b4893c9db702edbaa96436f6b557 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ssciwr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@ebd09cc3bff2b4893c9db702edbaa96436f6b557 -
Trigger Event:
workflow_dispatch
-
Statement type: