Skip to main content

PySinger

Introduction

A Singer.io wrapper Python library (that's fully type-annotated :D) that makes using Singer taps and targets easy.

This wrapper creates temporary virtual environment for each tap and target, download the required dependency and executes them. After execution, all environments are torn down and cleaned up.

Requirements

  • Linux only (Windows in the future? :|)
  • Requires Python 3.7+.
  • PySinger has no dependencies, it uses only Python built-in libraries.

Installation

pip install pysinger

Usage

Using tap and target names

Use the tap/target names you would use to pip install them.

E.g. the tap would be "tap-exchangeratehost" if you'd used pip install tap-exchangeratehost to install it or target "singer-target-postgres" for pip install singer-target-postgres.

from pysinger import Singer

tap_config = {
    "base": "JPY",
    "start_date": "2022-01-01"
}

target_config = {
    "delimiter": "\t",
    "quotechar": "'",
    "destination_path": ""
}

singer = Singer(
    "tap-exchangeratehost",
    "target-csv",
    tap_config=tap_config,          # Optional
    target_config=target_config     # Optional
)

end_state = singer.run()

# Optionally you can save the state for future use
singer.save_state("/path/to/state.json")

Different executable name

By default PySinger executes tap/target by their name, but sometimes the executables are named differently.

For example singer-target-postgres uses a target-postgres as its executable. To run these:

...
singer = Singer(
    "tap-exchangeratehost",
    "singer-target-postgres",
    tap_config=tap_config,
    target_config=target_config
    target_kwargs={"target_exec": "target-postgres"}
)

# Similarly there's one for taps called 'tap_exec'
...

To know what the executable name is, see the individual tap/target repo and check their invocation name.

Summary:

  • tap/target name is from pip install tap_or_target
  • tap/target_exec is from virtualenv/tap_or_target/bin/tap_or_target_exec

Defining Tap or Target manually

You can also pass Tap or Target instances that were created manually

from pysinger import Tap, Target, Singer

tap = Tap("tap-exchangerates", config_path="/path/to/config.json")

target = Target(
    "pipelinewise-target-postgres",
    target_exec="target-postgres",
    config={"disable_collection": True}
    )

singer = Singer(tap=tap, target=target)
singer.run()

Metadata

Release files for pysinger 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysinger 0.0.3
File Size Uploaded
pysinger-0.0.3.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysinger 0.0.3
File Interpreter ABI Platform
pysinger-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / pysinger-0.0.3.tar.gz

Download URL pysinger-0.0.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0f6a69e098888f7ac93ea8fc5df9f8723b4b495256ed9eddb13a475a07471063
BLAKE2b-256 checksum
How to use checksums
534e62f5fe0d6add59017a6a09891dcce931d1360dd9033f13d792cf1460d128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

Release files / pysinger-0.0.3-py3-none-any.whl

Download URL pysinger-0.0.3-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ed0e1c00054efca81810170e5d6b8da01b5e79340457e089a01b2f8e93e08d5
BLAKE2b-256 checksum
How to use checksums
e01bb167e2e8d5467b8baf2ca9c121bf3eb5d4c38796cd7e3a1f191f695e0787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page