Skip to content

Commit ccbf62f

Browse files
authored
feat: AIRT Cleanup (#176)
* wip * Cleaning up lazy imports * Fix tests * Cleanup Attack fields * More stop conditions for agents. Full pass on lazy imports and type checking. * rename optimization stop conditions * pyright config deconfliction * Fixing linting and format errors * Add poetry.lock to gitignore to avoid regressions
1 parent fa1f56e commit ccbf62f

Some content is hidden

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

112 files changed

+11049
-10552
lines changed

.github/workflows/publish.yaml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,26 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919

20-
- name: Setup Python
21-
uses: actions/setup-python@3d1e2d2ca0a067f27da6fec484fce7f5256def85
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
2222
with:
23-
python-version: "3.13"
24-
25-
- name: Install Poetry
26-
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2
27-
28-
- name: Configure Poetry
29-
run: |
30-
poetry config virtualenvs.create true --local
31-
poetry config virtualenvs.in-project true --local
32-
33-
- name: Install package
34-
run: poetry install
23+
version: "latest"
24+
python-version: 3.13
3525

3626
- name: Validate version
3727
run: |
3828
TAG_VERSION=${GITHUB_REF#refs/tags/v}
39-
POETRY_VERSION=$(poetry version -s)
29+
PROJECT_VERSION=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)
4030
41-
if [ "$TAG_VERSION" != "$POETRY_VERSION" ]; then
42-
echo "Tag ($TAG_VERSION) doesn't match pyproject.toml ($POETRY_VERSION)"
31+
if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
32+
echo "Tag ($TAG_VERSION) doesn't match pyproject.toml ($PROJECT_VERSION)"
4333
exit 1
4434
fi
4535
4636
- name: Build package
47-
run: poetry build
37+
run: uv build
4838

4939
- name: Publish to PyPI
50-
uses: pypa/gh-action-pypi-publish@d417ba7e7683fa9104c42abe611c1f2c93c0727d
40+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4

.github/workflows/test.yaml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "**/*.py"
99
- "pyproject.toml"
1010
- "poetry.lock"
11+
- "uv.lock"
1112
pull_request:
1213
branches: [main]
1314

@@ -23,36 +24,29 @@ jobs:
2324
runs-on: ubuntu-latest
2425

2526
steps:
26-
- name: Checkout code
27-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
27+
- name: Checkout code
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2829

29-
- name: Setup Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@3d1e2d2ca0a067f27da6fec484fce7f5256def85
31-
with:
32-
python-version: ${{ matrix.python-version }}
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
32+
with:
33+
version: "latest"
34+
python-version: ${{ matrix.python-version }}
3335

34-
- name: Install Poetry
35-
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2
36+
- name: Sync packages
37+
run: uv sync --all-extras
3638

37-
- name: Configure Poetry
38-
run: |
39-
poetry config virtualenvs.create true --local
40-
poetry config virtualenvs.in-project true --local
39+
- name: Format
40+
run: uv run ruff format --check .
4141

42-
- name: Install package
43-
run: poetry install --all-extras
42+
- name: Lint
43+
if: always()
44+
run: uv run ruff check --output-format=github .
4445

45-
- name: Format
46-
run: poetry run ruff format --check .
46+
- name: Typecheck
47+
if: always()
48+
run: uv run mypy .
4749

48-
- name: Lint
49-
if: always()
50-
run: poetry run ruff check --output-format=github .
51-
52-
- name: Typecheck
53-
if: always()
54-
run: poetry run mypy .
55-
56-
- name: Test
57-
if: always()
58-
run: poetry run pytest
50+
- name: Test
51+
if: always()
52+
run: uv run pytest

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# uv lock (until we migrate)
2-
uv.lock
1+
# Poetry deprecated
2+
poetry.lock
33

44
# Testing code
55
notebooks/
@@ -93,7 +93,6 @@ docs/_build/
9393

9494
# PyBuilder
9595
.pybuilder/
96-
target/
9796

9897
# Jupyter Notebook
9998
.ipynb_checkpoints

.hooks/refresh_dependencies.sh

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
#!/bin/bash
22

33
# Get pre-merge hash from the target branch
4-
old_hash=$(git show ORIG_HEAD:poetry.lock | md5sum 2> /dev/null || echo "")
4+
old_hash=$(git show ORIG_HEAD:uv.lock | md5sum 2> /dev/null || echo "")
55

66
# Get current hash
7-
new_hash=$(md5sum poetry.lock 2> /dev/null || echo "")
7+
new_hash=$(md5sum uv.lock 2> /dev/null || echo "")
88

9-
# Compare and run poetry install if changed
9+
# Compare and run uv sync if changed
1010
if [ "$old_hash" != "$new_hash" ]; then
11-
echo "📦 Root dependencies changed. Running poetry install..."
12-
poetry install || {
11+
echo "📦 Dependencies changed. Running uv sync..."
12+
uv sync --all-extras || {
1313
echo "❌ Failed to update dependencies"
1414
exit 1
1515
}
16-
echo "Root dependencies updated!"
16+
echo "Dependencies updated!"
1717
else
18-
echo "📦 No root dependency changes"
19-
fi
20-
21-
# Get pre-merge hash from the target branch
22-
old_hash=$(git show ORIG_HEAD:components/api/poetry.lock | md5sum 2> /dev/null || echo "")
23-
24-
# Get current hash
25-
new_hash=$(md5sum components/api/poetry.lock 2> /dev/null || echo "")
26-
27-
# Compare and run poetry install if changed
28-
if [ "$old_hash" != "$new_hash" ]; then
29-
echo "📦 API dependencies changed. Running poetry install..."
30-
cd components/api || exit
31-
if ! poetry install --with dev; then
32-
echo "❌ Failed to update dependencies"
33-
exit 1
34-
fi
35-
echo "✅ API dependencies updated!"
36-
else
37-
echo "📦 No API dependency changes"
18+
echo "📦 No dependency changes"
3819
fi

.hooks/typing_and_linting.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
set -e
44

5-
poetry run mypy .
6-
poetry run ruff check .
7-
poetry run ruff format --check .
5+
echo
6+
7+
echo "📝 Running type checking with mypy ..."
8+
uv run mypy dreadnode
9+
echo "✅ Type checking passed!"
10+
echo
11+
12+
echo "🔎 Running linting with ruff ..."
13+
uv run ruff check dreadnode
14+
echo "✅ Linting passed!"
15+
echo
16+
17+
echo "🎨 Checking formatting with ruff ..."
18+
uv run ruff format --check dreadnode
19+
echo "✅ Code formatting is correct!"
20+
echo
21+
22+
echo "🎉 All checks passed! Code is ready to go."

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
rev: v2.4.1
3333
hooks:
3434
- id: codespell
35-
entry: codespell -q 3 -f --skip=".git,.github,README.md,poetry.lock" -L astroid,braket,te,ROUGE,lief,punctuations
35+
entry: codespell -q 3 -f --skip=".git,.github,README.md,poetry.lock,uv.lock" -L astroid,braket,te,ROUGE,lief,punctuations
3636

3737
# Python code security
3838
- repo: https://github.com/PyCQA/bandit
@@ -93,7 +93,7 @@ repos:
9393
# Generate documentation
9494
- id: generate-docs
9595
name: Generate docs
96-
entry: poetry run python .hooks/generate_docs.py
96+
entry: uv run python .hooks/generate_docs.py
9797
language: system
9898
pass_filenames: false
9999
always_run: true

.vscode/settings.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
"editor.defaultFormatter": "charliermarsh.ruff"
99
},
1010
"mypy-type-checker.importStrategy": "fromEnvironment",
11-
"mypy-type-checker.reportingScope": "workspace",
12-
"mypy-type-checker.preferDaemon": false,
1311
"python.testing.pytestArgs": [
1412
"tests"
1513
],
1614
"python.testing.unittestEnabled": false,
17-
"python.testing.pytestEnabled": true
18-
}
15+
"python.testing.pytestEnabled": true,
16+
"python.analysis.ignore": [
17+
"tests/**"
18+
]
19+
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,24 @@ with dn.run(tags=["reverse-engineering"]):
8080
## Installation
8181

