Skip to content
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

airbyte-lib: Add pip_url option and enforce source versions in a more consistent manner #33967

Merged
merged 2 commits into from
Jan 9, 2024

Conversation

flash1293
Copy link
Contributor

This PR does two things:

  • Add source install via pip_url from https://github.com/airbytehq/airbyte/pull/33878/files
  • Enforce versions only if the version was explicitly stated when initializing the source:
    • If the user does not specify the version, the latest version is installed if there is no installation already, otherwise whatever installed version is available will be used
    • If the user specifies "latest" as their target version, the latest version of the connector is looked up via the registry and enforced (initalization fails if the latest version can't be installed)
    • If the user specifies a specific version, this version is enforced (initalization fails if the latest version can't be installed)

Copy link

vercel bot commented Jan 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Jan 5, 2024 11:47am

Copy link
Collaborator

@aaronsteers aaronsteers left a comment

Choose a reason for hiding this comment

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

One comment/suggestion below, non-blocking.

Apart from that though, what do you think of adding an "uninstall()" action on the venv executor which would simply remove the venv directory? This would be as an inverse of install() or ensure_installation(). In my testing on the jupyter notebook, there were cases where the install action failed, but the venv was already (partially) created. In that case, I was left in an unusable state - not able to run the connector, but auto-detection inferred I already had installed the connector because the venv existed.

Comment on lines +162 to +164
if installed_version != self.target_version:
# If the version doesn't match, reinstall
self.install()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only a suggestion, but I seem to run into a lot of python cases where I get '0.0.0' back - such as when installing from a local path. This might not be necessary, but I think it's worth considering. We can always implement as you've written and just keep an eye out for edge cases. It may already be solved in the latest handling (ignoring when a specific version is not requested), but I want to mention anyway while I'm here.

Suggested change
if installed_version != self.target_version:
# If the version doesn't match, reinstall
self.install()
if installed_version == '0.0.0':
# pass or warn; version is either not declared or not detectable
pass
elif installed_version != self.target_version:
# If the version doesn't match, reinstall
self.install()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered this in the interim, but I'm hoping that we don't need to hardcode this with the current scheme - if you are working with local / pip-url installed connectors you would just not worry about the version (and thus not specify it) and airbyte-lib won't worry either, so it won't hit this.

I'll go ahead and merge and we can add the 0.0.0 exception if it keeps coming up in some scenarios.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense! Thanks!

@flash1293 flash1293 merged commit 76d9e17 into master Jan 9, 2024
28 checks passed
@flash1293 flash1293 deleted the flash1293/airbyte-lib-optional-version-check branch January 9, 2024 10:29
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants