Skip to content

Commit 95c756f

Browse files
authored
Merge pull request #109 from adf-python/develop
develop to main
2 parents b4aeb9a + d48cfdd commit 95c756f

File tree

426 files changed

+34399
-373
lines changed

Some content is hidden

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

426 files changed

+34399
-373
lines changed

.github/workflows/ci.yaml

Lines changed: 48 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -12,114 +12,89 @@ on:
1212

1313
jobs:
1414
setup:
15+
name: Setup
1516
runs-on: ubuntu-latest
17+
outputs:
18+
cache-hit: ${{ steps.setup_uv.outputs.cache-hit }}
1619
steps:
1720
- name: Checkout code
1821
uses: actions/checkout@v4
1922

20-
- name: Set up Python
21-
uses: actions/setup-python@v5
23+
- name: Install uv (+ enable cache)
24+
id: setup_uv
25+
uses: astral-sh/setup-uv@v6
2226
with:
23-
python-version: 3.12
27+
enable-cache: true
2428

25-
- name: Cache pip
26-
uses: actions/cache@v4
27-
with:
28-
path: ~/.cache/pip
29-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
30-
restore-keys: |
31-
${{ runner.os }}-pip-
29+
- name: Sync dependencies
30+
run: uv sync --locked --dev
3231

33-
- name: Cache virtual environment
34-
uses: actions/cache@v4
35-
with:
36-
path: .venv
37-
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
38-
restore-keys: |
39-
${{ runner.os }}-venv-
40-
41-
- name: Install dependencies
42-
run: |
43-
python -m venv .venv
44-
source .venv/bin/activate
45-
pip install --upgrade pip
46-
pip install poetry
47-
poetry install
32+
- name: Prune uv cache (optimized for CI)
33+
run: uv cache prune --ci
4834

4935
ruff-format:
36+
name: ruff-format
5037
needs: setup
5138
runs-on: ubuntu-latest
5239
steps:
5340
- name: Checkout code
5441
uses: actions/checkout@v4
5542

56-
- name: Restore virtual environment cache
57-
uses: actions/cache@v4
43+
- name: Install uv + restore cache
44+
uses: astral-sh/setup-uv@v6
5845
with:
59-
path: .venv
60-
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
61-
restore-keys: |
62-
${{ runner.os }}-venv-
63-
64-
- name: Check ruff version
65-
run: |
66-
source .venv/bin/activate
67-
poetry run ruff --version
46+
enable-cache: true
6847

69-
- name: Run ruff format check
70-
run: |
71-
source .venv/bin/activate
72-
poetry run ruff format --check .
48+
- name: Check ruff formatting
49+
run: uv run ruff format --check .
7350

7451
ruff-lint:
52+
name: ruff-lint
7553
needs: setup
7654
runs-on: ubuntu-latest
7755
steps:
7856
- name: Checkout code
7957
uses: actions/checkout@v4
8058

81-
- name: Restore virtual environment cache
82-
uses: actions/cache@v4
59+
- name: Install uv + restore cache
60+
uses: astral-sh/setup-uv@v6
8361
with:
84-
path: .venv
85-
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
86-
restore-keys: |
87-
${{ runner.os }}-venv-
88-
89-
- name: Set up Python environment
90-
run: source .venv/bin/activate
91-
92-
- name: Check ruff version
93-
run: |
94-
source .venv/bin/activate
95-
poetry run ruff --version
62+
enable-cache: true
9663

9764
- name: Run ruff lint
98-
run: |
99-
source .venv/bin/activate
100-
poetry run ruff check --output-format=github .
65+
run: uv run ruff check --output-format=github .
10166

10267
mypy-type-check:
68+
name: mypy-type-check
10369
needs: setup
10470
runs-on: ubuntu-latest
10571
steps:
10672
- name: Checkout code
10773
uses: actions/checkout@v4
10874

