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

fix: Support relative imports for submodules #169

Merged
merged 3 commits into from
Dec 28, 2021

Conversation

di
Copy link
Member

@di di commented Nov 17, 2021

This PR adds support for importing from submodules relative to the directory where the function is defined.

Copy link
Member

@matthewrobertson matthewrobertson left a comment

Choose a reason for hiding this comment

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

LGTM

@jterblanche
Copy link

Supporting relative imports in functions framework is pointless if the live Cloud Functions environment doesn't support it as well.

@di
Copy link
Member Author

di commented Dec 28, 2021

Hi @jterblanche, I'm not sure what you mean, what do you think is missing here?

@jterblanche
Copy link

Nothing wrong here per se - but (unless I'm missing something) with target functions being invoked by Uvicorn on the Cloud Functions live platform in my opinion negates the need for this as relative imports can't be used there anyway.

@di
Copy link
Member Author

di commented Dec 28, 2021

@jterblanche The HTTP server being used (gunicorn vs flask's HTTP server) should have no effect on this feature.

To be extra clear here, since it seems like this is the source of the confusion: the Functions Framework (this repo) is used both for local development and is what is used to serve live Cloud Functions. Once this change is merged, released, and the Cloud Functions environment updated to include the new version of the framework, you'll be able to do relative imports in the Cloud Functions environment as well.

@di
Copy link
Member Author

di commented Dec 28, 2021

Also, @grant @matthewrobertson @KaylaNguyen FYI, I'm not a maintainer of this repo anymore, you'll need to merge/release this and my other PRs.

@jterblanche
Copy link

and is what is used to serve live Cloud Functions.

This is the bit I was missing thanks.

@KaylaNguyen KaylaNguyen merged commit 9046388 into master Dec 28, 2021
@KaylaNguyen KaylaNguyen deleted the support-relative-imports branch December 28, 2021 22:03
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.

5 participants