Skip to content

Commit 7ff0c50

Browse files
refactor: use ark_fbs (#82)
1 parent 4b2987a commit 7ff0c50

13 files changed

Lines changed: 87 additions & 108 deletions

File tree

.github/actions/setup-python/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
python-version:
66
description: Python version
77
required: false
8-
default: "3.12"
8+
default: "3.13"
99

1010
runs:
1111
using: "composite"

AGENTS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ Common flags:
4141
- `storage/asset/gamedata/`: decoded game data
4242
- `storage/asset/raw/`: raw extracted assets
4343
- `OpenArknightsFBS/FBS/`: flatbuffer schemas
44-
- `bin/flatc` (`bin/flatc.exe` on Windows): flatc binary
4544

4645
## Config (Env)
4746

4847
- `ENVIRONMENT`, `LOG_LEVEL`, `TIMEOUT`
4948
- `TOKEN`, `BACKEND_ENDPOINT` (for upload-related tasks, e.g. `ItemDemand`)
50-
- `FLATC_PATH`, `SENTRY_DSN`
49+
- `SENTRY_DSN`
5150

5251
Use `BACKEND_ENDPOINT` (not `ENDPOINT`).
5352

Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM python:3.12-bookworm AS requirements-stage
3+
FROM python:3.13-bookworm AS requirements-stage
44

55
WORKDIR /tmp
66

@@ -12,15 +12,15 @@ COPY ./pyproject.toml ./uv.lock* /tmp/
1212

1313
RUN uv export --format requirements.txt -o requirements.txt --no-editable --no-hashes --no-dev --no-emit-project
1414

15-
FROM python:3.12-bookworm AS build-stage
15+
FROM python:3.13-bookworm AS build-stage
1616

1717
WORKDIR /wheel
1818

1919
COPY --from=requirements-stage /tmp/requirements.txt /wheel/requirements.txt
2020

2121
RUN pip wheel --wheel-dir=/wheel --no-cache-dir --requirement /wheel/requirements.txt
2222

23-
FROM python:3.12-bookworm AS metadata-stage
23+
FROM python:3.13-bookworm AS metadata-stage
2424

2525
WORKDIR /tmp
2626

@@ -29,7 +29,7 @@ RUN --mount=type=bind,source=./.git/,target=/tmp/.git/ \
2929
|| git rev-parse --short HEAD > /tmp/VERSION \
3030
&& echo "Building version: $(cat /tmp/VERSION)"
3131

32-
FROM python:3.12-slim-bookworm
32+
FROM python:3.13-slim-bookworm
3333

3434
WORKDIR /app
3535

@@ -55,6 +55,4 @@ COPY --from=metadata-stage /tmp/VERSION /app/VERSION
5555

5656
COPY . /app/
5757

58-
RUN chmod -R +x /app/bin
59-
6058
ENTRYPOINT ["python", "-m", "torappu"]

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ An unpacker for Arknights assets with a focus on resource extraction and analysi
1313

1414
## Requirements
1515

16-
- Python 3.12+
16+
- Python 3.13+
1717
- Dependencies as specified in pyproject.toml
1818

1919
## Installation
@@ -76,7 +76,6 @@ docker run -e TOKEN=your_token -v $(pwd)/storage:/app/storage torappu [CLIENT_VE
7676
- `core/`: Core functionality
7777
- `OpenArknightsFBS/`: FlatBuffer schema definitions
7878
- `assets/`: Asset resources
79-
- `bin/`: Binary tools (includes flatc for FlatBuffer compilation)
8079
- `scripts/`: Utility scripts
8180
- `storage/`: Storage for extracted assets
8281

bin/flatc

-4.4 MB
Binary file not shown.

bin/flatc.exe

-3.47 MB
Binary file not shown.

bin/macos/flatc

-3.57 MB
Binary file not shown.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dev = ["ruff>=0.15.0,<1", "pre-commit>=4.0.0,<5"]
3131

3232
[tool.ruff]
3333
line-length = 88
34-
target-version = "py312"
34+
target-version = "py313"
3535

3636
[tool.ruff.format]
3737
line-ending = "lf"
@@ -75,7 +75,7 @@ keep-runtime-typing = true
7575

7676
[tool.pyright]
7777
extraPaths = ["./"]
78-
pythonVersion = "3.12"
78+
pythonVersion = "3.13"
7979
pythonPlatform = "All"
8080
executionEnvironments = [{ root = "./" }]
8181

torappu/config.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
from pathlib import Path
21
from typing import Literal
32

43
from pydantic_settings import BaseSettings, SettingsConfigDict
54

6-
from torappu.consts import MACOS, WINDOWS
7-
8-
9-
def get_flatc_path():
10-
if WINDOWS:
11-
return Path("bin/flatc.exe")
12-
elif MACOS:
13-
return Path("bin/macos/flatc")
14-
else:
15-
return Path("bin/flatc")
16-
175

186
class Config(BaseSettings):
197
model_config = SettingsConfigDict(
@@ -31,7 +19,6 @@ class Config(BaseSettings):
3119
timeout: int = 10
3220

3321
backend_endpoint: str | None = None
34-
flatc_path: Path = get_flatc_path()
3522

3623
sentry_dsn: str | None = None
3724

torappu/consts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
GAMEDATA_DIR = STORAGE_DIR / "asset" / "gamedata"
1818
HOT_UPDATE_LIST_DIR = STORAGE_DIR / "hot_update_list"
1919

20+
RESOURCE_MANIFEST_IDX_NAME = "resource_manifest_idx.json"
21+
2022
HEADERS = {
2123
"user-agent": "Dalvik/2.1.0 (Linux; U; Android 6.0.1; vivo X9L Build/MMB29M)"
2224
}

0 commit comments

Comments
 (0)