New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amplify-python-function-runtime-provider

Package Overview
Dependencies
Maintainers
1
Versions
702
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplify-python-function-runtime-provider - npm Package Compare versions

Comparing version 1.3.2-alpha.23 to 1.3.2-beta.1

23

CHANGELOG.md

@@ -6,2 +6,25 @@ # Change Log

## [1.3.2-beta.1](https://github.com/aws-amplify/amplify-cli/compare/amplify-python-function-runtime-provider@1.3.2-beta.0...amplify-python-function-runtime-provider@1.3.2-beta.1) (2020-11-07)
**Note:** Version bump only for package amplify-python-function-runtime-provider
## [1.3.2-beta.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-python-function-runtime-provider@1.3.1...amplify-python-function-runtime-provider@1.3.2-beta.0) (2020-11-07)
# 4.34.0-alpha.0 (2020-11-02)
### Bug Fixes
* [#5662](https://github.com/aws-amplify/amplify-cli/issues/5662) - python fallback from python3 ([#5744](https://github.com/aws-amplify/amplify-cli/issues/5744)) ([6143e4b](https://github.com/aws-amplify/amplify-cli/commit/6143e4bf6f27a6bfc62196be9a85dffe1f23ef50))
## [1.3.1](https://github.com/aws-amplify/amplify-cli/compare/amplify-python-function-runtime-provider@1.3.0...amplify-python-function-runtime-provider@1.3.1) (2020-10-27)

@@ -8,0 +31,0 @@

28

lib/util/depUtils.js

@@ -7,3 +7,3 @@ "use strict";

const minPyVersion = semver_1.coerce('3.8');
const pythonErrMsg = 'You must have python >= 3.8 installed and available on your PATH as "python3". It can be installed from https://www.python.org/downloads';
const pythonErrMsg = 'You must have python >= 3.8 installed and available on your PATH as "python3" or "python". It can be installed from https://www.python.org/downloads';
const pipenvErrMsg = 'You must have pipenv installed and available on your PATH as "pipenv". It can be installed by running "pip3 install --user pipenv".';

@@ -13,15 +13,21 @@ async function checkDeps() {

let errMsg = '';
let pyVersionStr;
try {
pyVersionStr = await pyUtils_1.execAsStringPromise('python3 --version');
const pyVersion = semver_1.coerce(pyVersionStr);
if (!pyVersion || semver_1.lt(pyVersion, minPyVersion)) {
const pyBinary = pyUtils_1.getPythonBinaryName();
if (!pyBinary) {
hasDeps = false;
errMsg = `Could not find "python3" or "python" executable in the PATH.`;
}
else {
try {
const pyVersionStr = await pyUtils_1.execAsStringPromise(`${pyBinary} --version`);
const pyVersion = semver_1.coerce(pyVersionStr);
if (!pyVersion || semver_1.lt(pyVersion, minPyVersion)) {
hasDeps = false;
errMsg = `${pyBinary} found but version ${pyVersionStr} is less than the minimum required version.\n${pythonErrMsg}`;
}
}
catch (err) {
hasDeps = false;
errMsg = `python3 found but version ${pyVersionStr} is less than the minimum required version.\n${pythonErrMsg}`;
errMsg = `Error executing ${pyBinary}\n${pythonErrMsg}`;
}
}
catch (err) {
hasDeps = false;
errMsg = `Error executing python3\n${pythonErrMsg}`;
}
try {

@@ -28,0 +34,0 @@ await pyUtils_1.execAsStringPromise('pipenv --version');

@@ -11,2 +11,3 @@ "use strict";

const constants_1 = require("../constants");
const pyUtils_1 = require("./pyUtils");
const shimPath = path_1.default.join(amplify_cli_core_1.pathManager.getAmplifyPackageLibDirPath(constants_1.packageName), constants_1.relativeShimPath);

@@ -17,3 +18,7 @@ async function pythonInvoke(context, request) {

const handlerName = handlerParts.ext.replace('.', '');
const childProcess = execa_1.default('pipenv', ['run', 'python3', shimPath, handlerFile + '.py', handlerName]);
const pyBinary = pyUtils_1.getPythonBinaryName();
if (!pyBinary) {
throw new Error(`Could not find 'python3' or 'python' executable in the PATH.`);
}
const childProcess = execa_1.default('pipenv', ['run', pyBinary, shimPath, handlerFile + '.py', handlerName]);
childProcess.stdout.pipe(process.stdout);

@@ -20,0 +25,0 @@ childProcess.stdin.write(JSON.stringify({ event: request.event, context: {} }) + '\n');

@@ -6,2 +6,3 @@ /// <reference types="node" />

export declare function execAsStringPromise(command: string, opts?: ExecOptions): Promise<string>;
export declare const getPythonBinaryName: () => string | undefined;
//# sourceMappingURL=pyUtils.d.ts.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,9 +25,14 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.execAsStringPromise = exports.majMinPyVersion = exports.getPipenvDir = void 0;
exports.getPythonBinaryName = exports.execAsStringPromise = exports.majMinPyVersion = exports.getPipenvDir = void 0;
const path_1 = __importDefault(require("path"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const execa_1 = __importDefault(require("execa"));
const which = __importStar(require("which"));
async function getPipenvDir(srcRoot) {
const pipEnvDir = await execAsStringPromise('pipenv --venv', { cwd: srcRoot });
const pyVersion = await execAsStringPromise('python3 --version');
const pyBinary = exports.getPythonBinaryName();
if (!pyBinary) {
throw new Error(`Could not find 'python3' or 'python' executable in the PATH.`);
}
const pyVersion = await execAsStringPromise(`${pyBinary} --version`);
let pipEnvPath = path_1.default.join(pipEnvDir, 'lib', 'python' + majMinPyVersion(pyVersion), 'site-packages');

@@ -48,2 +72,14 @@ if (process.platform.startsWith('win')) {

exports.execAsStringPromise = execAsStringPromise;
exports.getPythonBinaryName = () => {
const executables = ['python3', 'python'];
let executablePath;
for (const executable of executables) {
executablePath = which.sync(executable, {
nothrow: true,
});
if (executablePath !== null) {
return executable;
}
}
};
//# sourceMappingURL=pyUtils.js.map
{
"name": "amplify-python-function-runtime-provider",
"version": "1.3.2-alpha.23+85c9c9314",
"version": "1.3.2-beta.1",
"description": "Provides functionality related to functions in Python on AWS",

@@ -24,8 +24,9 @@ "repository": {

"dependencies": {
"amplify-cli-core": "1.5.2-alpha.23+85c9c9314",
"amplify-function-plugin-interface": "1.4.2-alpha.174+85c9c9314",
"amplify-cli-core": "1.6.0-beta.1",
"amplify-function-plugin-interface": "1.4.2-beta.0",
"archiver": "^3.1.1",
"execa": "^4.0.0",
"glob": "^7.1.6",
"semver": "^7.1.3"
"semver": "^7.1.3",
"which": "^2.0.2"
},

@@ -37,3 +38,3 @@ "devDependencies": {

},
"gitHead": "85c9c931408cc9ac3bd93f36481181829b882753"
"gitHead": "d7387d83be432f014cfc37a41f7fc2adf1b527e3"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc