cloudsnorkel.cdk-turbo-layers 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cloudsnorkel.cdk-turbo-layers might be problematic. Click here for more details.
- {cloudsnorkel.cdk-turbo-layers-0.2.0/src/cloudsnorkel.cdk_turbo_layers.egg-info → cloudsnorkel.cdk-turbo-layers-0.2.2}/PKG-INFO +68 -5
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/README.md +66 -2
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/pyproject.toml +2 -2
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/setup.py +4 -5
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel/cdk_turbo_layers/__init__.py +66 -2
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py +2 -2
- cloudsnorkel.cdk-turbo-layers-0.2.2/src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.2.jsii.tgz +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2/src/cloudsnorkel.cdk_turbo_layers.egg-info}/PKG-INFO +68 -5
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel.cdk_turbo_layers.egg-info/SOURCES.txt +1 -1
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel.cdk_turbo_layers.egg-info/requires.txt +1 -1
- cloudsnorkel.cdk-turbo-layers-0.2.0/src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.0.jsii.tgz +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/LICENSE +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/MANIFEST.in +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/setup.cfg +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel/cdk_turbo_layers/py.typed +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel.cdk_turbo_layers.egg-info/dependency_links.txt +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.2.0 → cloudsnorkel.cdk-turbo-layers-0.2.2}/src/cloudsnorkel.cdk_turbo_layers.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudsnorkel.cdk-turbo-layers
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Speed-up Lambda function deployment with dependency layers built in AWS
|
|
5
5
|
Home-page: https://github.com/CloudSnorkel/cdk-turbo-layers.git
|
|
6
6
|
Author: Amir Szekely<amir@cloudsnorkel.com>
|
|
@@ -10,7 +10,6 @@ Classifier: Intended Audience :: Developers
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: JavaScript
|
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -18,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
17
|
Classifier: Typing :: Typed
|
|
19
18
|
Classifier: Development Status :: 4 - Beta
|
|
20
19
|
Classifier: License :: OSI Approved
|
|
21
|
-
Requires-Python: ~=3.
|
|
20
|
+
Requires-Python: ~=3.8
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
License-File: LICENSE
|
|
24
23
|
|
|
@@ -107,7 +106,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
107
106
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
108
107
|
```
|
|
109
108
|
|
|
110
|
-
##
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
111
112
|
|
|
112
113
|
```python
|
|
113
114
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -121,15 +122,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
121
122
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
122
123
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
123
124
|
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
131
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
132
|
+
type: DependencyPackagerType.LAMBDA,
|
|
133
|
+
});
|
|
124
134
|
new Function(this, 'Function with external source and requirements', {
|
|
125
135
|
handler: 'index.handler',
|
|
126
136
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
127
137
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
138
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
139
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
147
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
148
|
+
type: DependencyPackagerType.LAMBDA,
|
|
149
|
+
});
|
|
150
|
+
new Function(this, 'Function with external source and requirements', {
|
|
151
|
+
handler: 'index.handler',
|
|
152
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
153
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
128
154
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
129
|
-
layers: [packager.layerFromPoetry('poetry
|
|
155
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
130
156
|
});
|
|
131
157
|
```
|
|
132
158
|
|
|
159
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
163
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
164
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
165
|
+
preinstallCommands: [
|
|
166
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
167
|
+
],
|
|
168
|
+
});
|
|
169
|
+
new Function(this, 'Function with external source and requirements', {
|
|
170
|
+
handler: 'index.handler',
|
|
171
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
172
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
173
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Building layers for ARM64 functions is also supported.
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
181
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
182
|
+
type: DependencyPackagerType.LAMBDA,
|
|
183
|
+
architecture: Architecture.ARM_64,
|
|
184
|
+
});
|
|
185
|
+
new Function(this, 'Function with external source and requirements', {
|
|
186
|
+
handler: 'index.handler',
|
|
187
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
188
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
189
|
+
architecture: Architecture.ARM_64,
|
|
190
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
195
|
+
|
|
133
196
|
## Older Implementations
|
|
134
197
|
|
|
135
198
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -83,7 +83,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
83
83
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
##
|
|
86
|
+
## Examples
|
|
87
|
+
|
|
88
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
87
89
|
|
|
88
90
|
```python
|
|
89
91
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -97,15 +99,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
97
99
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
98
100
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
99
101
|
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
108
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
109
|
+
type: DependencyPackagerType.LAMBDA,
|
|
110
|
+
});
|
|
100
111
|
new Function(this, 'Function with external source and requirements', {
|
|
101
112
|
handler: 'index.handler',
|
|
102
113
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
103
114
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
115
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
116
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
124
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
125
|
+
type: DependencyPackagerType.LAMBDA,
|
|
126
|
+
});
|
|
127
|
+
new Function(this, 'Function with external source and requirements', {
|
|
128
|
+
handler: 'index.handler',
|
|
129
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
130
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
104
131
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
105
|
-
layers: [packager.layerFromPoetry('poetry
|
|
132
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
106
133
|
});
|
|
107
134
|
```
|
|
108
135
|
|
|
136
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
140
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
141
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
142
|
+
preinstallCommands: [
|
|
143
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
144
|
+
],
|
|
145
|
+
});
|
|
146
|
+
new Function(this, 'Function with external source and requirements', {
|
|
147
|
+
handler: 'index.handler',
|
|
148
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
149
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
150
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Building layers for ARM64 functions is also supported.
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
158
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
159
|
+
type: DependencyPackagerType.LAMBDA,
|
|
160
|
+
architecture: Architecture.ARM_64,
|
|
161
|
+
});
|
|
162
|
+
new Function(this, 'Function with external source and requirements', {
|
|
163
|
+
handler: 'index.handler',
|
|
164
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
165
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
166
|
+
architecture: Architecture.ARM_64,
|
|
167
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
172
|
+
|
|
109
173
|
## Older Implementations
|
|
110
174
|
|
|
111
175
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools~=67.3.2", "wheel~=0.
|
|
2
|
+
requires = ["setuptools~=67.3.2", "wheel~=0.42"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[tool.pyright]
|
|
6
6
|
defineConstant = { DEBUG = true }
|
|
7
|
-
pythonVersion = "3.
|
|
7
|
+
pythonVersion = "3.8"
|
|
8
8
|
pythonPlatform = "All"
|
|
9
9
|
reportSelfClsParameterName = false
|
|
@@ -5,7 +5,7 @@ kwargs = json.loads(
|
|
|
5
5
|
"""
|
|
6
6
|
{
|
|
7
7
|
"name": "cloudsnorkel.cdk-turbo-layers",
|
|
8
|
-
"version": "0.2.
|
|
8
|
+
"version": "0.2.2",
|
|
9
9
|
"description": "Speed-up Lambda function deployment with dependency layers built in AWS",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"url": "https://github.com/CloudSnorkel/cdk-turbo-layers.git",
|
|
@@ -26,17 +26,17 @@ kwargs = json.loads(
|
|
|
26
26
|
],
|
|
27
27
|
"package_data": {
|
|
28
28
|
"cloudsnorkel.cdk_turbo_layers._jsii": [
|
|
29
|
-
"cdk-turbo-layers@0.2.
|
|
29
|
+
"cdk-turbo-layers@0.2.2.jsii.tgz"
|
|
30
30
|
],
|
|
31
31
|
"cloudsnorkel.cdk_turbo_layers": [
|
|
32
32
|
"py.typed"
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
|
-
"python_requires": "~=3.
|
|
35
|
+
"python_requires": "~=3.8",
|
|
36
36
|
"install_requires": [
|
|
37
37
|
"aws-cdk-lib>=2.87.0, <3.0.0",
|
|
38
38
|
"constructs>=10.0.5, <11.0.0",
|
|
39
|
-
"jsii>=1.
|
|
39
|
+
"jsii>=1.93.0, <2.0.0",
|
|
40
40
|
"publication>=0.0.3",
|
|
41
41
|
"typeguard~=2.13.3"
|
|
42
42
|
],
|
|
@@ -45,7 +45,6 @@ kwargs = json.loads(
|
|
|
45
45
|
"Operating System :: OS Independent",
|
|
46
46
|
"Programming Language :: JavaScript",
|
|
47
47
|
"Programming Language :: Python :: 3 :: Only",
|
|
48
|
-
"Programming Language :: Python :: 3.7",
|
|
49
48
|
"Programming Language :: Python :: 3.8",
|
|
50
49
|
"Programming Language :: Python :: 3.9",
|
|
51
50
|
"Programming Language :: Python :: 3.10",
|
|
@@ -84,7 +84,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
84
84
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
##
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
88
90
|
|
|
89
91
|
```python
|
|
90
92
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -98,15 +100,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
98
100
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
99
101
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
100
102
|
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
109
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
110
|
+
type: DependencyPackagerType.LAMBDA,
|
|
111
|
+
});
|
|
101
112
|
new Function(this, 'Function with external source and requirements', {
|
|
102
113
|
handler: 'index.handler',
|
|
103
114
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
104
115
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
116
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
117
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
125
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
126
|
+
type: DependencyPackagerType.LAMBDA,
|
|
127
|
+
});
|
|
128
|
+
new Function(this, 'Function with external source and requirements', {
|
|
129
|
+
handler: 'index.handler',
|
|
130
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
131
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
105
132
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
106
|
-
layers: [packager.layerFromPoetry('poetry
|
|
133
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
107
134
|
});
|
|
108
135
|
```
|
|
109
136
|
|
|
137
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
141
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
142
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
143
|
+
preinstallCommands: [
|
|
144
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
new Function(this, 'Function with external source and requirements', {
|
|
148
|
+
handler: 'index.handler',
|
|
149
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
150
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
151
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Building layers for ARM64 functions is also supported.
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
159
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
160
|
+
type: DependencyPackagerType.LAMBDA,
|
|
161
|
+
architecture: Architecture.ARM_64,
|
|
162
|
+
});
|
|
163
|
+
new Function(this, 'Function with external source and requirements', {
|
|
164
|
+
handler: 'index.handler',
|
|
165
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
166
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
167
|
+
architecture: Architecture.ARM_64,
|
|
168
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
173
|
+
|
|
110
174
|
## Older Implementations
|
|
111
175
|
|
|
112
176
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudsnorkel.cdk-turbo-layers
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Speed-up Lambda function deployment with dependency layers built in AWS
|
|
5
5
|
Home-page: https://github.com/CloudSnorkel/cdk-turbo-layers.git
|
|
6
6
|
Author: Amir Szekely<amir@cloudsnorkel.com>
|
|
@@ -10,7 +10,6 @@ Classifier: Intended Audience :: Developers
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: JavaScript
|
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -18,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
17
|
Classifier: Typing :: Typed
|
|
19
18
|
Classifier: Development Status :: 4 - Beta
|
|
20
19
|
Classifier: License :: OSI Approved
|
|
21
|
-
Requires-Python: ~=3.
|
|
20
|
+
Requires-Python: ~=3.8
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
License-File: LICENSE
|
|
24
23
|
|
|
@@ -107,7 +106,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
107
106
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
108
107
|
```
|
|
109
108
|
|
|
110
|
-
##
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
111
112
|
|
|
112
113
|
```python
|
|
113
114
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -121,15 +122,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
121
122
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
122
123
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
123
124
|
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
131
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
132
|
+
type: DependencyPackagerType.LAMBDA,
|
|
133
|
+
});
|
|
124
134
|
new Function(this, 'Function with external source and requirements', {
|
|
125
135
|
handler: 'index.handler',
|
|
126
136
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
127
137
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
138
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
139
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
147
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
148
|
+
type: DependencyPackagerType.LAMBDA,
|
|
149
|
+
});
|
|
150
|
+
new Function(this, 'Function with external source and requirements', {
|
|
151
|
+
handler: 'index.handler',
|
|
152
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
153
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
128
154
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
129
|
-
layers: [packager.layerFromPoetry('poetry
|
|
155
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
130
156
|
});
|
|
131
157
|
```
|
|
132
158
|
|
|
159
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
163
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
164
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
165
|
+
preinstallCommands: [
|
|
166
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
167
|
+
],
|
|
168
|
+
});
|
|
169
|
+
new Function(this, 'Function with external source and requirements', {
|
|
170
|
+
handler: 'index.handler',
|
|
171
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
172
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
173
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Building layers for ARM64 functions is also supported.
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
181
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
182
|
+
type: DependencyPackagerType.LAMBDA,
|
|
183
|
+
architecture: Architecture.ARM_64,
|
|
184
|
+
});
|
|
185
|
+
new Function(this, 'Function with external source and requirements', {
|
|
186
|
+
handler: 'index.handler',
|
|
187
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
188
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
189
|
+
architecture: Architecture.ARM_64,
|
|
190
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
195
|
+
|
|
133
196
|
## Older Implementations
|
|
134
197
|
|
|
135
198
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -11,4 +11,4 @@ src/cloudsnorkel.cdk_turbo_layers.egg-info/top_level.txt
|
|
|
11
11
|
src/cloudsnorkel/cdk_turbo_layers/__init__.py
|
|
12
12
|
src/cloudsnorkel/cdk_turbo_layers/py.typed
|
|
13
13
|
src/cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py
|
|
14
|
-
src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.
|
|
14
|
+
src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.2.jsii.tgz
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|