Add Device Detection Support
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu với các WIT bindings trong stubs/wit_world/imports/device_detection.py và kiểm tra triển khai device-detection của Viceroy để xác định các phản hồi kiểm thử hiện có. Thêm API lookup dựa trên hàm và dataclass DeviceInfo với các trường không xác định có khả năng tương thích với các phiên bản tương lai, sau đó kiểm thử việc phân tích, xử lý lỗi và các lookup không khớp bằng các phản hồi tổng hợp hoặc các trường hợp xfail phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
Add support for Fastly's Device Detection API, which provides device capabilities and characteristics based on User-Agent strings.
WIT Interface
interface device-detection {
use types.{error};
/// Returns JSON-encoded device data for a User-Agent string
lookup: func(user-agent: string, max-len: u64) -> result<option<string>, error>;
}
WIT bindings: stubs/wit_world/imports/device_detection.py
API Design
- Simple function-based API:
lookup(user_agent: str) -> Optional[DeviceInfo] - Parse JSON response into
@dataclasswith_extrafield for forward compatibility - Return
Nonefor lookups that don't match any known device - Fields typically include:
is_mobile,is_desktop,is_tablet,is_bot,device_type,brand,model, etc.
Forward Compatibility: Use @dataclass with _extra: dict field to capture unknown fields (same pattern as Geo). Provides type hints for known fields while allowing future fields to be accessible.
Cross-SDK Comparison: All SDKs expose simple lookup(user_agent) returning parsed JSON. Rust returns DeviceInfo struct, Go returns *DeviceDetection, JS returns object. All have similar field structure (device type, name, vendor, etc.).
Viceroy Testing
Device detection support in Viceroy is limited or stubbed. The WIT interface exists but may not have full test data support via test.toml configuration like other features.
Tests should either:
- Use
xfailmarkers for functionality that requires production device detection data - Mock the User-Agent lookup if Viceroy provides stub/default responses
- Focus on API wrapper behavior (parsing, error handling) with synthetic responses
Check Viceroy's device detection implementation to determine exact testing capabilities.
Reference
- Ngôn ngữ chính
- Python
- Star
- 5
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fastly/compute-sdk-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
fastly/compute-sdk-python#116 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
fastly/compute-sdk-python#98 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
fastly/compute-sdk-python#74 ·
-
Add HTTP Downstream Metadata APIĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
fastly/compute-sdk-python#61 ·
-
Set up Sphinx Documentation InfrastructureCó thể làm lại được @erikrose đã nhận 173 ngày trước và không có pull request nào đang mở. Đang mở
fastly/compute-sdk-python#60 · 1 người được giao ·
Tất cả issue của fastly/compute-sdk-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
spec-kitty/spec-kitty#5319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend::vllm diffusion multimodal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
openai/openai-agents-python#5229 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày