cloudsnorkel.cdk-turbo-layers 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

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.
@@ -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
- ## Example
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 requirements', 'lambda-src')],
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
@@ -15,9 +15,9 @@ import constructs._jsii
15
15
 
16
16
  __jsii_assembly__ = jsii.JSIIAssembly.load(
17
17
  "@cloudsnorkel/cdk-turbo-layers",
18
- "0.2.0",
18
+ "0.2.2",
19
19
  __name__[0:-6],
20
- "cdk-turbo-layers@0.2.0.jsii.tgz",
20
+ "cdk-turbo-layers@0.2.2.jsii.tgz",
21
21
  )
22
22
 
23
23
  __all__ = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudsnorkel.cdk-turbo-layers
3
- Version: 0.2.0
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,12 +17,12 @@ 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.7
20
+ Requires-Python: ~=3.8
22
21
  Description-Content-Type: text/markdown
23
22
  License-File: LICENSE
24
23
  Requires-Dist: aws-cdk-lib <3.0.0,>=2.87.0
25
24
  Requires-Dist: constructs <11.0.0,>=10.0.5
26
- Requires-Dist: jsii <2.0.0,>=1.90.0
25
+ Requires-Dist: jsii <2.0.0,>=1.93.0
27
26
  Requires-Dist: publication >=0.0.3
28
27
  Requires-Dist: typeguard ~=2.13.3
29
28
 
@@ -112,7 +111,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
112
111
  dotnet add package CloudSnorkel.Cdk.TurboLayers
113
112
  ```
114
113
 
115
- ## Example
114
+ ## Examples
115
+
116
+ The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
116
117
 
117
118
  ```python
118
119
  const packager = new PythonDependencyPackager(this, 'Packager', {
@@ -126,15 +127,77 @@ new Function(this, 'Function with inline requirements', {
126
127
  // this will create a layer from with requests and Scrapy in a Lambda function instead of locally
127
128
  layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
128
129
  });
130
+ ```
131
+
132
+ The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
133
+
134
+ ```python
135
+ const packager = new PythonDependencyPackager(this, 'Packager', {
136
+ runtime: lambda.Runtime.PYTHON_3_9,
137
+ type: DependencyPackagerType.LAMBDA,
138
+ });
129
139
  new Function(this, 'Function with external source and requirements', {
130
140
  handler: 'index.handler',
131
141
  code: lambda.Code.fromAsset('lambda-src'),
132
142
  runtime: lambda.Runtime.PYTHON_3_9,
143
+ // this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
144
+ layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
145
+ });
146
+ ```
147
+
148
+ Custom package managers like Pipenv or Poetry are also supported.
149
+
150
+ ```python
151
+ const packager = new PythonDependencyPackager(this, 'Packager', {
152
+ runtime: lambda.Runtime.PYTHON_3_9,
153
+ type: DependencyPackagerType.LAMBDA,
154
+ });
155
+ new Function(this, 'Function with external source and requirements', {
156
+ handler: 'index.handler',
157
+ code: lambda.Code.fromAsset('lambda-poetry-src'),
158
+ runtime: lambda.Runtime.PYTHON_3_9,
133
159
  // this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
134
- layers: [packager.layerFromPoetry('poetry requirements', 'lambda-src')],
160
+ layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
135
161
  });
136
162
  ```
137
163
 
164
+ If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
165
+
166
+ ```python
167
+ const packager = new PythonDependencyPackager(this, 'Packager', {
168
+ runtime: lambda.Runtime.PYTHON_3_9,
169
+ type: DependencyPackagerType.CODEBUILD,
170
+ preinstallCommands: [
171
+ 'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
172
+ ],
173
+ });
174
+ new Function(this, 'Function with external source and requirements', {
175
+ handler: 'index.handler',
176
+ code: lambda.Code.fromAsset('lambda-pipenv-src'),
177
+ runtime: lambda.Runtime.PYTHON_3_9,
178
+ layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
179
+ });
180
+ ```
181
+
182
+ Building layers for ARM64 functions is also supported.
183
+
184
+ ```python
185
+ const packager = new PythonDependencyPackager(this, 'Packager', {
186
+ runtime: lambda.Runtime.PYTHON_3_9,
187
+ type: DependencyPackagerType.LAMBDA,
188
+ architecture: Architecture.ARM_64,
189
+ });
190
+ new Function(this, 'Function with external source and requirements', {
191
+ handler: 'index.handler',
192
+ code: lambda.Code.fromAsset('lambda-poetry-src'),
193
+ runtime: lambda.Runtime.PYTHON_3_9,
194
+ architecture: Architecture.ARM_64,
195
+ layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
196
+ });
197
+ ```
198
+
199
+ 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.
200
+
138
201
  ## Older Implementations
139
202
 
140
203
  * [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
@@ -0,0 +1,9 @@
1
+ cloudsnorkel/cdk_turbo_layers/__init__.py,sha256=JZVvuz5qSTJqRoLsLaKd10OkC296AjSrNZJ3C7s0-v0,56865
2
+ cloudsnorkel/cdk_turbo_layers/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py,sha256=ELmtBGkHIEwnm-DfHUpmk6haAmaYgXnhXBfMNI9GpAY,426
4
+ cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.2.jsii.tgz,sha256=YRUIhwmAwog-XNDgMZTg6g0u_knogalRa6jNMuHdDdA,331181
5
+ cloudsnorkel.cdk_turbo_layers-0.2.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
+ cloudsnorkel.cdk_turbo_layers-0.2.2.dist-info/METADATA,sha256=UGQ8mcJhAM-XwYDCUoGEsWvQa9tt9EarYBTpMV0Ttz8,9696
7
+ cloudsnorkel.cdk_turbo_layers-0.2.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
+ cloudsnorkel.cdk_turbo_layers-0.2.2.dist-info/top_level.txt,sha256=6vUrT-dcGOiRMT4Q6gEQPznoyS7nHOJ269MHpo4DEd8,13
9
+ cloudsnorkel.cdk_turbo_layers-0.2.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- cloudsnorkel/cdk_turbo_layers/__init__.py,sha256=7F20yuHZpCLLjX-sRftw-ixO24xj4GMWUgN7cCKkz30,54245
2
- cloudsnorkel/cdk_turbo_layers/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py,sha256=ISETgxvvYmG6HH02RAJ3gEqd_XDTUw6JXy5WXlGM7IU,426
4
- cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.2.0.jsii.tgz,sha256=oXBlGGRVhpAJQHW0yZNjaKgPslFld_ncSv6wZNtBJ_4,525951
5
- cloudsnorkel.cdk_turbo_layers-0.2.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
- cloudsnorkel.cdk_turbo_layers-0.2.0.dist-info/METADATA,sha256=vHRPg1Q17JNTUTDs8DmB-ahRKyZKTUj1HH2ylZ-73Ws,7126
7
- cloudsnorkel.cdk_turbo_layers-0.2.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
8
- cloudsnorkel.cdk_turbo_layers-0.2.0.dist-info/top_level.txt,sha256=6vUrT-dcGOiRMT4Q6gEQPznoyS7nHOJ269MHpo4DEd8,13
9
- cloudsnorkel.cdk_turbo_layers-0.2.0.dist-info/RECORD,,