aws / aws/chalice

[proposal] Add support for a wheels dir

Open
#839 3 comments 4 reactions 0 assignees View on GitHub
feature-request proposals
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Right now there are two directories consulted when packaging your app:

* `chalicelib/` - This is for code *you* write that's part of your chalice app. It's a middle ground between having to put everything in your app.py file and putting all your business logic in an entirely separate python package
* `vendor/` - A directory that just blindly copies its contents into the deployment package. While intended for python code, it can be anything including static assets and .so files.

However, another common use case is where you have a package in which you have a `.whl` file that works correctly in lambda. A common use case might be some internal dependency that's not available on pypi but you've correctly built a wheel for on an ec2 instance or a docker container. In the simplest case you'd just have to unzip into the `vendor/` directory, but it's one step removed from what's actually produced in a build step (a `.whl` file).

### Proposal

What I'd propose is we add another directory, `wheels/`, that contains a list of `.whl` files you want added to your deployment package. As part of the packaging process we'll automatically handle the correct unpacking of the whl into the deployment package. You'd have something like:

```
├── app.py
├── app.pyc
├── requirements.txt
├── vendor
└── wheels
├── magic-package.whl
└── special-internal-package.whl
```

### Rationale

We've seen some users struggle with vendor/, and it's not obvious how to go from a wheel file to something that would work in `vendor/`. Additionally, it's an unnecessary step. The `bdist_wheel` produces a `.whl` file, it seems reasonable that chalice should just work directly with wheels.

I realize that the number of options for packaging your app might be getting to the point where it's too confusing, but I do think this solves a use case that isn't cleanly addressed elsewhere.

Let me know what you all think.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the packaging process that currently handles the vendor/ directory and deployment packages. Compare that flow with the proposed wheels/ directory and determine how .whl files should be unpacked. Done means wheel contents are included correctly in the deployment package, with coverage for the new packaging behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.