kappa
kappa copied to clipboard
Include python dependencies
Hi All,
Two feature suggestions...
Pull in python dependencies Is there any appetite to have a command line option that pulls in python dependencies during the the deploy command?
Separate source and build directories
Executing pip install -r requirements.txt -t /path/to/source/
creates a lot of noise in the source directory. It would be great if we could create a separate build directory to create the lambda zip package.
I've got some time to spend on this if people think it could be useful.
Cheers,
Anthony.
I would be interested in this - I've just started using kappa this week to set up a build environment.
I ended up using the (undocumented) 'dependencies' configuration option to include a separate directory, and installing the requirements to that as part of the build outside of kappa. It would definitely be cleaner to have an option to install the given packages and append to the packaging path inside kappa.
Might be worth considering how we should handle dependencies like "kappa" or "boto3" - I ended up with two requirements.txt, one for local build/test/deployment, which included a smaller set for the actual upload to lambda.
I have no idea what this feature request means. If you want to provide some code to implement this feature, cool, otherwise that will be a no from me :)
👍 for the ideas.
It would be nice if kappa
was able to run pip install -r _src/requirements.txt
to install dependencies into build directory when creating the bundle.
Manually executing this command into _src/
adds a lot of noise into the project structure. This is the reason why I have to use exclusive gitignore rules like: !_src/lambda.py
, !_src/requirements.txt
etc...
In my opinion the following kappa
project structure should be present:
./
_src/
lambda.py
requirements.txt
setup.cfg
_tests
_build
kappa.yaml
requirements.txt #with kappa and boto
On kappa deploy
:
-
pip install -r requirements.txt -t ./_build
- Creating bundle...
It would be also nice to have a subcommand like kappa init
that is able to initialize a project directory like vagrant
does.
What do u think?
It would be also nice to have a subcommand like kappa init that is able to initialize a project directory like vagrant does.
This would be great. I've written a new-project
playbook with ansible to do this for the time being but kappa init
would be much better.
On kappa deploy:
- pip install -r requirements.txt -t ./_build
We could use the runtime defined in kappa.yml to know when to pull in python requirements (and not JS).
FYI, I've published the skeleton project I used to init my kappa repos with. Here it is.
(I'm also working on pre-commit hooks especially for developing AWS lambdas)
I worked around this problem by creating a script which:
0. Have source: _build/
in kappa.yml
- creates a
_build
directory -
cp _src/* _build
- Run the pip install -t command
- Runs kappa
It would be nice if kappa can do something similar.
Looking at https://github.com/garnaat/kappa/blob/develop/kappa/function.py#L69 seems that dependencies could be installed somewhere else and then listed in the kappa.yml
file.
I didn't try that yet, but can someone confirm if my understanding is correct?