Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nxlv/python

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nxlv/python - npm Package Compare versions

Comparing version 15.0.2 to 15.1.0

9

CHANGELOG.md

@@ -1,10 +0,1 @@

# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## [15.0.2] - 2023-01-11

@@ -11,0 +2,0 @@

5

package.json
{
"name": "@nxlv/python",
"description": "Custom NX Plugin to support the Python language",
"version": "15.0.2",
"version": "15.1.0",
"main": "src/index.js",

@@ -11,3 +11,4 @@ "generators": "./generators.json",

"type": "git",
"url": "git@github.com:lucasvieirasilva/nx-plugins.git"
"url": "git@github.com:lucasvieirasilva/nx-plugins.git",
"directory": "packages/nx-python"
},

@@ -14,0 +15,0 @@ "peerDependencies": {

6

README.md
# @nxlv/python
![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/lucasvieirasilva/64d6f926915811aa067f60e6a70735c8/raw/coverage-packages-nx-python.json)
`@nxlv/python` plugin is designed to extend the Nx features to work with Python projects based on Poetry.

@@ -7,6 +9,2 @@

## What is Nx
🔎 Extensible Dev Tools for Monorepos.
## What is @nxlv/python

@@ -13,0 +11,0 @@

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

.concat(options.args ? options.args.split(' ') : [])
.concat(options.extras ? options.extras.map(ex => `--extras=${ex}`) : [])
.concat(options.extras ? options.extras.map((ex) => `--extras=${ex}`) : [])
.concat(rootPyprojectToml ? ['--lock'] : []);

@@ -30,0 +30,0 @@ const installCommand = `${poetry_1.POETRY_EXECUTABLE} ${installArgs.join(' ')}`;

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

shell: false,
stdio: 'inherit'
stdio: 'inherit',
});

@@ -79,4 +79,4 @@ (0, fs_extra_1.rmSync)(options.outputPath, { recursive: true, force: true });

dev: {
dependencies: {}
}
dependencies: {},
},
};

