Skip to content

Commit f1c77d0

Browse files
authored
Merge branch 'main' into TC-3993
2 parents 1abd8f8 + 38515a7 commit f1c77d0

73 files changed

Lines changed: 7830 additions & 4659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.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:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ unit-tests-result.json
99
build
1010
target
1111
.npmrc
12-
src/providers/tree-sitter-requirements.wasm
12+
src/providers/*.wasm

README.md

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ $ trustify-da-javascript-client license /path/to/package.json
224224
<li><a href="https://www.javascript.com/">JavaScript</a> - <a href="https://pnpm.io/">pnpm</a></li>
225225
<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>
226226
<li><a href="https://go.dev/">Golang</a> - <a href="https://go.dev/blog/using-go-modules/">Go Modules</a></li>
227-
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a></li>
227+
<li><a href="https://www.python.org/">Python</a> - <a href="https://pypi.org/project/pip/">pip Installer</a> (<code>requirements.txt</code>)</li>
228+
<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>
228229
<li><a href="https://gradle.org/">Gradle (Groovy and Kotlin DSL)</a> - <a href="https://gradle.org/install/">Gradle Installation</a></li>
229230
<li><a href="https://www.rust-lang.org/">Rust</a> - <a href="https://doc.rust-lang.org/cargo/">Cargo</a></li>
230231
</ul>
@@ -287,8 +288,11 @@ Excluding a package from any analysis can be achieved by marking the package for
287288
]
288289
}
289290
```
291+
</li>
292+
293+
<li>
294+
<em>Golang</em> users can add in go.mod a comment with <code>// exhortignore</code> next to the package to be ignored, or to "piggyback" on existing comment ( e.g - <code>// indirect</code>), for example:
290295
291-
<em>Golang</em> users can add in go.mod a comment with //exhortignore next to the package to be ignored, or to "piggyback" on existing comment ( e.g - //indirect) , for example:
292296
```go
293297
module github.com/trustify-da/SaaSi/deployer
294298
@@ -297,22 +301,28 @@ go 1.19
297301
require (
298302
github.com/gin-gonic/gin v1.9.1
299303
github.com/google/uuid v1.1.2
300-
github.com/jessevdk/go-flags v1.5.0 //exhortignore
304+
github.com/jessevdk/go-flags v1.5.0 // exhortignore
301305
github.com/kr/pretty v0.3.1
302306
gopkg.in/yaml.v2 v2.4.0
303307
k8s.io/apimachinery v0.26.1
304308
k8s.io/client-go v0.26.1
305309
)
306310
307311
require (
308-
github.com/davecgh/go-spew v1.1.1 // indirect exhortignore
312+
github.com/davecgh/go-spew v1.1.1 // indirect; exhortignore
309313
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
310-
github.com/go-logr/logr v1.2.3 // indirect //exhortignore
314+
github.com/go-logr/logr v1.2.3 // indirect; exhortignore
311315
312316
)
313317
```
314318
319+
<b>NOTE</b>: It is important to format <code>exhortignore</code> markers on indirect dependencies as shown above, otherwise the Go tooling (as well as this library) may incorrectly parse dependencies marked as indirect as being direct dependencies instead.
320+
</li>
321+
322+
323+
<li>
315324
<em>Python pip</em> users can add in requirements.txt a comment with #exhortignore(or # exhortignore) to the right of the same artifact to be ignored, for example:
325+
316326
```properties
317327
anyio==3.6.2
318328
asgiref==3.4.1
@@ -343,11 +353,14 @@ Werkzeug==2.0.3
343353
zipp==3.6.0
344354
345355
```
356+
</li>
346357
358+
<li>
347359
<em>Gradle</em> users can add in build.gradle a comment with //exhortignore next to the package to be ignored:
360+
348361
```build.gradle
349362
plugins {
350-
id 'java'
363+
id 'java'
351364
}
352365
353366
group = 'groupName'
@@ -379,9 +392,31 @@ version = "1.10"
379392
log = "0.4" # trustify-da-ignore
380393
```
381394
382-
All of the 6 above examples are valid for marking a package to be ignored
383-
</li>
384395
396+
<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>.
397+
398+
PEP 621 style (<code>[project]</code> dependencies):
399+
```toml
400+
[project]
401+
dependencies = [
402+
"flask>=2.0.3",
403+
"requests>=2.25.1",
404+
"uvicorn>=0.17.0", #exhortignore
405+
"click>=8.0.4", # trustify-da-ignore
406+
]
407+
```
408+
409+
Poetry style (<code>[tool.poetry.dependencies]</code>):
410+
```toml
411+
[tool.poetry.dependencies]
412+
flask = "^2.0.3"
413+
requests = "^2.25.1"
414+
uvicorn = "^0.17.0" #exhortignore
415+
click = "^8.0.4" # trustify-da-ignore
416+
```
417+
418+
All of the above examples are valid for marking a package to be ignored
419+
</li>
385420
</ul>
386421
387422
<h3>Customization</h3>
@@ -410,6 +445,8 @@ let options = {
410445
'TRUSTIFY_DA_PIP3_PATH' : '/path/to/pip3',
411446
'TRUSTIFY_DA_PYTHON_PATH' : '/path/to/python',
412447
'TRUSTIFY_DA_PIP_PATH' : '/path/to/pip',
448+
'TRUSTIFY_DA_UV_PATH' : '/path/to/uv',
449+
'TRUSTIFY_DA_POETRY_PATH' : '/path/to/poetry',
413450
'TRUSTIFY_DA_GRADLE_PATH' : '/path/to/gradle',
414451
'TRUSTIFY_DA_CARGO_PATH' : '/path/to/cargo',
415452
// Workspace root for monorepos (Cargo, npm/pnpm/yarn); lock file expected here
@@ -556,6 +593,16 @@ following keys for setting custom paths for the said executables.
556593
<td>TRUSTIFY_DA_CARGO_PATH</td>
557594
</tr>
558595
<tr>
596+
<td><a href="https://docs.astral.sh/uv/">uv</a></td>
597+
<td><em>uv</em></td>
598+
<td>TRUSTIFY_DA_UV_PATH</td>
599+
</tr>
600+
<tr>
601+
<td><a href="https://python-poetry.org/">Poetry</a></td>
602+
<td><em>poetry</em></td>
603+
<td>TRUSTIFY_DA_POETRY_PATH</td>
604+
</tr>
605+
<tr>
559606
<td>Workspace root (monorepos)</td>
560607
<td></td>
561608
<td>workspaceDir / TRUSTIFY_DA_WORKSPACE_DIR</td>
@@ -608,6 +655,24 @@ TRUSTIFY_DA_GO_MVS_LOGIC_ENABLED=false
608655
609656
#### Python Support
610657
658+
The client supports two Python manifest formats:
659+
660+
- **`requirements.txt`** — uses pip/pip3 to resolve dependencies
661+
- **`pyproject.toml`** — uses [uv](https://docs.astral.sh/uv/) or [Poetry](https://python-poetry.org/) to resolve dependencies
662+
663+
##### pyproject.toml
664+
665+
For `pyproject.toml` projects, the client detects which tool manages the project by checking for lock files:
666+
- If `poetry.lock` is present and `[tool.poetry]` is defined, **Poetry** is used (`poetry show --tree` and `poetry show --all`)
667+
- If `uv.lock` is present, **uv** is used (`uv export --format requirements.txt --frozen --no-hashes`)
668+
- If neither lock file is found, an error is thrown
669+
670+
Both PEP 621 (`[project]` dependencies) and Poetry-style (`[tool.poetry.dependencies]`) are supported.
671+
672+
Custom executable paths can be set via `TRUSTIFY_DA_UV_PATH` and `TRUSTIFY_DA_POETRY_PATH`.
673+
674+
##### requirements.txt
675+
611676
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
612677
Binaries passed to environment variables. In any case, If the package is not installed , then an error will be thrown.
613678

0 commit comments

Comments
 (0)