Skip to content

tech spec: demo of common base image for all python connectors #29477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Aug 16, 2023

What

Suggest an approach at declaring a single, versioned, base image for all python connectors.

CF tech spec

@alafanechere
Copy link
Contributor Author

I successfully built a connector on this branch:
airbyte-ci connectors --name=source-openweather build

)


class _0_0_2(_0_0_1):
Copy link
Contributor Author

@alafanechere alafanechere Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm showcasing here how inheritance can help in patching a previous version with maximal code reuse.
Nothing in the pattern I implemented forces a new version to inherit from the previous one. In other words: the container property can be re-implemented from scratch on a AirbytePythonBase subclass if we don't want to build on top of the previous version.

changelog = "Upgrades the base image to Python 3.10.12."


def get_all_base_images() -> dict[str, Type[AirbytePythonBase]]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is "just" sugar to automatically discover the image version declared in the module. It saves us from hardcoding the list of base images version: implementing a new class should be the only step to make a new base version available.

return await self.finalize_build(self.context, connector_container)

@staticmethod
async def finalize_build(context: ConnectorContext, connector_container: Container) -> Container:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants