Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
run: |
echo "python-bin-location=$(echo $pythonLocation)/bin" >> $GITHUB_OUTPUT

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install Poetry
run: pipx install poetry

- name: setup go
uses: actions/setup-go@v6
with:
Expand Down
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ $ trustify-da-javascript-client license /path/to/package.json
<li><a href="https://www.javascript.com/">JavaScript</a> - <a href="https://pnpm.io/">pnpm</a></li>
<li><a href="https://www.javascript.com/">JavaScript</a> - <a href="https://classic.yarnpkg.com/">Yarn Classic</a> / <a href="https://yarnpkg.com/">Yarn Berry</a></li>
<li><a href="https://go.dev/">Golang</a> - <a href="https://go.dev/blog/using-go-modules/">Go Modules</a></li>
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a></li>
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a> (<code>requirements.txt</code>)</li>
<li><a href="https://www.python.org/">Python</a> - <a href="https://python-poetry.org/">Poetry</a> / <a href="https://docs.astral.sh/uv/">uv</a> (<code>pyproject.toml</code>)</li>
<li><a href="https://gradle.org/">Gradle (Groovy and Kotlin DSL)</a> - <a href="https://gradle.org/install/">Gradle Installation</a></li>
<li><a href="https://www.rust-lang.org/">Rust</a> - <a href="https://doc.rust-lang.org/cargo/">Cargo</a></li>
</ul>
Expand Down Expand Up @@ -391,7 +392,30 @@ version = "1.10"
log = "0.4" # trustify-da-ignore
```

All of the 6 above examples are valid for marking a package to be ignored

<em>Python pyproject.toml</em> users can add a comment with <code>#exhortignore</code> (or <code># trustify-da-ignore</code>) next to the dependency in <code>pyproject.toml</code>.

PEP 621 style (<code>[project]</code> dependencies):
```toml
[project]
dependencies = [
"flask>=2.0.3",
"requests>=2.25.1",
"uvicorn>=0.17.0", #exhortignore
"click>=8.0.4", # trustify-da-ignore
]
```

Poetry style (<code>[tool.poetry.dependencies]</code>):
```toml
[tool.poetry.dependencies]
flask = "^2.0.3"
requests = "^2.25.1"
uvicorn = "^0.17.0" #exhortignore
click = "^8.0.4" # trustify-da-ignore
```

All of the above examples are valid for marking a package to be ignored
</li>
</ul>

Expand Down Expand Up @@ -421,6 +445,8 @@ let options = {
'TRUSTIFY_DA_PIP3_PATH' : '/path/to/pip3',
'TRUSTIFY_DA_PYTHON_PATH' : '/path/to/python',
'TRUSTIFY_DA_PIP_PATH' : '/path/to/pip',
'TRUSTIFY_DA_UV_PATH' : '/path/to/uv',
'TRUSTIFY_DA_POETRY_PATH' : '/path/to/poetry',
'TRUSTIFY_DA_GRADLE_PATH' : '/path/to/gradle',
'TRUSTIFY_DA_CARGO_PATH' : '/path/to/cargo',
// Workspace root for monorepos (Cargo, npm/pnpm/yarn); lock file expected here
Expand Down Expand Up @@ -567,6 +593,16 @@ following keys for setting custom paths for the said executables.
<td>TRUSTIFY_DA_CARGO_PATH</td>
</tr>
<tr>
<td><a href="https://docs.astral.sh/uv/">uv</a></td>
<td><em>uv</em></td>
<td>TRUSTIFY_DA_UV_PATH</td>
</tr>
<tr>
<td><a href="https://python-poetry.org/">Poetry</a></td>
<td><em>poetry</em></td>
<td>TRUSTIFY_DA_POETRY_PATH</td>
</tr>
<tr>
<td>Workspace root (monorepos)</td>
<td>—</td>
<td>workspaceDir / TRUSTIFY_DA_WORKSPACE_DIR</td>
Expand Down Expand Up @@ -619,6 +655,24 @@ TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED=false

#### Python Support

The client supports two Python manifest formats:

- **`requirements.txt`** — uses pip/pip3 to resolve dependencies
- **`pyproject.toml`** — uses [uv](https://docs.astral.sh/uv/) or [Poetry](https://python-poetry.org/) to resolve dependencies

##### pyproject.toml

For `pyproject.toml` projects, the client detects which tool manages the project by checking for lock files:
- If `poetry.lock` is present and `[tool.poetry]` is defined, **Poetry** is used (`poetry show --tree` and `poetry show --all`)
- If `uv.lock` is present, **uv** is used (`uv export --format requirements.txt --frozen --no-hashes`)
- If neither lock file is found, an error is thrown

Both PEP 621 (`[project]` dependencies) and Poetry-style (`[tool.poetry.dependencies]`) are supported.

Custom executable paths can be set via `TRUSTIFY_DA_UV_PATH` and `TRUSTIFY_DA_POETRY_PATH`.

##### requirements.txt

By default, For python support, the api assumes that the package is installed using the pip/pip3 binary on the system PATH, or using the customized
Binaries passed to environment variables. In any case, If the package is not installed , then an error will be thrown.

Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export {
* TRUSTIFY_DA_CONTINUE_ON_ERROR?: string | undefined,
* batchMetadata?: boolean | undefined,
* TRUSTIFY_DA_BATCH_METADATA?: string | undefined,
* TRUSTIFY_DA_UV_PATH?: string | undefined,
* TRUSTIFY_DA_POETRY_PATH?: string | undefined,
* [key: string]: string | number | boolean | string[] | undefined,
* }} Options
*/
Expand Down
4 changes: 4 additions & 0 deletions src/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Javascript_npm from './providers/javascript_npm.js';
import Javascript_pnpm from './providers/javascript_pnpm.js';
import Javascript_yarn from './providers/javascript_yarn.js';
import pythonPipProvider from './providers/python_pip.js'
import Python_poetry from './providers/python_poetry.js'
import Python_uv from './providers/python_uv.js'
import rustCargoProvider from './providers/rust_cargo.js'

/** @typedef {{ecosystem: string, contentType: string, content: string}} Provided */
Expand All @@ -26,6 +28,8 @@ export const availableProviders = [
new Javascript_npm(),
golangGomodulesProvider,
pythonPipProvider,
new Python_poetry(),
new Python_uv(),
rustCargoProvider]

/**
Expand Down
Loading
Loading