-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Better handling of chalicelib #299
Comments
The Github page doesn't mention chalicelib, but the full documentation does: http://chalice.readthedocs.io/en/latest/topics/packaging.html |
Is the suggestion to add chalice to sys.path so you don't have to have So instead of |
@jamesls Yeah, that is indeed it. Maybe also some clarification between what should go in chalicelib, and what should go in vendor. |
I disagree, the chalicelib folder should be explicitly referenced (although perhaps it shouldn't have to be called chalicelib, but that's a separate question). chalicelib is for organising one's own code. vendor is for third-party builds of software that needs to be made available in your Chalice project. For pure-Python projects on PyPI that is unnecessary, but for:
then they need to be uploaded via vendor. E.g. https://github.com/amaas-fintech/chalice-vendor-packages - is a package that needs to be compiled into a .so file. When running locally, the package is picked up from my local pip install, but on Chalice it is referenced from the vendor folder - so it works from both (the lambda compliant build obviously wouldn't work locally). |
"from chalicelib import mymodule you could just say import mymodule" I just spent 40 min trying to figure out why "import mymodule" failed. |
When working locally, I've found that my custom python files work just fine regardless of directory structure. I too spent a lithe bit of time trying to figure out how deployed chalice app can utilize my custom python files (finally found chalicelib in docs). I created the following pr, does it help? |
This looks to me like a design flaw. Conceptually, This may work for the simplest use case, one lambda function per project, but as soon as you move to more complex projects, ones with more than one lambda, or ones that are deployed in other ways, not just as a lambda function having every package start with |
I would like to suggest that chalice does an automatic sys.path.append of the chalicelib directory, both when running chalice local, and when actually running lambda.
This would make it easier to use with very little drawbacks.
Also, the documentation should probably mention the use of chalicelib as well.
The text was updated successfully, but these errors were encountered: