A composable scraper pipeline built around the medallion architecture (bronze / silver / gold).
Project description
Medallion architecture scraper pipeline
Plug and play library with batteries included for caching parser output at each step as blobs.
Installation
pip install medallion-pipeline
The distribution is published as medallion-pipeline, but the Python import name is medallion:
from medallion import Extractor, TransformerSingle, TransformerMultiple
Users define scraper scripts in Python, implementing an interface as specified below.
The tool can be executed like:
medallion PDFExtractor NaivePDFTransformer
Given an __init__.py file either at the root of the current directory or in any folder that the environment variable MEDALLION_ROOT points to.
Example __init__.py:
from .extractors import PDFExtractor
from .transformers import NaivePDFTransformer
The interfaces a user must implement
The class first in the pipeline must inherit from Extractor. All subsequent classes must inherit from either TransformerSingle or TransformerMultiple.
Extractors have no input type, they obtain data from some source, like a webserver or a file drive. Transformers have an input type that matches the output type of the previous processing step (which can be either Transformer or Extractor).
All of the types are user defined. ConfigType can be used to inject runtime configuration, s.a. a set of urls to visit, or any other custom user-based field.
class ProcessingStep:
def __init__(
self,
config: ConfigType|None=None,
):
self._config=config
class TransformerSingle(ABC, ProcessingStep):
def transform_single(
item: InputType,
) -> OutputType:
pass
class TransformerMultiple(ABC, ProcessingStep):
def transform_multiple(
items: list[InputType],
) -> list[OutputType]:
pass
class Extractor(ABC, ProcessingStep):
def extract(self,
) -> list[OutputType]:
pass
Developer notes
User-facing example pipelines live in /example/__init__.py. To execute them via the Run User Pipeline (example) launch configuration (or directly from the CLI), the MEDALLION_ROOT environment variable must be set to that folder so the resolver can locate the user package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file medallion_pipeline-0.1.2.tar.gz.
File metadata
- Download URL: medallion_pipeline-0.1.2.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84a707e90560e6066b10ba6e324b8e3d0ec1a2c59c1c2173e93ee08415be4505
|
|
| MD5 |
61a4f4a7f0e099aaa3bb5be35e1aecfe
|
|
| BLAKE2b-256 |
c96de5b750d7a43904e8c2fcf4663d4dd149770359592363e2f5278a004b6974
|
Provenance
The following attestation bundles were made for medallion_pipeline-0.1.2.tar.gz:
Publisher:
release.yml on Mcklmo/medallion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
medallion_pipeline-0.1.2.tar.gz -
Subject digest:
84a707e90560e6066b10ba6e324b8e3d0ec1a2c59c1c2173e93ee08415be4505 - Sigstore transparency entry: 1508654945
- Sigstore integration time:
-
Permalink:
Mcklmo/medallion@c4497f31c2d04dca7967d5d5dd12761b9c2f0c3a -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Mcklmo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c4497f31c2d04dca7967d5d5dd12761b9c2f0c3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file medallion_pipeline-0.1.2-py3-none-any.whl.
File metadata
- Download URL: medallion_pipeline-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ee2148d32be5449b59e62e8e1864f6f1b5c220105c8b316e4ecee1957a0f16f
|
|
| MD5 |
7f5d643dd970f8630f326ba60e2dcc46
|
|
| BLAKE2b-256 |
d0494e956e9081c277e065f9f080a1223c6e46f4840c039936d2a837ef91c13c
|
Provenance
The following attestation bundles were made for medallion_pipeline-0.1.2-py3-none-any.whl:
Publisher:
release.yml on Mcklmo/medallion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
medallion_pipeline-0.1.2-py3-none-any.whl -
Subject digest:
5ee2148d32be5449b59e62e8e1864f6f1b5c220105c8b316e4ecee1957a0f16f - Sigstore transparency entry: 1508655005
- Sigstore integration time:
-
Permalink:
Mcklmo/medallion@c4497f31c2d04dca7967d5d5dd12761b9c2f0c3a -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Mcklmo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c4497f31c2d04dca7967d5d5dd12761b9c2f0c3a -
Trigger Event:
push
-
Statement type: