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

Include python dependencies #78

Open
anthonysgevans opened this issue Jul 20, 2016 · 7 comments
Open

Include python dependencies #78

anthonysgevans opened this issue Jul 20, 2016 · 7 comments

Comments

@anthonysgevans
Copy link

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.

@michaelkaye
Copy link

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.

@josegonzalez
Copy link
Contributor

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 :)

@justcallmegreg
Copy link

👍 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:

  1. pip install -r requirements.txt -t ./_build
  2. 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?

@anthonysgevans
Copy link
Author

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:

  1. 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).

@justcallmegreg
Copy link

justcallmegreg commented Jul 22, 2016

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)

@stonemary
Copy link

stonemary commented Dec 14, 2016

I worked around this problem by creating a script which:
0. Have source: _build/ in kappa.yml

  1. creates a _build directory
  2. cp _src/* _build
  3. Run the pip install -t command
  4. Runs kappa

It would be nice if kappa can do something similar.

@luizs81
Copy link

luizs81 commented May 9, 2017

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?

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

No branches or pull requests

6 participants