ddapi 0.14.3__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ddapi-2.0.1/.ai/rules.md +35 -0
- ddapi-2.0.1/.github/PULL_REQUEST_TEMPLATE.md +4 -0
- ddapi-2.0.1/.github/dependabot.yml +40 -0
- ddapi-2.0.1/.github/workflows/crate_type.yaml +35 -0
- ddapi-2.0.1/.github/workflows/rust.yml +98 -0
- ddapi-2.0.1/.github/workflows/schema_check.yml +26 -0
- ddapi-2.0.1/.gitignore +31 -0
- ddapi-2.0.1/Cargo.lock +2262 -0
- ddapi-2.0.1/Cargo.toml +71 -0
- ddapi-2.0.1/PKG-INFO +209 -0
- ddapi-2.0.1/README.md +192 -0
- ddapi-2.0.1/pyproject.toml +32 -0
- ddapi-2.0.1/python/ddapi/__init__.py +125 -0
- ddapi-2.0.1/python/ddapi/_convert.py +50 -0
- ddapi-2.0.1/python/ddapi/ddnet.py +362 -0
- ddapi-2.0.1/python/ddapi/ddstats.py +310 -0
- ddapi-2.0.1/release-guide.md +17 -0
- ddapi-2.0.1/src/api/ddnet.rs +250 -0
- ddapi-2.0.1/src/api/ddstats.rs +108 -0
- ddapi-2.0.1/src/api/mod.rs +411 -0
- ddapi-2.0.1/src/error.rs +52 -0
- ddapi-2.0.1/src/lib.rs +32 -0
- ddapi-2.0.1/src/python/ddstats.rs +74 -0
- ddapi-2.0.1/src/python/mod.rs +370 -0
- ddapi-2.0.1/src/scheme/ddnet/latest_finishes.rs +29 -0
- ddapi-2.0.1/src/scheme/ddnet/map.rs +94 -0
- ddapi-2.0.1/src/scheme/ddnet/master.rs +245 -0
- ddapi-2.0.1/src/scheme/ddnet/mod.rs +23 -0
- ddapi-2.0.1/src/scheme/ddnet/player.rs +169 -0
- ddapi-2.0.1/src/scheme/ddnet/query.rs +21 -0
- ddapi-2.0.1/src/scheme/ddnet/query_map.rs +17 -0
- ddapi-2.0.1/src/scheme/ddnet/query_mapper.rs +20 -0
- ddapi-2.0.1/src/scheme/ddnet/releases_maps.rs +31 -0
- ddapi-2.0.1/src/scheme/ddnet/skins.rs +35 -0
- ddapi-2.0.1/src/scheme/ddnet/status.rs +44 -0
- ddapi-2.0.1/src/scheme/ddstats.rs +454 -0
- ddapi-2.0.1/src/scheme/mod.rs +70 -0
- ddapi-2.0.1/src/util/encoding.rs +163 -0
- ddapi-2.0.1/src/util/mod.rs +9 -0
- ddapi-2.0.1/src/util/time.rs +29 -0
- ddapi-2.0.1/src/util/tw_addr.rs +165 -0
- ddapi-2.0.1/tests/fixtures/ddnet/latest_finishes.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddnet/map.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddnet/query.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddnet/query_map.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddnet/query_mapper.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddnet/status.json +31 -0
- ddapi-2.0.1/tests/fixtures/ddstats/map.json +1 -0
- ddapi-2.0.1/tests/fixtures/ddstats/profile.json +1 -0
- ddapi-2.0.1/tests/python/test_ddapi.py +122 -0
- ddapi-2.0.1/tests/schema_ddnet.rs +162 -0
- ddapi-2.0.1/tests/schema_ddstats.rs +117 -0
- ddapi-2.0.1/tests/util/mod.rs +170 -0
- ddapi-2.0.1/typos.toml +2 -0
- ddapi-0.14.3/PKG-INFO +0 -66
- ddapi-0.14.3/README.md +0 -45
- ddapi-0.14.3/ddapi/ddapi/__init__.py +0 -11
- ddapi-0.14.3/ddapi/ddapi/_api.py +0 -112
- ddapi-0.14.3/ddapi/ddapi/api/__init__.py +0 -3
- ddapi-0.14.3/ddapi/ddapi/api/ddnet.py +0 -60
- ddapi-0.14.3/ddapi/ddapi/api/ddstats.py +0 -38
- ddapi-0.14.3/ddapi/ddapi/api/status.py +0 -134
- ddapi-0.14.3/ddapi/ddapi/cache/__init__.py +0 -3
- ddapi-0.14.3/ddapi/ddapi/cache/base.py +0 -35
- ddapi-0.14.3/ddapi/ddapi/cache/empty.py +0 -13
- ddapi-0.14.3/ddapi/ddapi/cache/memory.py +0 -40
- ddapi-0.14.3/ddapi/ddapi/enum.py +0 -10
- ddapi-0.14.3/ddapi/ddapi/scheme/__init__.py +0 -3
- ddapi-0.14.3/ddapi/ddapi/scheme/ddnet.py +0 -412
- ddapi-0.14.3/ddapi/ddapi/scheme/ddstats_tw.py +0 -318
- ddapi-0.14.3/ddapi/ddapi/scheme/status_tw.py +0 -131
- ddapi-0.14.3/ddapi/ddapi/types.py +0 -3
- ddapi-0.14.3/ddapi/ddapi/util.py +0 -18
- ddapi-0.14.3/ddapi/ddapi.egg-info/PKG-INFO +0 -66
- ddapi-0.14.3/ddapi/ddapi.egg-info/SOURCES.txt +0 -25
- ddapi-0.14.3/ddapi/ddapi.egg-info/dependency_links.txt +0 -1
- ddapi-0.14.3/ddapi/ddapi.egg-info/top_level.txt +0 -1
- ddapi-0.14.3/setup.cfg +0 -25
- ddapi-0.14.3/setup.py +0 -21
- {ddapi-0.14.3 → ddapi-2.0.1}/LICENSE +0 -0
ddapi-2.0.1/.ai/rules.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Project rules for AI coding tools
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
ddapi-rs — Rust client library for the DDNet and DDStats APIs (Teeworlds).
|
|
6
|
+
`src/scheme/` — serde structs mirroring the live APIs; `src/api/` — request
|
|
7
|
+
layer; `tests/` — schema-consistency tests.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
- Build/test: `cargo test --all-features`
|
|
12
|
+
- Strict clippy (mandatory, CI-enforced):
|
|
13
|
+
`cargo clippy --all-targets --all-features -- -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D warnings`
|
|
14
|
+
- Format: `cargo fmt`
|
|
15
|
+
- Typos: `typos .` (fixtures excluded via `typos.toml`)
|
|
16
|
+
|
|
17
|
+
## Conventions
|
|
18
|
+
|
|
19
|
+
- Zero style: no `unwrap`/`expect`/panic in library code; propagate errors,
|
|
20
|
+
use `assert!` in tests.
|
|
21
|
+
- `#[must_use]` on value-returning public methods.
|
|
22
|
+
- When the live schema check fails, update structs to match the API — do not
|
|
23
|
+
weaken the test.
|
|
24
|
+
|
|
25
|
+
## Live schema tests
|
|
26
|
+
|
|
27
|
+
Ignored by default; run with `cargo test --all-features -- --ignored`.
|
|
28
|
+
Weekly CI job (`schema_check.yml`) catches upstream drift: new fields the
|
|
29
|
+
structs do not model yet. Player-dependent tests use a candidate list and
|
|
30
|
+
pass on the first clean payload.
|
|
31
|
+
|
|
32
|
+
## Source of truth for DDStats
|
|
33
|
+
|
|
34
|
+
`ddstats-web` repo (https://git.ddstats.tw/ddstats/ddstats-web), `src/models/`
|
|
35
|
+
— structs must mirror it (field names, types, Option-ness).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Dependabot
|
|
2
|
+
version: 2
|
|
3
|
+
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: cargo
|
|
6
|
+
directory: /
|
|
7
|
+
schedule:
|
|
8
|
+
interval: weekly
|
|
9
|
+
day: friday
|
|
10
|
+
allow:
|
|
11
|
+
- dependency-type: all
|
|
12
|
+
groups:
|
|
13
|
+
patch-updates:
|
|
14
|
+
patterns:
|
|
15
|
+
- "*"
|
|
16
|
+
update-types:
|
|
17
|
+
- "patch"
|
|
18
|
+
minor-updates:
|
|
19
|
+
patterns:
|
|
20
|
+
- "*"
|
|
21
|
+
update-types:
|
|
22
|
+
- "minor"
|
|
23
|
+
major-updates:
|
|
24
|
+
patterns:
|
|
25
|
+
- "*"
|
|
26
|
+
update-types:
|
|
27
|
+
- "major"
|
|
28
|
+
ignore:
|
|
29
|
+
- dependency-name: "rand"
|
|
30
|
+
|
|
31
|
+
- package-ecosystem: github-actions
|
|
32
|
+
directory: /
|
|
33
|
+
schedule:
|
|
34
|
+
interval: weekly
|
|
35
|
+
groups:
|
|
36
|
+
github-actions-updates:
|
|
37
|
+
patterns:
|
|
38
|
+
- "*"
|
|
39
|
+
ignore:
|
|
40
|
+
- dependency-name: "rand"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Crate Type
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
outputs:
|
|
6
|
+
is_lib:
|
|
7
|
+
value: ${{ jobs.check-crate-type.outputs.is_lib }}
|
|
8
|
+
is_bin:
|
|
9
|
+
value: ${{ jobs.check-crate-type.outputs.is_bin }}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check-crate-type:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Fetch Repository
|
|
16
|
+
uses: actions/checkout@v6
|
|
17
|
+
|
|
18
|
+
- name: Install stable toolchain
|
|
19
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
20
|
+
|
|
21
|
+
- name: Install jql
|
|
22
|
+
uses: taiki-e/install-action@v2
|
|
23
|
+
with:
|
|
24
|
+
tool: jql
|
|
25
|
+
|
|
26
|
+
- name: Searching for lib
|
|
27
|
+
id: searching
|
|
28
|
+
run: |
|
|
29
|
+
result=$(cargo metadata --format-version=1 --no-deps | jql '"packages"|>"targets"<|[0]|>"kind"' | jql '..' -i);
|
|
30
|
+
echo "targets=$result" >> "$GITHUB_OUTPUT";
|
|
31
|
+
echo kind of targets $result;
|
|
32
|
+
|
|
33
|
+
outputs:
|
|
34
|
+
is_lib: ${{ contains(steps.searching.outputs.targets, 'lib') }}
|
|
35
|
+
is_bin: ${{ contains(steps.searching.outputs.targets, 'bin') }}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
name: Rust
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
env:
|
|
6
|
+
CARGO_TERM_COLOR: always
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
cargo-build-and-test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Fetch Repository
|
|
13
|
+
uses: actions/checkout@v6
|
|
14
|
+
|
|
15
|
+
- name: Install stable toolchain
|
|
16
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
17
|
+
|
|
18
|
+
- name: cargo build
|
|
19
|
+
run: cargo b --workspace --all-targets --all-features
|
|
20
|
+
|
|
21
|
+
cargo-fmt:
|
|
22
|
+
name: Cargo fmt
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Fetch Repository
|
|
27
|
+
uses: actions/checkout@v6
|
|
28
|
+
|
|
29
|
+
- name: Install stable toolchain
|
|
30
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
31
|
+
with:
|
|
32
|
+
components: rustfmt
|
|
33
|
+
|
|
34
|
+
- name: Rustfmt Check
|
|
35
|
+
run: cargo fmt --all --check
|
|
36
|
+
|
|
37
|
+
cargo-clippy:
|
|
38
|
+
name: Cargo clippy
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v6
|
|
42
|
+
- uses: actions-rs/toolchain@v1
|
|
43
|
+
with:
|
|
44
|
+
profile: minimal
|
|
45
|
+
toolchain: stable
|
|
46
|
+
override: true
|
|
47
|
+
- run: rustup component add clippy
|
|
48
|
+
- name: Clippy
|
|
49
|
+
run: RUSTFLAGS="-C target-cpu=haswell" cargo clippy --all-targets --all-features -- -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D warnings
|
|
50
|
+
|
|
51
|
+
cargo-doc:
|
|
52
|
+
name: Cargo doc
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- name: Fetch Repository
|
|
57
|
+
uses: actions/checkout@v6
|
|
58
|
+
|
|
59
|
+
- name: Install stable toolchain
|
|
60
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
61
|
+
|
|
62
|
+
- name: Cargo doc test
|
|
63
|
+
run: cargo doc --workspace --all-features
|
|
64
|
+
|
|
65
|
+
typos:
|
|
66
|
+
name: Typos
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- name: Fetch Repository
|
|
71
|
+
uses: actions/checkout@v6
|
|
72
|
+
|
|
73
|
+
- name: Install typos
|
|
74
|
+
uses: taiki-e/install-action@v2
|
|
75
|
+
with:
|
|
76
|
+
tool: typos
|
|
77
|
+
|
|
78
|
+
- name: Check typos
|
|
79
|
+
run: typos .
|
|
80
|
+
|
|
81
|
+
check-crate-type:
|
|
82
|
+
uses: ./.github/workflows/crate_type.yaml
|
|
83
|
+
|
|
84
|
+
cargo-test-doc:
|
|
85
|
+
needs: check-crate-type
|
|
86
|
+
if: ${{ needs.check-crate-type.outputs.is_lib == 'true' }}
|
|
87
|
+
name: Cargo test doc
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
|
|
90
|
+
steps:
|
|
91
|
+
- name: Fetch Repository
|
|
92
|
+
uses: actions/checkout@v6
|
|
93
|
+
|
|
94
|
+
- name: Install stable toolchain
|
|
95
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
96
|
+
|
|
97
|
+
- name: Cargo test doc
|
|
98
|
+
run: cargo test --doc --workspace --all-features
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Schema Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 0 * * 1"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
CARGO_TERM_COLOR: always
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
schema-drift-check:
|
|
13
|
+
name: Live schema drift check
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Fetch Repository
|
|
17
|
+
uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
- name: Install stable toolchain
|
|
20
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
21
|
+
|
|
22
|
+
- name: Check fixture schemas
|
|
23
|
+
run: cargo test --all-features --test schema_ddnet --test schema_ddstats
|
|
24
|
+
|
|
25
|
+
- name: Check live API schemas
|
|
26
|
+
run: cargo test --all-features --test schema_ddnet --test schema_ddstats -- --ignored
|
ddapi-2.0.1/.gitignore
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated by Cargo
|
|
2
|
+
# will have compiled files and executables
|
|
3
|
+
debug/
|
|
4
|
+
target/
|
|
5
|
+
|
|
6
|
+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
|
7
|
+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
|
8
|
+
Cargo.lock
|
|
9
|
+
|
|
10
|
+
# These are backup files generated by rustfmt
|
|
11
|
+
**/*.rs.bk
|
|
12
|
+
|
|
13
|
+
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
14
|
+
*.pdb
|
|
15
|
+
|
|
16
|
+
# RustRover
|
|
17
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
18
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
19
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
20
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
21
|
+
.idea/
|
|
22
|
+
|
|
23
|
+
# Python / maturin
|
|
24
|
+
.env/
|
|
25
|
+
venv/
|
|
26
|
+
dist/
|
|
27
|
+
build/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
__pycache__/
|
|
30
|
+
.pytest_cache/
|
|
31
|
+
python/ddapi/*.so
|