Metadata-Version: 2.4
Name: hotglue-singer-sdk
Version: 1.0.9
Summary: A framework for building Singer taps and targets
License: Apache 2.0
License-File: LICENSE
Keywords: Hotglue,Hotglue SDK,ELT
Author: Hotglue Team and Contributors. Original work by Meltano Team and Contributors.
Maintainer: Hotglue Team and Contributors
Requires-Python: >=3.7.1,<3.11
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Dist: PyJWT (>=2.4,<3.0)
Requires-Dist: backoff (>=1.8.0,<2.0)
Requires-Dist: click (>=8.0,<9.0)
Requires-Dist: cryptography (>=3.4.6,<38.0.0)
Requires-Dist: hotglue-etl-exceptions (==0.1.0)
Requires-Dist: importlib-metadata ; python_version < "3.8"
Requires-Dist: inflection (>=0.5.1,<0.6.0)
Requires-Dist: joblib (>=1.0.1,<2.0.0)
Requires-Dist: jsonpath-ng (>=1.5.3,<2.0.0)
Requires-Dist: memoization (>=0.3.2,<0.5.0)
Requires-Dist: numpy (>=1.21.6,<2.0.0)
Requires-Dist: pandas (>=1.3.5,<2.0.0)
Requires-Dist: pendulum (>=2.1.0,<3.0.0)
Requires-Dist: pipelinewise-singer-python (==1.2.0)
Requires-Dist: pydantic (==2.5.3)
Requires-Dist: python-dotenv (>=0.20.0,<0.21.0)
Requires-Dist: requests (>=2.25.1,<3.0.0)
Requires-Dist: sqlalchemy (>=1.4,<2.0)
Requires-Dist: typing-extensions (>=4.2.0,<5.0.0)
Project-URL: Documentation, https://hotglue.com
Project-URL: Homepage, https://hotglue.com
Project-URL: Repository, https://github.com/hotglue/hotgluesingersdk
Description-Content-Type: text/markdown

# Hotglue SDK for Taps

This is a fork of Melanto's SingerSDK for special use in [hotglue](https://hotglue.com), an embedded integration platform for running Singer Taps and Targets.

Taps and targets built on the SDK are automatically compliant with the
[Singer Spec](https://hub.meltano.com/singer/spec), the
de-facto open source standard for extract and load pipelines.

## OAuth Access Token Support

Taps can implement the `--access-token` CLI flag to refresh OAuth access tokens without running the tap directly.

### Implementing Access Token Support

To enable this feature in your tap, override the `access_token_support` class method to return a tuple of `(authenticator_class, auth_endpoint)`:

```python
from hotglue_singer_sdk import Tap
from my_tap.auth import MyOAuthAuthenticator

class MyTap(Tap):
    name = "tap-myservice"

    @classmethod
    def access_token_support(cls, connector=None):
        """Return the authenticator class and auth endpoint for token refresh.

        Returns:
            A tuple of (authenticator_class, auth_endpoint).
        """
        default_url = "https://api.myservice.com/oauth/token"
        # ommit if token url is not dynamic
        dynamic_url = connector.config.get("auth_url")
        url = dynamic_url or default_url
        return (MyOAuthAuthenticator, url)
```

### Authenticator Requirements

The authenticator class must implement the following methods:

- `is_token_valid()` - Returns `True` if the current access token is still valid
- `update_access_token()` - Refreshes the access token and updates the config file

The authenticator will be instantiated with these parameters:
- `stream` - A dummy stream object with `logger`, `tap_name`, and `config` attributes
- `config_file` - Path to the config file for writing updated tokens
- `auth_endpoint` - The OAuth token endpoint URL

### Usage

Once implemented, users can refresh the access token using:

```bash
tap-myservice --config config.json --access-token
```

This will output the new access token as JSON:

```json
{
  "access_token": "new_token_value"
}
```

**Note:** The `--access-token` flag requires a config file path. It will not work with `--config ENV` or when omitting the config.
