Skip to content

Commit 8542fd1

Browse files
committed
Enhance development setup with uv support
- Updated `CONTRIBUTING.md` to include installation instructions for `uv` and new make targets for development tasks. - Modified `Makefile` to add `uv`-specific commands for installation, linting, testing, and building. - Enhanced `README.md` with instructions for using `uv` during installation and development. - Updated GitHub Actions workflow to utilize `uv` for dependency installation, linting, testing, and building, improving the CI process. - Introduced `uv.lock` for managing dependencies with `uv`.
1 parent 2c14c88 commit 8542fd1

5 files changed

Lines changed: 2731 additions & 9 deletions

File tree

.github/workflows/secnode-pentest.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ jobs:
1414
with:
1515
python-version: '3.10'
1616

17+
- name: Set up uv
18+
uses: astral-sh/setup-uv@v5
19+
1720
- name: Install dependencies
18-
run: pip install -r requirements.txt && pip install -e .[dev]
21+
run: uv sync --extra dev
1922

2023
- name: Lint
21-
run: ruff check src tests
24+
run: uv run ruff check src tests
2225

2326
- name: Run tests with coverage
24-
run: pytest
27+
run: uv run pytest
2528

2629
- name: Build package
27-
run: |
28-
python -m pip install build
29-
python -m build
30+
run: uv build
3031

3132
security-scan:
3233
needs: lint-test-build
@@ -39,12 +40,15 @@ jobs:
3940
with:
4041
python-version: '3.10'
4142

43+
- name: Set up uv
44+
uses: astral-sh/setup-uv@v5
45+
4246
- name: Install SecNode
43-
run: pip install -r requirements.txt && pip install -e .
47+
run: uv sync
4448

4549
- name: Run SecNode Scan
4650
env:
4751
SECNODE_LLM: ${{ secrets.SECNODE_LLM }}
4852
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
4953
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
50-
run: secnodeapi --target https://staging-api.example.com/swagger.json
54+
run: uv run secnodeapi --target https://staging-api.example.com/swagger.json

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Thank you for your interest in contributing to SecNode API! This guide will help
88

99
- Python 3.9+
1010
- Git
11+
- uv (recommended)
1112

1213
### Local Development
1314

@@ -27,6 +28,10 @@ Thank you for your interest in contributing to SecNode API! This guide will help
2728
```bash
2829
make install-dev
2930
```
31+
Or with uv:
32+
```bash
33+
make install-dev-uv
34+
```
3035

3136
4. **Configure your LLM provider**
3237
```bash
@@ -52,6 +57,14 @@ make test
5257
make build
5358
```
5459

60+
With uv:
61+
62+
```bash
63+
make lint-uv
64+
make test-uv
65+
make build-uv
66+
```
67+
5568
## Enhancing the AI Engine
5669

5770
SecNode relies heavily on its `ai/` package (`understand`, `generate`, `validate`) for cognitive test generation and verification.

Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
PYTHON ?= python
2+
UV ?= uv
23

3-
.PHONY: install install-dev lint test test-cov build run clean
4+
.PHONY: install install-dev install-uv install-dev-uv lint lint-uv test test-uv test-cov test-cov-uv build build-uv run run-uv clean
45

56
install:
67
$(PYTHON) -m pip install -r requirements.txt
@@ -10,21 +11,42 @@ install-dev:
1011
$(PYTHON) -m pip install -r requirements.txt
1112
$(PYTHON) -m pip install -e .[dev]
1213

14+
install-uv:
15+
$(UV) sync
16+
17+
install-dev-uv:
18+
$(UV) sync --extra dev
19+
1320
lint:
1421
ruff check src tests
1522

23+
lint-uv:
24+
$(UV) run ruff check src tests
25+
1626
test:
1727
pytest
1828

29+
test-uv:
30+
$(UV) run pytest
31+
1932
test-cov:
2033
pytest --cov=src/secnodeapi --cov-report=term-missing --cov-fail-under=70
2134

35+
test-cov-uv:
36+
$(UV) run pytest --cov=src/secnodeapi --cov-report=term-missing --cov-fail-under=70
37+
2238
build:
2339
$(PYTHON) -m pip install build
2440
$(PYTHON) -m build
2541

42+
build-uv:
43+
$(UV) build
44+
2645
run:
2746
secnodeapi --help
2847

48+
run-uv:
49+
$(UV) run secnodeapi --help
50+
2951
clean:
3052
$(PYTHON) -c "import shutil, pathlib; [shutil.rmtree(p, ignore_errors=True) for p in ['dist','build','.pytest_cache','htmlcov']]; [q.unlink() for q in pathlib.Path('.').rglob('*.pyc')]"

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ pip install -r requirements.txt
4040
pip install -e .[dev]
4141
```
4242

43+
### Install with uv (recommended)
44+
45+
```bash
46+
uv sync --extra dev
47+
```
48+
4349
On Windows (PowerShell):
4450

4551
```powershell
@@ -49,6 +55,12 @@ pip install -r requirements.txt
4955
pip install -e .[dev]
5056
```
5157

58+
On Windows (PowerShell) with uv:
59+
60+
```powershell
61+
uv sync --extra dev
62+
```
63+
5264
## Configuration
5365

5466
Set the model and provider credentials before running scans:
@@ -127,6 +139,16 @@ make test-cov
127139
make build
128140
```
129141

142+
Using uv-native targets:
143+
144+
```bash
145+
make install-dev-uv
146+
make lint-uv
147+
make test-uv
148+
make test-cov-uv
149+
make build-uv
150+
```
151+
130152
## CI
131153

132154
GitHub Actions workflow runs:

0 commit comments

Comments
 (0)