109-
- name: Restore virtual environment cache
110-
uses: actions/cache@v4
75+
- name: Install uv + restore cache
76+
uses: astral-sh/setup-uv@v6
77+
with:
78+
enable-cache: true
79+
80+
- name: Run mypy
81+
run: uv run --frozen mypy .
82+
83+
publish:
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: read
87+
packages: write
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: actions/setup-java@v4
11191
with:
112-
path: .venv
113-
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
114-
restore-keys: |
115-
${{ runner.os }}-venv-
116-
117-
- name: Check mypy version
118-
run: |
119-
source .venv/bin/activate
120-
poetry run mypy --version
121-
122-
- name: Run mypy type check
123-
run: |
124-
source .venv/bin/activate
125-
poetry run mypy .
92+
java-version: "17"
93+
distribution: "temurin"
94+
- name: Setup Gradle
95+
uses: gradle/actions/setup-gradle@v3
96+
97+
- name: Publish package
98+
run: cd java && ./gradlew publish
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/document.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: document
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
paths:
10+
- "docs/**"
11+
pull_request:
12+
branches:
13+
- main
14+
- develop
15+
paths:
16+
- "docs/**"
17+
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
26+
jobs:
27+
deploy:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: 3.12
37+
38+
- name: Cache virtual environment
39+
id: cached-virtualenv
40+
uses: actions/cache@v4
41+
with:
42+
path: .venv
43+
key: ${{ runner.os }}-venv-${{ hashFiles('**/uv.lock') }}
44+
45+
- name: Install dependencies
46+
if: steps.cached-virtualenv.outputs.cache-hit != 'true'
47+
run: |
48+
python -m venv .venv
49+
source .venv/bin/activate
50+
pip install --upgrade pip
51+
pip install uv
52+
uv sync
53+
54+
- name: Build documentation
55+
run: |
56+
source .venv/bin/activate
57+
cd docs
58+
python build.py
59+
60+
- name: Redirect to the en documentation
61+
run: |
62+
username=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 1)
63+
repository=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)
64+
echo '<meta http-equiv="refresh" content="0; url=https://'$username'.github.io/'$repository'/en" />' > ./docs/pages/index.html
65+
66+
- name: Deploy documentation
67+
uses: peaceiris/actions-gh-pages@v4
68+
with:
69+
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
publish_dir: ./docs/pages

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,17 @@ cython_debug/
159159
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
162+
.idea/
163163

164164
# ruff
165165
.ruff_cache/
166+
167+
# vscode
168+
.vscode/
169+
170+
# MacOS
171+
.DS_Store
172+
173+
# ADF
174+
agent.log*
175+
!java/lib/src/main/java/adf_core_python/core/agent/precompute

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
# adf-core-python
22

3+
## Documentation
4+
5+
[ADF Core Python Documentation](https://adf-python.github.io/adf-core-python/)
6+
37
## Development Environment
48

59
### Prerequisites
610

7-
- Python (3.12 or higher)
8-
- Poetry (1.8.3 or higher)
11+
- Python (3.13 or higher)
12+
- uv (0.8.2 or higher)
913

1014
### Installation
1115

1216
```bash
13-
poetry install
17+
uv sync
18+
```
19+
20+
### Run Agent
21+
22+
```bash
23+
uv run python ./adf_core_python/launcher.py
24+
25+
# get help
26+
uv run python ./adf_core_python/launcher.py -h
1427
```
1528

1629
### Build
1730

1831
```bash
19-
poetry build
32+
uv build
2033
```
2134

2235
### Pre Commit
2336

2437
```bash
25-
poetry run task precommit
38+
uv run ruff format .
39+
uv run ruff check .
40+
uv run mypy .
2641
```

adf_core_python/main.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/development.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"test": "test"
3+
}

config/launcher.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
kernel:
2+
host: localhost
3+
port: 27931
4+
5+
gateway:
6+
host: localhost
7+
port: 27941
8+
9+
team:
10+
name: AIT-Rescue
11+
12+
adf:
13+
launcher:
14+
precompute: false
15+
debug:
16+
flag: false
17+
agent:
18+
moduleconfig:
19+
filename: config/module.yaml
20+
precompute:
21+
dir_name: precompute
22+
23+
develop:
24+
flag: true
25+
filename: config/development.json
26+
27+
team:
28+
platoon:
29+
ambulance:
30+
count: 100
31+
fire:
32+
count: 100
33+
police:
34+
count: 100
35+
office:
36+
ambulance:
37+
count: 5
38+
fire:
39+
count: 5
40+
police:
41+
count: 5
42+
43+
gateway:
44+
flag: false

0 commit comments

Comments
 (0)