@@ -108,7 +108,7 @@ if (pythonDependency) {

const lockData = (0, toml_1.parse)((0, fs_extra_1.readFileSync)((0, path_1.join)(root, 'poetry.lock')).toString('utf-8'));
const requerimentsLines = requerimentsTxt.split("\n");
const requerimentsLines = requerimentsTxt.split('\n');
for (const line of requerimentsLines) {
if (line.trim()) {
const dep = {};
const elements = line.split(";");
const elements = line.split(';');
if (elements[0].includes('@')) {

@@ -132,3 +132,3 @@ const atPosition = elements[0].indexOf('@');

}
const lockedPkg = lockData.package.find(pkg => pkg.name.toLowerCase() === dep.name.toLowerCase());
const lockedPkg = lockData.package.find((pkg) => pkg.name.toLowerCase() === dep.name.toLowerCase());
if (!lockedPkg) {

@@ -144,3 +144,3 @@ throw new Error((0, chalk_1.default) `Package {blue.bold ${dep.name}} not found in poetry.lock`);

const originalExtraDeps = buildTomlData.tool.poetry.extras[extra];
const lockedDeps = originalExtraDeps.map(dep => lockData.package.find(pkg => pkg.name === dep));
const lockedDeps = originalExtraDeps.map((dep) => lockData.package.find((pkg) => pkg.name === dep));
const resolvedDeps = resolveExtrasLockedDependencyTree(lockData, lockedDeps, level);

@@ -167,3 +167,3 @@ logger.info((0, chalk_1.default) `${tab}• Extra: {blue.bold ${extra}} - {blue.bold ${resolvedDeps.join(', ')}} Locked Dependencies`);

if (extras.length > 0) {
extras.forEach(extra => {
extras.forEach((extra) => {
exportArgs.push('--extras');

@@ -176,3 +176,3 @@ exportArgs.push(extra);

shell: false,
stdio: 'inherit'
stdio: 'inherit',
});

@@ -183,8 +183,11 @@ return (0, fs_extra_1.readFileSync)(outputPath, { encoding: 'utf-8' });

if (dep.name.indexOf('[') !== -1) {
dep.extras = dep.name.substring(dep.name.indexOf("[") + 1, dep.name.lastIndexOf("]")).split(',').map(extraName => extraName.trim());
dep.name = dep.name.substring(0, dep.name.indexOf("["));
dep.extras = dep.name
.substring(dep.name.indexOf('[') + 1, dep.name.lastIndexOf(']'))
.split(',')
.map((extraName) => extraName.trim());
dep.name = dep.name.substring(0, dep.name.indexOf('['));
}
}
function getLoggingTab(level) {
return " ".repeat(level);
return ' '.repeat(level);
}

@@ -201,7 +204,9 @@ function resolveExtrasLockedDependencyTree(lockData, deps, level, resolvedDeps = []) {

const optionalPkgDeps = pkgDeps
.map(depName => lockData.package.find(pkg => pkg.name === depName && pkg.optional))
.filter(pkgDep => pkgDep !== undefined && !resolvedDeps.includes(pkgDep.name));
optionalPkgDeps.forEach(pkgDep => (resolvedDeps.push(pkgDep.name)));
.map((depName) => lockData.package.find((pkg) => pkg.name === depName && pkg.optional))
.filter((pkgDep) => pkgDep !== undefined && !resolvedDeps.includes(pkgDep.name));
optionalPkgDeps.forEach((pkgDep) => resolvedDeps.push(pkgDep.name));
if (optionalPkgDeps.length > 0) {
logger.info((0, chalk_1.default) `${tab}• Resolved Dependencies: {blue.bold ${optionalPkgDeps.map(pkgDep => pkgDep.name).join(' ')}}`);
logger.info((0, chalk_1.default) `${tab}• Resolved Dependencies: {blue.bold ${optionalPkgDeps
.map((pkgDep) => pkgDep.name)
.join(' ')}}`);
}

@@ -232,3 +237,4 @@ resolveExtrasLockedDependencyTree(lockData, optionalPkgDeps, level, resolvedDeps);

for (const pluginName in tomlData.tool.poetry.plugins) {
buildTomlData.tool.poetry.plugins[pluginName] = tomlData.tool.poetry.plugins[pluginName];
buildTomlData.tool.poetry.plugins[pluginName] =
tomlData.tool.poetry.plugins[pluginName];
}

@@ -235,0 +241,0 @@ }

export interface BuildExecutorSchema {
silent: boolean;
ignorePaths: string[]
ignorePaths: string[];
outputPath: string;

@@ -5,0 +5,0 @@ keepBuildFolder: boolean;

export interface Flake8ExecutorSchema {
outputFile: string
silent: boolean
outputFile: string;
silent: boolean;
}

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

shell: false,
cwd: projectConfig.root
cwd: projectConfig.root,
};

@@ -34,0 +34,0 @@ if (options.cacheDir) {

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

}
const whlFile = (0, fs_extra_1.readdirSync)(distFolder).find(file => file.endsWith('.whl'));
const whlFile = (0, fs_extra_1.readdirSync)(distFolder).find((file) => file.endsWith('.whl'));
if (!whlFile) {

@@ -26,0 +26,0 @@ throw new Error(`No .whl file found in dist folder: ${distFolder}`);

export interface ExecutorSchema {
stage: string
verbose: boolean
force: boolean
stage: string;
verbose: boolean;
force: boolean;
}

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

}
const whlFile = (0, fs_extra_1.readdirSync)(distFolder).find(file => file.endsWith('.whl'));
const whlFile = (0, fs_extra_1.readdirSync)(distFolder).find((file) => file.endsWith('.whl'));
if (!whlFile) {

@@ -34,3 +34,3 @@ throw new Error(`No .whl file found in dist folder: ${distFolder}`);

shell: false,
stdio: 'inherit'
stdio: 'inherit',
});

@@ -37,0 +37,0 @@ if (result.status !== 0) {

export interface ExecutorSchema {
stage: string
stage: string;
}

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

outputPath: distFolder,
devDependencies: true
devDependencies: true,
}, context);

@@ -29,0 +29,0 @@ if (!buildResult.success) {

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

const updateLockArgs = ['update', projectName].concat(updateLockOnly ? ['--lock'] : []);
const updateLockCommand = `${exports.POETRY_EXECUTABLE} ${updateLockArgs.join(" ")}`;
const updateLockCommand = `${exports.POETRY_EXECUTABLE} ${updateLockArgs.join(' ')}`;
console.log((0, chalk_1.default) `{bold Running command}: ${updateLockCommand} at {bold ${cwd}} folder\n`);

@@ -46,0 +46,0 @@ cross_spawn_1.default.sync(exports.POETRY_EXECUTABLE, updateLockArgs, {

@@ -18,3 +18,5 @@ "use strict";

const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
const moduleName = options.moduleName ? options.moduleName : projectName.replace(new RegExp('-', 'g'), '_');
const moduleName = options.moduleName
? options.moduleName
: projectName.replace(new RegExp('-', 'g'), '_');
let projectRoot = '';

@@ -21,0 +23,0 @@ if (options.type === 'application') {

@@ -51,3 +51,4 @@ "use strict";

const tomlData = getPyprojectData(pyprojectToml);
return isProjectDependent(tomlData.tool.poetry.dependencies, projectData, root, cwd) || isProjectDependent((_a = tomlData.tool.poetry.group) === null || _a === void 0 ? void 0 : _a.dev.dependencies, projectData, root, cwd);
return (isProjectDependent(tomlData.tool.poetry.dependencies, projectData, root, cwd) ||
isProjectDependent((_a = tomlData.tool.poetry.group) === null || _a === void 0 ? void 0 : _a.dev.dependencies, projectData, root, cwd));
}

@@ -73,3 +74,4 @@ return false;

const depAbsPath = path_1.default.resolve(projectData.root, depData.path);
const depProjectName = Object.keys(workspace.projects).find((proj) => path_1.default.normalize(workspace.projects[proj].root) === path_1.default.normalize(path_1.default.relative(cwd, depAbsPath)));
const depProjectName = Object.keys(workspace.projects).find((proj) => path_1.default.normalize(workspace.projects[proj].root) ===
path_1.default.normalize(path_1.default.relative(cwd, depAbsPath)));
deps.push({ name: depProjectName, category });

@@ -76,0 +78,0 @@ }

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

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

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