Skip to content

Commit f693bfb

Browse files
authored
Use uv (#206)
Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent a1d8610 commit f693bfb

File tree

15 files changed

+1670
-29
lines changed

15 files changed

+1670
-29
lines changed

.github/workflows/pythonapp.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
fail-fast: false
1515
steps:
1616
- uses: actions/checkout@v4
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
1719
- name: Set up Python
1820
uses: actions/setup-python@v5
1921
with:
@@ -32,24 +34,24 @@ jobs:
3234
- name: Install dependencies
3335
run: |
3436
python -m pip install --upgrade pip
35-
pip install ".[dev]"
37+
uv sync --all-extras --dev
3638
- name: Lint with flake8
3739
run: |
38-
flake8 . --count --show-source --exit-zero --statistics
40+
uv run flake8 . --count --show-source --exit-zero --statistics
3941
- name: Test with pytest
4042
run: |
41-
pytest --cov=vdb test
43+
uv run pytest --cov=vdb test
4244
env:
4345
PYTHONPATH: .
4446
TEST_VDB_HOME: vdb_data
4547
- name: Generate SBOM with cdxgen
4648
run: |
4749
npm install -g @cyclonedx/cdxgen
4850
cdxgen -t python -o bom.json . -p --profile research
49-
pip install ".[all]"
50-
python vdb/cli.py --download-image
51-
python vdb/cli.py --bom bom.json
51+
uv sync --all-extras --dev
52+
uv run vdb --download-image
53+
uv run vdb --bom bom.json
5254
- name: CLI tests
5355
run: |
54-
python vdb/cli.py --search "pkg:maven/org.springframework/[email protected]"
55-
python vdb/cli.py --search "pkg:maven/org.hibernate.orm/[email protected]"
56+
uv run vdb --search "pkg:maven/org.springframework/[email protected]"
57+
uv run vdb --search "pkg:maven/org.hibernate.orm/[email protected]"

.github/workflows/pythonpublish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
id-token: write
2121
steps:
2222
- uses: actions/checkout@v4
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
2325
- name: Set up Python
2426
uses: actions/setup-python@v5
2527
with:
@@ -36,13 +38,14 @@ jobs:
3638
- name: Install dependencies
3739
run: |
3840
python -m pip install --upgrade pip
39-
pip install setuptools wheel twine build
41+
uv sync --all-extras --dev
4042
- name: Build
4143
run: |
42-
python3 -m build
44+
uv build
4345
- name: Publish package distributions to PyPI
4446
if: startsWith(github.ref, 'refs/tags/')
45-
uses: pypa/gh-action-pypi-publish@release/v1
47+
run: |
48+
uv publish
4649
- name: Generate SBOM with cdxgen
4750
run: |
4851
npm install -g @cyclonedx/cdxgen
@@ -84,7 +87,7 @@ jobs:
8487
- name: Build and push Docker images
8588
uses: docker/build-push-action@v5
8689
with:
87-
context: contrib/mcp-server-vdb
90+
context: packages/mcp-server-vdb
8891
platforms: linux/amd64,linux/arm64
8992
push: true
9093
tags: ${{ steps.meta.outputs.tags }}

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,22 @@ if db_lib.needs_update():
275275
276276
## Model Context Protocol (MCP) server
277277
278-
Refer to the [readme](./contrib/mcp-server-vdb/README.md)
278+
Refer to the [readme](./packages/mcp-server-vdb/README.md)
279279
280280
## Read .vdb6 files in other languages
281281
282282
.vdb6 files are standard SQLite database files. Use any modern sqlite library to read and query them. There is a mini [deno example](./contrib/deno-vdb/README.md) in this repo for demonstration.
283283
284+
## Local development
285+
286+
Setup uv by following the official [documentation](https://docs.astral.sh/uv/).
287+
288+
```shell
289+
uv sync --all-extras --dev
290+
uv run depscan --help
291+
uv run pytest
292+
```
293+
284294
## License
285295
286296
MIT
File renamed without changes.
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,29 @@ classifiers = [
2323
]
2424

2525
dependencies = [
26-
"appthreat-vulnerability-db[oras]>=6.2.3",
26+
"appthreat-vulnerability-db[oras]",
2727
"mcp[cli]>=1.2.1",
2828
]
2929

3030
[build-system]
31-
requires = ["hatchling"]
32-
build-backend = "hatchling.build"
31+
requires = ["setuptools>=61", "wheel", "build"]
32+
build-backend = "setuptools.build_meta"
33+
34+
[project.optional-dependencies]
35+
dev = [
36+
"black",
37+
"bandit",
38+
"flake8",
39+
"pylint",
40+
"pytest",
41+
"pytest-cov",
42+
]
3343

3444
[project.scripts]
3545
mcp-server-vdb = "mcp_server_vdb:main"
46+
47+
[tool.pytest.ini_options]
48+
addopts="--showlocals -v --cov-report=term-missing --no-cov-on-fail --cov vdb"
49+
testpaths = [
50+
"test"
51+
]

contrib/mcp-server-vdb/src/mcp_server_vdb/__init__.py renamed to packages/mcp-server-vdb/src/mcp_server_vdb/__init__.py

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)