Skip to content

Commit 117b26c

Browse files
committed
feat: add support for pyproject.toml via uv & poetry
1 parent 7144952 commit 117b26c

23 files changed

Lines changed: 3105 additions & 4 deletions

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
run: |
6161
echo "python-bin-location=$(echo $pythonLocation)/bin" >> $GITHUB_OUTPUT
6262
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v6
65+
66+
- name: Install Poetry
67+
run: pipx install poetry
68+
6369
- name: setup go
6470
uses: actions/setup-go@v6
6571
with:

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export {
7474
* TRUSTIFY_DA_CONTINUE_ON_ERROR?: string | undefined,
7575
* batchMetadata?: boolean | undefined,
7676
* TRUSTIFY_DA_BATCH_METADATA?: string | undefined,
77+
* TRUSTIFY_DA_UV_PATH?: string | undefined,
78+
* TRUSTIFY_DA_POETRY_PATH?: string | undefined,
7779
* [key: string]: string | number | boolean | string[] | undefined,
7880
* }} Options
7981
*/

src/provider.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Javascript_npm from './providers/javascript_npm.js';
88
import Javascript_pnpm from './providers/javascript_pnpm.js';
99
import Javascript_yarn from './providers/javascript_yarn.js';
1010
import pythonPipProvider from './providers/python_pip.js'
11+
import pythonPyprojectProvider from './providers/python_pyproject.js'
1112
import rustCargoProvider from './providers/rust_cargo.js'
1213

1314
/** @typedef {{ecosystem: string, contentType: string, content: string}} Provided */
@@ -26,6 +27,7 @@ export const availableProviders = [
2627
new Javascript_npm(),
2728
golangGomodulesProvider,
2829
pythonPipProvider,
30+
pythonPyprojectProvider,
2931
rustCargoProvider]
3032

3133
/**

src/providers/python_pip.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function addAllDependencies(source, dep, sbom) {
8787
sbom.addDependency(source, targetPurl)
8888
let directDeps = dep["dependencies"]
8989
if (directDeps !== undefined && directDeps.length > 0) {
90-
directDeps.forEach((dependency) => { addAllDependencies(toPurl(dep["name"],dep["version"]), dependency, sbom) })
90+
directDeps.forEach((dependency) => { addAllDependencies(toPurl(dep["name"], dep["version"]), dependency, sbom) })
9191
}
9292
}
9393

@@ -123,7 +123,7 @@ async function getIgnoredDependencies(manifest) {
123123
async function handleIgnoredDependencies(manifest, sbom, opts = {}) {
124124
let ignoredDeps = await getIgnoredDependencies(manifest)
125125
let matchManifestVersions = getCustom("MATCH_MANIFEST_VERSIONS", "true", opts);
126-
if(matchManifestVersions === "true") {
126+
if (matchManifestVersions === "true") {
127127
const ignoredDepsVersion = ignoredDeps.filter(dep => dep.version !== undefined);
128128
sbom.filterIgnoredDepsIncludingVersion(ignoredDepsVersion.map(dep => dep.toString()))
129129
} else {
@@ -150,7 +150,7 @@ function getPythonPipBinaries(binaries, opts) {
150150
invokeCommand(python, ['--version'])
151151
invokeCommand(pip, ['--version'])
152152
} catch (error) {
153-
throw new Error(`Failed checking for python/pip binaries from supplied environment variables`, {cause: error})
153+
throw new Error(`Failed checking for python/pip binaries from supplied environment variables`, { cause: error })
154154
}
155155
}
156156
binaries.pip = pip
@@ -240,6 +240,6 @@ async function getSbomForComponentAnalysis(manifest, opts = {}) {
240240
* @param version
241241
* @return {PackageURL}
242242
*/
243-
function toPurl(name,version) {
243+
function toPurl(name, version) {
244244
return new PackageURL('pypi', undefined, name, version, undefined, undefined);
245245
}

0 commit comments

Comments
 (0)