PyAirbyte
Project description
PyAirbyte
PyAirbyte brings the power of Airbyte to every Python developer.
Secrets Management
PyAirbyte can auto-import secrets from the following sources:
- Environment variables.
- Variables defined in a local
.env
("Dotenv") file. - Google Colab secrets.
- Manual entry via
getpass
.
Note: Additional secret store options may be supported in the future. More info here.
Retrieving Secrets
from airbyte import get_secret, SecretSource
source = get_connection("source-github")
source.set_config(
"credentials": {
"personal_access_token": get_secret("GITHUB_PERSONAL_ACCESS_TOKEN"),
}
)
The get_secret()
function accepts an optional source
argument of enum type SecretSource
. If omitted or set to SecretSource.ANY
, PyAirbyte will search all available secrets sources. If source
is set to a specific source, then only that source will be checked. If a list of SecretSource
entries is passed, then the sources will be checked using the provided ordering.
By default, PyAirbyte will prompt the user for any requested secrets that are not provided via other secret managers. You can disable this prompt by passing prompt=False
to get_secret()
.
Connector compatibility
To make a connector compatible with PyAirbyte, the following requirements must be met:
- The connector must be a Python package, with a
pyproject.toml
or asetup.py
file. - In the package, there must be a
run.py
file that contains arun
method. This method should read arguments from the command line, and run the connector with them, outputting messages to stdout. - The
pyproject.toml
orsetup.py
file must specify a command line entry point for therun
method calledsource-<connector name>
. This is usually done by adding aconsole_scripts
section to thepyproject.toml
file, or aentry_points
section to thesetup.py
file. For example:
[tool.poetry.scripts]
source-my-connector = "my_connector.run:run"
setup(
...
entry_points={
'console_scripts': [
'source-my-connector = my_connector.run:run',
],
},
...
)
To publish a connector to PyPI, specify the pypi
section in the metadata.yaml
file. For example:
data:
# ...
remoteRegistries:
pypi:
enabled: true
packageName: "airbyte-source-my-connector"
Validating source connectors
To validate a source connector for compliance, the airbyte-lib-validate-source
script can be used. It can be used like this:
airbyte-lib-validate-source —connector-dir . -—sample-config secrets/config.json
The script will install the python package in the provided directory, and run the connector against the provided config. The config should be a valid JSON file, with the same structure as the one that would be provided to the connector in Airbyte. The script will exit with a non-zero exit code if the connector fails to run.
For a more lightweight check, the --validate-install-only
flag can be used. This will only check that the connector can be installed and returns a spec, no sample config required.
Contributing
To learn how you can contribute to PyAirbyte, please see our PyAirbyte Contributors Guide.
Changelog and Release Notes
For a version history and list of all changes, please see our GitHub Releases page.
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
File details
Details for the file airbyte-0.4.0.tar.gz
.
File metadata
- Download URL: airbyte-0.4.0.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fa265f49629a3fff0409caae8df701cd6729f70c00eb10fe45dc62b1dbd4cb6 |
|
MD5 | 2c4cdeb764903a23a8bea7dcb090dfcf |
|
BLAKE2b-256 | 4ec4bd415c967e231609fcbbb4a24c61c7af8ef775bb9955d2e68f97bd883fa4 |
File details
Details for the file airbyte-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: airbyte-0.4.0-py3-none-any.whl
- Upload date:
- Size: 64.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6393c560ea15fd7df192002568e7e47f4c9519ad24b42e1681083f7d4cea76b6 |
|
MD5 | 40a63b570ace6af2f876681b64364507 |
|
BLAKE2b-256 | 8f626108147b4ed8b9367f1b456bd9b7e83dc0f3f0f0d00469426a82b5530f8e |