8282
We publish every version to PyPi:
83+
8384
```bash
8485
pip install -U dreadnode
8586
```
8687

8788
If you want to build from source:
8889

8990
```bash
91+
uv sync
9092

91-
poetry install
9293
# Install with multimodal extras
93-
poetry install --extras multimodal
94+
uv sync --extras multimodal
9495

9596
# Install with training extras
96-
poetry install --extras training
97+
uv sync --extras training
9798

9899
# Install with all extras
99-
poetry install --all-extras
100+
uv sync --all-extras
100101
```
101102

102103
## Installation from PyPI with Optional Features

agent.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/docs.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@
3939
"usage/runs",
4040
"usage/tasks",
4141
"usage/metrics",
42-
"usage/scorers",
42+
{
43+
"group": "Scorers",
44+
"pages": [
45+
"usage/scorers/index",
46+
"usage/scorers/built-in-scorers",
47+
"usage/scorers/advanced",
48+
"usage/scorers/composition"
49+
]
50+
},
51+
"usage/optimization",
52+
"usage/airt",
4353
"usage/data-tracking",
4454
"usage/rich-objects",
4555
"usage/model-training",
@@ -66,6 +76,10 @@
6676
"sdk/artifact",
6777
"sdk/data_types",
6878
"sdk/scorers",
79+
"sdk/optimization",
80+
"sdk/mutations",
81+
"sdk/eval",
82+
"sdk/airt",
6983
"sdk/integrations",
7084
"sdk/main",
7185
"sdk/metric",

0 commit comments

Comments
 (0)