Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add Device Detection Support

オープン
#51 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

stubs/wit_world/imports/device_detection.py の WIT bindings から始め、Viceroy の device-detection 実装を調べて、利用可能なテストレスポンスを確認します。関数ベースの lookup API と、将来互換性のある未知のフィールドを持つ DeviceInfo dataclass を追加し、その後、合成レスポンスまたは適切な xfail ケースを使って、パース、エラーハンドリング、マッチしない lookup をテストします。

索引モデルが issue の本文から書いたものです。

説明

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 @dataclass with _extra field for forward compatibility
  • Return None for 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 xfail markers 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

主要言語
Python
スター
5
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fastly/compute-sdk-python のほかの issue

fastly/compute-sdk-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。