From 896439cdcbb27d3e51287b51956d64edf88ee9f8 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Thu, 17 Aug 2023 18:50:22 +0200 Subject: [PATCH 1/5] aws-sam-cli: add anthonyroussel to maintainers --- pkgs/development/tools/aws-sam-cli/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index 311e44051d62..e8368a3ca76a 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -62,6 +62,6 @@ python3.pkgs.buildPythonApplication rec { homepage = "https://github.com/awslabs/aws-sam-cli"; changelog = "https://github.com/aws/aws-sam-cli/releases/tag/v${version}"; license = licenses.asl20; - maintainers = with maintainers; [ lo1tuma ]; + maintainers = with maintainers; [ lo1tuma anthonyroussel ]; }; } From 565ebb629fa79075b214e941d2139aaa5d156272 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Mon, 23 Oct 2023 17:52:16 +0200 Subject: [PATCH 2/5] aws-sam-cli: add meta.mainProgram --- pkgs/development/tools/aws-sam-cli/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index e8368a3ca76a..7ddeaee8d726 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -62,6 +62,7 @@ python3.pkgs.buildPythonApplication rec { homepage = "https://github.com/awslabs/aws-sam-cli"; changelog = "https://github.com/aws/aws-sam-cli/releases/tag/v${version}"; license = licenses.asl20; + mainProgram = "sam"; maintainers = with maintainers; [ lo1tuma anthonyroussel ]; }; } From b48ed3ed61fc718d3f616e78ced97f6975521349 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Mon, 23 Oct 2023 17:52:33 +0200 Subject: [PATCH 3/5] aws-sam-cli: fix upstream url --- pkgs/development/tools/aws-sam-cli/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index 7ddeaee8d726..e5b4d43377c3 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -35,7 +35,7 @@ python3.pkgs.buildPythonApplication rec { ]; postFixup = if enableTelemetry then "echo aws-sam-cli TELEMETRY IS ENABLED" else '' - # Disable telemetry: https://github.com/awslabs/aws-sam-cli/issues/1272 + # Disable telemetry: https://github.com/aws/aws-sam-cli/issues/1272 wrapProgram $out/bin/sam --set SAM_CLI_TELEMETRY 0 ''; @@ -59,7 +59,7 @@ python3.pkgs.buildPythonApplication rec { meta = with lib; { description = "CLI tool for local development and testing of Serverless applications"; - homepage = "https://github.com/awslabs/aws-sam-cli"; + homepage = "https://github.com/aws/aws-sam-cli"; changelog = "https://github.com/aws/aws-sam-cli/releases/tag/v${version}"; license = licenses.asl20; mainProgram = "sam"; From f096c10d7f5f976106255d4c95c7a96d35db5e23 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Mon, 23 Oct 2023 17:53:25 +0200 Subject: [PATCH 4/5] aws-sam-cli: add passthru.updateScript and passthru.tests --- pkgs/development/tools/aws-sam-cli/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index e5b4d43377c3..5cd7d958c363 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -1,6 +1,9 @@ { lib , python3 , fetchPypi +, testers +, aws-sam-cli +, nix-update-script , enableTelemetry ? false }: @@ -57,6 +60,16 @@ python3.pkgs.buildPythonApplication rec { doCheck = false; + passthru = { + tests.version = testers.testVersion { + package = aws-sam-cli; + command = "sam --version"; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex" "^v([0-9.]+)$" ]; + }; + }; + meta = with lib; { description = "CLI tool for local development and testing of Serverless applications"; homepage = "https://github.com/aws/aws-sam-cli"; From c14250deba1e1e58182bb599fb5e198586b9084f Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Mon, 23 Oct 2023 17:59:09 +0200 Subject: [PATCH 5/5] aws-sam-cli: 1.90.0 -> 1.103.0 https://github.com/aws/aws-sam-cli/releases/tag/v1.103.0 https://github.com/aws/aws-sam-cli/compare/v1.90.0...v1.103.0 --- .../development/tools/aws-sam-cli/default.nix | 110 ++++++++++++++---- 1 file changed, 85 insertions(+), 25 deletions(-) diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index 5cd7d958c363..9d2e2e0bb821 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -1,6 +1,7 @@ { lib , python3 -, fetchPypi +, fetchFromGitHub +, git , testers , aws-sam-cli , nix-update-script @@ -9,56 +10,113 @@ python3.pkgs.buildPythonApplication rec { pname = "aws-sam-cli"; - version = "1.90.0"; + version = "1.103.0"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - hash = "sha256-JXUfc37O6cTTOCTTtWE05m+GR4iDyBsmRPyXoTRxFmo="; + disabled = python3.pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "aws"; + repo = "aws-sam-cli"; + rev = "refs/tags/v${version}"; + hash = "sha256-oy0+dAA6x8Jl1nZ1wjsR9xvpR9biemTtqL9B1awz4BM="; }; + nativeBuildInputs = with python3.pkgs; [ + pythonRelaxDepsHook + ]; + + pythonRelaxDeps = [ + "aws-sam-translator" + "boto3-stubs" + "tzlocal" + ]; + propagatedBuildInputs = with python3.pkgs; [ aws-lambda-builders aws-sam-translator boto3 + boto3-stubs cfn-lint chevron + click cookiecutter dateparser docker flask + jsonschema pyopenssl pyyaml + requests rich ruamel-yaml - serverlessrepo tomlkit typing-extensions tzlocal watchdog + ] ++ (with python3.pkgs.boto3-stubs.optional-dependencies; [ + apigateway + cloudformation + ecr + iam + kinesis + lambda + s3 + schemas + secretsmanager + signer + sqs + stepfunctions + sts + xray + ]); + + postFixup = '' + # Disable telemetry: https://github.com/aws/aws-sam-cli/issues/1272 + wrapProgram $out/bin/sam \ + --set SAM_CLI_TELEMETRY ${if enableTelemetry then "1" else "0"} \ + --prefix PATH : $out/bin:${lib.makeBinPath [ git ]} + ''; + + doCheck = true; + + nativeCheckInputs = with python3.pkgs; [ + filelock + flaky + parameterized + psutil + pytest-xdist + pytestCheckHook ]; - postFixup = if enableTelemetry then "echo aws-sam-cli TELEMETRY IS ENABLED" else '' - # Disable telemetry: https://github.com/aws/aws-sam-cli/issues/1272 - wrapProgram $out/bin/sam --set SAM_CLI_TELEMETRY 0 + preCheck = '' + export HOME=$(mktemp -d) + export PATH="$PATH:$out/bin:${lib.makeBinPath [ git ]}" ''; - postPatch = '' - substituteInPlace requirements/base.txt \ - --replace 'PyYAML>=' 'PyYAML>=5.4.1 #' \ - --replace "aws_lambda_builders==" "aws_lambda_builders>=" \ - --replace 'aws-sam-translator==1.70.0' 'aws-sam-translator>=1.60.1' \ - --replace 'boto3>=' 'boto3>=1.26.79 #' \ - --replace 'cfn-lint~=0.77.9' 'cfn-lint~=0.73.2' \ - --replace "cookiecutter~=" "cookiecutter>=" \ - --replace 'docker~=6.1.0' 'docker~=6.0.1' \ - --replace 'ruamel_yaml~=0.17.32' 'ruamel_yaml~=0.17.21' \ - --replace 'tomlkit==0.11.8' 'tomlkit>=0.11.8' \ - --replace 'typing_extensions~=4.4.0' 'typing_extensions~=4.4' \ - --replace 'tzlocal==3.0' 'tzlocal>=3.0' \ - --replace 'watchdog==' 'watchdog>=2.1.2 #' - ''; + pytestFlagsArray = [ + "tests" - doCheck = false; + # Disable tests that requires networking or complex setup + "--ignore=tests/end_to_end" + "--ignore=tests/integration" + "--ignore=tests/regression" + "--ignore=tests/smoke" + "--ignore=tests/unit/lib/telemetry" + + # Disable flaky tests + "--ignore=tests/unit/lib/samconfig/test_samconfig.py" + "--deselect=tests/unit/lib/sync/flows/test_rest_api_sync_flow.py::TestRestApiSyncFlow::test_update_stage" + "--deselect=tests/unit/lib/sync/flows/test_rest_api_sync_flow.py::TestRestApiSyncFlow::test_delete_deployment" + "--deselect=tests/unit/local/lambda_service/test_local_lambda_invoke_service.py::TestValidateRequestHandling::test_request_with_no_data" + + # Disable warnings + "-W ignore::DeprecationWarning" + ]; + + pythonImportsCheck = [ + "samcli" + ]; passthru = { tests.version = testers.testVersion { @@ -70,6 +128,8 @@ python3.pkgs.buildPythonApplication rec { }; }; + __darwinAllowLocalNetworking = true; + meta = with lib; { description = "CLI tool for local development and testing of Serverless applications"; homepage = "https://github.com/aws/aws-sam-cli";