Skip to content

Commit

Permalink
fix: Use updated Bundling class
Browse files Browse the repository at this point in the history
  • Loading branch information
setu4993 committed Dec 18, 2021
1 parent 5d58430 commit aa9a95e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
100 changes: 50 additions & 50 deletions packages/@aws-cdk/aws-lambda-python/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as lambda from '@aws-cdk/aws-lambda';
import { AssetHashType } from '@aws-cdk/core';
import { bundle } from './bundling';
import { Bundling } from './bundling';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
// eslint-disable-next-line no-duplicate-imports, import/order
Expand All @@ -13,69 +13,69 @@ import { Construct } from '@aws-cdk/core';
*/
export interface PythonFunctionProps extends lambda.FunctionOptions {
/**
* The path to the root directory of the function.
*/
* The path to the root directory of the function.
*/
readonly entry: string;

/**
* The path (relative to entry) to the index file containing the exported handler.
*
* @default index.py
*/
* The path (relative to entry) to the index file containing the exported handler.
*
* @default index.py
*/
readonly index?: string;

/**
* The name of the exported handler in the index file.
*
* @default handler
*/
* The name of the exported handler in the index file.
*
* @default handler
*/
readonly handler?: string;

/**
* The runtime environment. Only runtimes of the Python family are
* supported.
*
* @default lambda.Runtime.PYTHON_3_7
*/
* The runtime environment. Only runtimes of the Python family are
* supported.
*
* @default lambda.Runtime.PYTHON_3_7
*/
readonly runtime?: lambda.Runtime;

/**
* Determines how asset hash is calculated. Assets will get rebuild and
* uploaded only if their hash has changed.
*
* If asset hash is set to `SOURCE` (default), then only changes to the source
* directory will cause the asset to rebuild. This means, for example, that in
* order to pick up a new dependency version, a change must be made to the
* source tree. Ideally, this can be implemented by including a dependency
* lockfile in your source tree or using fixed dependencies.
*
* If the asset hash is set to `OUTPUT`, the hash is calculated after
* bundling. This means that any change in the output will cause the asset to
* be invalidated and uploaded. Bear in mind that `pip` adds timestamps to
* dependencies it installs, which implies that in this mode Python bundles
* will _always_ get rebuild and uploaded. Normally this is an anti-pattern
* since build
*
* @default AssetHashType.SOURCE By default, hash is calculated based on the
* contents of the source directory. This means that only updates to the
* source will cause the asset to rebuild.
*/
* Determines how asset hash is calculated. Assets will get rebuild and
* uploaded only if their hash has changed.
*
* If asset hash is set to `SOURCE` (default), then only changes to the source
* directory will cause the asset to rebuild. This means, for example, that in
* order to pick up a new dependency version, a change must be made to the
* source tree. Ideally, this can be implemented by including a dependency
* lockfile in your source tree or using fixed dependencies.
*
* If the asset hash is set to `OUTPUT`, the hash is calculated after
* bundling. This means that any change in the output will cause the asset to
* be invalidated and uploaded. Bear in mind that `pip` adds timestamps to
* dependencies it installs, which implies that in this mode Python bundles
* will _always_ get rebuild and uploaded. Normally this is an anti-pattern
* since build
*
* @default AssetHashType.SOURCE By default, hash is calculated based on the
* contents of the source directory. This means that only updates to the
* source will cause the asset to rebuild.
*/
readonly assetHashType?: AssetHashType;

/**
* Specify a custom hash for this asset. If `assetHashType` is set it must
* be set to `AssetHashType.CUSTOM`. For consistency, this custom hash will
* be SHA256 hashed and encoded as hex. The resulting hash will be the asset
* hash.
*
* NOTE: the hash is used in order to identify a specific revision of the asset, and
* used for optimizing and caching deployment activities related to this asset such as
* packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
* need to make sure it is updated every time the asset changes, or otherwise it is
* possible that some deployments will not be invalidated.
*
* @default - based on `assetHashType`
*/
* Specify a custom hash for this asset. If `assetHashType` is set it must
* be set to `AssetHashType.CUSTOM`. For consistency, this custom hash will
* be SHA256 hashed and encoded as hex. The resulting hash will be the asset
* hash.
*
* NOTE: the hash is used in order to identify a specific revision of the asset, and
* used for optimizing and caching deployment activities related to this asset such as
* packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
* need to make sure it is updated every time the asset changes, or otherwise it is
* possible that some deployments will not be invalidated.
*
* @default - based on `assetHashType`
*/
readonly assetHash?: string;
}

Expand Down Expand Up @@ -107,7 +107,7 @@ export class PythonFunction extends lambda.Function {
super(scope, id, {
...props,
runtime,
code: bundle({
code: Bundling.bundle({
runtime,
architecture,
entry,
Expand Down
22 changes: 11 additions & 11 deletions packages/@aws-cdk/aws-lambda-python/lib/layer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import * as lambda from '@aws-cdk/aws-lambda';
import { bundle } from './bundling';
import { Bundling } from './bundling';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
// eslint-disable-next-line no-duplicate-imports, import/order
Expand All @@ -11,21 +11,21 @@ import { Construct } from '@aws-cdk/core';
*/
export interface PythonLayerVersionProps extends lambda.LayerVersionOptions {
/**
* The path to the root directory of the lambda layer.
*/
* The path to the root directory of the lambda layer.
*/
readonly entry: string;

/**
* The runtimes compatible with the python layer.
*
* @default - All runtimes are supported.
*/
* The runtimes compatible with the python layer.
*
* @default - All runtimes are supported.
*/
readonly compatibleRuntimes?: lambda.Runtime[];

/**
* The system architectures compatible with this layer.
* @default [Architecture.X86_64]
*/
* The system architectures compatible with this layer.
* @default [Architecture.X86_64]
*/
readonly compatibleArchitectures?: lambda.Architecture[];
}

Expand Down Expand Up @@ -54,7 +54,7 @@ export class PythonLayerVersion extends lambda.LayerVersion {
super(scope, id, {
...props,
compatibleRuntimes,
code: bundle({
code: Bundling.bundle({
entry,
runtime,
architecture,
Expand Down

0 comments on commit aa9a95e

Please sign in to comment.