From 9d9c7fdc7fde1e83632d54a49efd66270b3f949f Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Tue, 1 Mar 2022 17:44:10 -0600 Subject: [PATCH 01/10] Support use of Poetry with `individually` package option --- index.js | 3 +- lib/pip.js | 20 +++++++---- lib/poetry.js | 32 +++++++++-------- test.js | 17 +++++++++ tests/base/package.json | 2 +- tests/non_build_pyproject/package.json | 2 +- tests/non_poetry_pyproject/package.json | 2 +- tests/pipenv/package.json | 2 +- tests/poetry/package.json | 2 +- tests/poetry_individually/module1/handler.py | 5 +++ .../module1/pyproject.toml | 17 +++++++++ tests/poetry_individually/package.json | 14 ++++++++ tests/poetry_individually/serverless.yml | 36 +++++++++++++++++++ 13 files changed, 128 insertions(+), 26 deletions(-) create mode 100644 tests/poetry_individually/module1/handler.py create mode 100644 tests/poetry_individually/module1/pyproject.toml create mode 100644 tests/poetry_individually/package.json create mode 100644 tests/poetry_individually/serverless.yml diff --git a/index.js b/index.js index 7741a7f8..04190889 100644 --- a/index.js +++ b/index.js @@ -198,9 +198,10 @@ class ServerlessPythonRequirements { if (!isFunctionRuntimePython(arguments)) { return; } + const _pyprojectTomlToRequirements = () => pyprojectTomlToRequirements('', this); return BbPromise.bind(this) .then(pipfileToRequirements) - .then(pyprojectTomlToRequirements) + .then(_pyprojectTomlToRequirements) .then(addVendorHelper) .then(installAllRequirements) .then(packRequirements) diff --git a/lib/pip.js b/lib/pip.js index 79dec42a..5e5aa9e7 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -7,7 +7,7 @@ const spawn = require('child-process-ext/spawn'); const { quote } = require('shell-quote'); const { buildImage, getBindPath, getDockerUid } = require('./docker'); const { getStripCommand, getStripMode, deleteFiles } = require('./slim'); -const { isPoetryProject } = require('./poetry'); +const { isPoetryProject, pyprojectTomlToRequirements } = require('./poetry'); const { checkForAndDeleteMaxCacheVersions, sha256Path, @@ -59,14 +59,15 @@ function generateRequirementsFile( targetFile, pluginInstance ) { + console.log('generateRequirementsFile', requirementsPath, targetFile) const { serverless, servicePath, options, log } = pluginInstance; + const modulePath = path.dirname(requirementsPath) if ( options.usePoetry && - fse.existsSync(path.join(servicePath, 'pyproject.toml')) && - isPoetryProject(servicePath) + isPoetryProject(modulePath) ) { filterRequirementsFile( - path.join(servicePath, '.serverless/requirements.txt'), + targetFile, targetFile, pluginInstance ); @@ -566,10 +567,12 @@ function copyVendors(vendorFolder, targetFolder, { serverless, log }) { * @param {string} fileName */ function requirementsFileExists(servicePath, options, fileName) { + console.log('requirementsFileExists', servicePath, fileName); + if ( options.usePoetry && - fse.existsSync(path.join(servicePath, 'pyproject.toml')) && - isPoetryProject(servicePath) + // fse.existsSync(path.join(servicePath, 'pyproject.toml')) && + isPoetryProject(path.dirname(fileName)) ) { return true; } @@ -605,8 +608,12 @@ async function installRequirementsIfNeeded( // Our source requirements, under our service path, and our module path (if specified) const fileName = path.join(servicePath, modulePath, options.fileName); + console.log("installRequirementsIfNeeded", fileName); + await pyprojectTomlToRequirements(modulePath, pluginInstance); + // Skip requirements generation, if requirements file doesn't exist if (!requirementsFileExists(servicePath, options, fileName)) { + console.log('Requirements file doesnt exist!'); return false; } @@ -716,6 +723,7 @@ async function installAllRequirements() { // Then if we're going to package functions individually... if (this.serverless.service.package.individually) { + console.log('Doing it individually!') let doneModules = []; const filteredFuncs = this.targetFuncs.filter((func) => (func.runtime || this.serverless.service.provider.runtime).match( diff --git a/lib/poetry.js b/lib/poetry.js index 23f43dc0..6b29d056 100644 --- a/lib/poetry.js +++ b/lib/poetry.js @@ -8,22 +8,26 @@ const tomlParse = require('@iarna/toml/parse-string'); /** * poetry install */ -async function pyprojectTomlToRequirements() { - if (!this.options.usePoetry || !isPoetryProject(this.servicePath)) { +// TODO BW: This should be called on each sub-project. +async function pyprojectTomlToRequirements(modulePath, pluginInstance) { + const { serverless, servicePath, options, log, progress } = pluginInstance; + + moduleProjectPath = path.join(servicePath, modulePath) + if (!options.usePoetry || !isPoetryProject(moduleProjectPath)) { return; } let generateRequirementsProgress; - if (this.progress && this.log) { - generateRequirementsProgress = this.progress.get( + if (progress && log) { + generateRequirementsProgress = progress.get( 'python-generate-requirements-toml' ); generateRequirementsProgress.update( 'Generating requirements.txt from "pyproject.toml"' ); - this.log.info('Generating requirements.txt from "pyproject.toml"'); + log.info('Generating requirements.txt from "pyproject.toml"'); } else { - this.serverless.cli.log( + serverless.cli.log( 'Generating requirements.txt from pyproject.toml...' ); } @@ -42,7 +46,7 @@ async function pyprojectTomlToRequirements() { '--with-credentials', ], { - cwd: this.servicePath, + cwd: moduleProjectPath, } ); } catch (e) { @@ -50,7 +54,7 @@ async function pyprojectTomlToRequirements() { e.stderrBuffer && e.stderrBuffer.toString().includes('command not found') ) { - throw new this.serverless.classes.Error( + throw new serverless.classes.Error( `poetry not found! Install it according to the poetry docs.`, 'PYTHON_REQUIREMENTS_POETRY_NOT_FOUND' ); @@ -59,16 +63,16 @@ async function pyprojectTomlToRequirements() { } const editableFlag = new RegExp(/^-e /gm); - const sourceRequirements = path.join(this.servicePath, 'requirements.txt'); + const sourceRequirements = path.join(moduleProjectPath, 'requirements.txt'); const requirementsContents = fse.readFileSync(sourceRequirements, { encoding: 'utf-8', }); if (requirementsContents.match(editableFlag)) { - if (this.log) { - this.log.info('The generated file contains -e flags, removing them'); + if (log) { + log.info('The generated file contains -e flags, removing them'); } else { - this.serverless.cli.log( + serverless.cli.log( 'The generated file contains -e flags, removing them...' ); } @@ -78,10 +82,10 @@ async function pyprojectTomlToRequirements() { ); } - fse.ensureDirSync(path.join(this.servicePath, '.serverless')); + fse.ensureDirSync(path.join(servicePath, '.serverless')); fse.moveSync( sourceRequirements, - path.join(this.servicePath, '.serverless', 'requirements.txt'), + path.join(servicePath, '.serverless', modulePath, 'requirements.txt'), { overwrite: true } ); } finally { diff --git a/test.js b/test.js index 11a7cce5..7bf754e2 100644 --- a/test.js +++ b/test.js @@ -1452,6 +1452,23 @@ test( { skip: !hasPython(3.6) } ); +test( + 'poetry py3.6 can package flask with package individually option', + async (t) => { + process.chdir('tests/poetry_individually'); + const path = npm(['pack', '../..']); + npm(['i', path]); + + sls(['package'], { env: { } }); + const zipfiles = await listZipFiles('.serverless/module1-sls-py-req-test-dev-hello.zip'); // TODO BW: What is appending -dev- ? + t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged'); + t.true(zipfiles.includes(`bottle.py`), 'bottle is packaged'); + t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged'); + t.end(); + }, + { skip: !hasPython(3.6) } +); + test( 'py3.6 can package flask with package individually option', async (t) => { diff --git a/tests/base/package.json b/tests/base/package.json index 43ce4eee..38630491 100644 --- a/tests/base/package.json +++ b/tests/base/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz" + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" } } diff --git a/tests/non_build_pyproject/package.json b/tests/non_build_pyproject/package.json index 43ce4eee..38630491 100644 --- a/tests/non_build_pyproject/package.json +++ b/tests/non_build_pyproject/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz" + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" } } diff --git a/tests/non_poetry_pyproject/package.json b/tests/non_poetry_pyproject/package.json index 43ce4eee..38630491 100644 --- a/tests/non_poetry_pyproject/package.json +++ b/tests/non_poetry_pyproject/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz" + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" } } diff --git a/tests/pipenv/package.json b/tests/pipenv/package.json index 43ce4eee..38630491 100644 --- a/tests/pipenv/package.json +++ b/tests/pipenv/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz" + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" } } diff --git a/tests/poetry/package.json b/tests/poetry/package.json index 43ce4eee..38630491 100644 --- a/tests/poetry/package.json +++ b/tests/poetry/package.json @@ -9,6 +9,6 @@ "author": "", "license": "ISC", "dependencies": { - "serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz" + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" } } diff --git a/tests/poetry_individually/module1/handler.py b/tests/poetry_individually/module1/handler.py new file mode 100644 index 00000000..5e2e67ff --- /dev/null +++ b/tests/poetry_individually/module1/handler.py @@ -0,0 +1,5 @@ +import requests + + +def hello(event, context): + return requests.get('https://httpbin.org/get').json() diff --git a/tests/poetry_individually/module1/pyproject.toml b/tests/poetry_individually/module1/pyproject.toml new file mode 100644 index 00000000..b813968a --- /dev/null +++ b/tests/poetry_individually/module1/pyproject.toml @@ -0,0 +1,17 @@ +[tool.poetry] +name = "poetry" +version = "0.1.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.6" +Flask = "^1.0" +bottle = {git = "https://git@github.com/bottlepy/bottle.git", tag = "0.12.16"} +boto3 = "^1.9" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" diff --git a/tests/poetry_individually/package.json b/tests/poetry_individually/package.json new file mode 100644 index 00000000..38630491 --- /dev/null +++ b/tests/poetry_individually/package.json @@ -0,0 +1,14 @@ +{ + "name": "example", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz" + } +} diff --git a/tests/poetry_individually/serverless.yml b/tests/poetry_individually/serverless.yml new file mode 100644 index 00000000..32b19964 --- /dev/null +++ b/tests/poetry_individually/serverless.yml @@ -0,0 +1,36 @@ +service: sls-py-req-test + +provider: + name: aws + runtime: python3.6 + +plugins: + - serverless-python-requirements +custom: + pythonRequirements: + zip: ${env:zip, self:custom.defaults.zip} + slim: ${env:slim, self:custom.defaults.slim} + slimPatterns: ${file(./slimPatterns.yml):slimPatterns, self:custom.defaults.slimPatterns} + slimPatternsAppendDefaults: ${env:slimPatternsAppendDefaults, self:custom.defaults.slimPatternsAppendDefaults} + dockerizePip: ${env:dockerizePip, self:custom.defaults.dockerizePip} + defaults: + zip: false + slimPatterns: false + slimPatternsAppendDefaults: true + slim: false + dockerizePip: false + +package: + individually: true + # patterns: + # - '!**/*' + # - 'handler.py' + +functions: + hello: + handler: handler.hello + module: module1 + package: + patterns: + - 'module1/**' + From 47d629a5f686b387387d9fd9f7f4f2e4caa3c86d Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Tue, 1 Mar 2022 17:47:09 -0600 Subject: [PATCH 02/10] Cleanup --- .gitignore | 2 +- lib/pip.js | 7 ------- lib/poetry.js | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index ab0317f3..250f20a0 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ dist/ downloads/ eggs/ .eggs/ -lib/ +# lib/ lib64/ parts/ sdist/ diff --git a/lib/pip.js b/lib/pip.js index 5e5aa9e7..2073d37d 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -59,7 +59,6 @@ function generateRequirementsFile( targetFile, pluginInstance ) { - console.log('generateRequirementsFile', requirementsPath, targetFile) const { serverless, servicePath, options, log } = pluginInstance; const modulePath = path.dirname(requirementsPath) if ( @@ -567,11 +566,8 @@ function copyVendors(vendorFolder, targetFolder, { serverless, log }) { * @param {string} fileName */ function requirementsFileExists(servicePath, options, fileName) { - console.log('requirementsFileExists', servicePath, fileName); - if ( options.usePoetry && - // fse.existsSync(path.join(servicePath, 'pyproject.toml')) && isPoetryProject(path.dirname(fileName)) ) { return true; @@ -608,12 +604,10 @@ async function installRequirementsIfNeeded( // Our source requirements, under our service path, and our module path (if specified) const fileName = path.join(servicePath, modulePath, options.fileName); - console.log("installRequirementsIfNeeded", fileName); await pyprojectTomlToRequirements(modulePath, pluginInstance); // Skip requirements generation, if requirements file doesn't exist if (!requirementsFileExists(servicePath, options, fileName)) { - console.log('Requirements file doesnt exist!'); return false; } @@ -723,7 +717,6 @@ async function installAllRequirements() { // Then if we're going to package functions individually... if (this.serverless.service.package.individually) { - console.log('Doing it individually!') let doneModules = []; const filteredFuncs = this.targetFuncs.filter((func) => (func.runtime || this.serverless.service.provider.runtime).match( diff --git a/lib/poetry.js b/lib/poetry.js index 6b29d056..a5a8ac7d 100644 --- a/lib/poetry.js +++ b/lib/poetry.js @@ -8,7 +8,6 @@ const tomlParse = require('@iarna/toml/parse-string'); /** * poetry install */ -// TODO BW: This should be called on each sub-project. async function pyprojectTomlToRequirements(modulePath, pluginInstance) { const { serverless, servicePath, options, log, progress } = pluginInstance; From 494f51705d998b00f6798dabc71fedd29c6ee37e Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Tue, 1 Mar 2022 17:52:00 -0600 Subject: [PATCH 03/10] Cleanup --- test.js | 2 +- tests/poetry_individually/serverless.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/test.js b/test.js index 7bf754e2..c07d22c7 100644 --- a/test.js +++ b/test.js @@ -1460,7 +1460,7 @@ test( npm(['i', path]); sls(['package'], { env: { } }); - const zipfiles = await listZipFiles('.serverless/module1-sls-py-req-test-dev-hello.zip'); // TODO BW: What is appending -dev- ? + const zipfiles = await listZipFiles('.serverless/module1-sls-py-req-test-dev-hello.zip'); t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged'); t.true(zipfiles.includes(`bottle.py`), 'bottle is packaged'); t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged'); diff --git a/tests/poetry_individually/serverless.yml b/tests/poetry_individually/serverless.yml index 32b19964..5b835a10 100644 --- a/tests/poetry_individually/serverless.yml +++ b/tests/poetry_individually/serverless.yml @@ -22,9 +22,6 @@ custom: package: individually: true - # patterns: - # - '!**/*' - # - 'handler.py' functions: hello: From f969854def138f12ddcfebca5052e8165e851ebf Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Thu, 3 Mar 2022 08:24:25 -0600 Subject: [PATCH 04/10] Run prettier --- index.js | 3 ++- lib/pip.js | 18 ++++-------------- lib/poetry.js | 6 ++---- test.js | 6 ++++-- tests/poetry_individually/serverless.yml | 1 - 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/index.js b/index.js index 04190889..05f2560b 100644 --- a/index.js +++ b/index.js @@ -198,7 +198,8 @@ class ServerlessPythonRequirements { if (!isFunctionRuntimePython(arguments)) { return; } - const _pyprojectTomlToRequirements = () => pyprojectTomlToRequirements('', this); + const _pyprojectTomlToRequirements = () => + pyprojectTomlToRequirements('', this); return BbPromise.bind(this) .then(pipfileToRequirements) .then(_pyprojectTomlToRequirements) diff --git a/lib/pip.js b/lib/pip.js index a019cac3..e4522d51 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -60,16 +60,9 @@ function generateRequirementsFile( pluginInstance ) { const { serverless, servicePath, options, log } = pluginInstance; - const modulePath = path.dirname(requirementsPath) - if ( - options.usePoetry && - isPoetryProject(modulePath) - ) { - filterRequirementsFile( - targetFile, - targetFile, - pluginInstance - ); + const modulePath = path.dirname(requirementsPath); + if (options.usePoetry && isPoetryProject(modulePath)) { + filterRequirementsFile(targetFile, targetFile, pluginInstance); if (log) { log.info(`Parsed requirements.txt from pyproject.toml in ${targetFile}`); } else { @@ -566,10 +559,7 @@ function copyVendors(vendorFolder, targetFolder, { serverless, log }) { * @param {string} fileName */ function requirementsFileExists(servicePath, options, fileName) { - if ( - options.usePoetry && - isPoetryProject(path.dirname(fileName)) - ) { + if (options.usePoetry && isPoetryProject(path.dirname(fileName))) { return true; } diff --git a/lib/poetry.js b/lib/poetry.js index a5a8ac7d..ecf9fc63 100644 --- a/lib/poetry.js +++ b/lib/poetry.js @@ -11,7 +11,7 @@ const tomlParse = require('@iarna/toml/parse-string'); async function pyprojectTomlToRequirements(modulePath, pluginInstance) { const { serverless, servicePath, options, log, progress } = pluginInstance; - moduleProjectPath = path.join(servicePath, modulePath) + moduleProjectPath = path.join(servicePath, modulePath); if (!options.usePoetry || !isPoetryProject(moduleProjectPath)) { return; } @@ -26,9 +26,7 @@ async function pyprojectTomlToRequirements(modulePath, pluginInstance) { ); log.info('Generating requirements.txt from "pyproject.toml"'); } else { - serverless.cli.log( - 'Generating requirements.txt from pyproject.toml...' - ); + serverless.cli.log('Generating requirements.txt from pyproject.toml...'); } try { diff --git a/test.js b/test.js index c07d22c7..2e86787c 100644 --- a/test.js +++ b/test.js @@ -1459,8 +1459,10 @@ test( const path = npm(['pack', '../..']); npm(['i', path]); - sls(['package'], { env: { } }); - const zipfiles = await listZipFiles('.serverless/module1-sls-py-req-test-dev-hello.zip'); + sls(['package'], { env: {} }); + const zipfiles = await listZipFiles( + '.serverless/module1-sls-py-req-test-dev-hello.zip' + ); t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged'); t.true(zipfiles.includes(`bottle.py`), 'bottle is packaged'); t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged'); diff --git a/tests/poetry_individually/serverless.yml b/tests/poetry_individually/serverless.yml index 5b835a10..2cb2d160 100644 --- a/tests/poetry_individually/serverless.yml +++ b/tests/poetry_individually/serverless.yml @@ -30,4 +30,3 @@ functions: package: patterns: - 'module1/**' - From b6845aeba3cc46776834c5c159c898e5a100291a Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Thu, 3 Mar 2022 10:58:17 -0600 Subject: [PATCH 05/10] Add `const` to variable decl. --- lib/poetry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/poetry.js b/lib/poetry.js index ecf9fc63..4003c1df 100644 --- a/lib/poetry.js +++ b/lib/poetry.js @@ -11,7 +11,7 @@ const tomlParse = require('@iarna/toml/parse-string'); async function pyprojectTomlToRequirements(modulePath, pluginInstance) { const { serverless, servicePath, options, log, progress } = pluginInstance; - moduleProjectPath = path.join(servicePath, modulePath); + const moduleProjectPath = path.join(servicePath, modulePath); if (!options.usePoetry || !isPoetryProject(moduleProjectPath)) { return; } From 3b7a5d13b510045084bcd9338a6ca2ea0e213821 Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Tue, 8 Mar 2022 10:12:33 -0600 Subject: [PATCH 06/10] Code-review feedback changes --- .gitignore | 1 - index.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 250f20a0..3707ff1e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,6 @@ dist/ downloads/ eggs/ .eggs/ -# lib/ lib64/ parts/ sdist/ diff --git a/index.js b/index.js index 05f2560b..0b1dcb17 100644 --- a/index.js +++ b/index.js @@ -198,11 +198,9 @@ class ServerlessPythonRequirements { if (!isFunctionRuntimePython(arguments)) { return; } - const _pyprojectTomlToRequirements = () => - pyprojectTomlToRequirements('', this); return BbPromise.bind(this) .then(pipfileToRequirements) - .then(_pyprojectTomlToRequirements) + .then(() => pyprojectTomlToRequirements('', this)) .then(addVendorHelper) .then(installAllRequirements) .then(packRequirements) From 560ded58005a84ce23a4a7a8f1024ca0d9d9e860 Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Tue, 8 Mar 2022 13:15:33 -0600 Subject: [PATCH 07/10] Disable Validate commit messages --- .github/workflows/validate.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b4c245f5..e1dce885 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -75,9 +75,9 @@ jobs: run: npm run prettier-check:updated - name: Validate ESLint rules run: npm run lint:updated - - name: Validate commit messages - if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - run: npx commitlint -f master + # - name: Validate commit messages + # if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id + # run: npx commitlint -f master - name: Validate changelog (if new version) run: | NEW_VERSION=`git diff -U0 master package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || : From 79d1c848374ea14ea7b55895a9d0928f12647165 Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Fri, 11 Mar 2022 11:33:24 -0600 Subject: [PATCH 08/10] Remove pyprojectTomlToRequirements call from top-level flow. --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 2bc0f54d..9e7b54de 100644 --- a/index.js +++ b/index.js @@ -203,7 +203,6 @@ class ServerlessPythonRequirements { } return BbPromise.bind(this) .then(pipfileToRequirements) - .then(() => pyprojectTomlToRequirements('', this)) .then(addVendorHelper) .then(installAllRequirements) .then(packRequirements) From 940b039764cc09bd50ec1d3b17d76fc4f4cc46de Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Fri, 11 Mar 2022 11:35:51 -0600 Subject: [PATCH 09/10] Remove unused import --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 9e7b54de..ebfc4017 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,6 @@ const { injectAllRequirements } = require('./lib/inject'); const { layerRequirements } = require('./lib/layer'); const { installAllRequirements } = require('./lib/pip'); const { pipfileToRequirements } = require('./lib/pipenv'); -const { pyprojectTomlToRequirements } = require('./lib/poetry'); const { cleanup, cleanupCache } = require('./lib/clean'); BbPromise.promisifyAll(fse); From 3b102f642eb70f72ba4492a94841f64d289f611b Mon Sep 17 00:00:00 2001 From: BrandonLWhite Date: Mon, 14 Mar 2022 08:52:58 -0500 Subject: [PATCH 10/10] Revert "Disable Validate commit messages" --- .github/workflows/validate.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e1dce885..b4c245f5 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -75,9 +75,9 @@ jobs: run: npm run prettier-check:updated - name: Validate ESLint rules run: npm run lint:updated - # - name: Validate commit messages - # if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - # run: npx commitlint -f master + - name: Validate commit messages + if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id + run: npx commitlint -f master - name: Validate changelog (if new version) run: | NEW_VERSION=`git diff -U0 master package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :