A Python capture library focused on new 3DS XL capture board frame acquisition.
Project description
ponkan-python
ponkan-python は、new 3DS XL capture board から USB 経由で映像フレームを取得するための Python ライブラリです。
このプロジェクトは cc3dsfs を参照しながら、個人用途で必要な N3DSXL 映像取得機能に絞って Python で再構成するものです。cc3dsfs 全体の代替や互換 API を提供することは目的にしていません。継続的なメンテナンスや対応 device の拡張は未定です。
Current Scope
- new 3DS XL capture board の device 認識
- raw frame 取得
- raw frame の保存と metadata 記録
- RGB8
numpy.ndarrayへの変換 - Pillow 互換出力
- libusb async transfer による streaming MVP
詳細は次の仕様書を参照してください。
spec/initial/cc3dsfs_python_rebuild_spec.mdspec/initial/cc3dsfs_python_n3dsxl_implementation_workflow.md
Installation
Python 3.12 / 3.13 を対象にしています。
pip install ponkan-python
PNG 変換には Pillow extra、FTDI D3XX backend には D3XX extra を追加します。
pip install "ponkan-python[image]"
pip install "ponkan-python[d3xx]"
Usage
高レベル API では、new 3DS XL capture board を開いて read() で RGB8 numpy.ndarray を取得できます。
from py3dscapture import CaptureOutput, open_capture
with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
image = cap.read()
if image is not None:
print(image.shape)
上画面だけを読む場合は CaptureOutput.TOP を指定します。OpenCV へ渡す場合は colorspace="BGR" を指定できます。
from py3dscapture import CaptureOutput, open_capture
with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
top_bgr = cap.read()
3DS 固有の上画面・下画面・sequence などが必要な場合は read_frame() を使います。
from py3dscapture import open_capture
with open_capture() as cap:
frame = cap.read_frame()
if frame is not None:
top = frame.top
bottom = frame.bottom
API の詳細は API Reference を参照してください。
Command Line Tools
インストール後は次の console scripts を利用できます。
py3dscapture-list-devices
py3dscapture-capture-raw --out captures/n3dsxl/raw_2d_001.bin
py3dscapture-raw-to-png captures/n3dsxl/raw_2d_001.bin --metadata captures/n3dsxl/raw_2d_001.json --out captures/n3dsxl/png
py3dscapture-stream-n3dsxl --duration 10 --stats
実機へ N3DSXL command を送る操作は、事前に device identity と安全境界を確認してから実行してください。
Development
Python 実行と依存管理は uv を使います。
uv sync --dev
scripts/install-git-hooks.ps1
uv run ruff format --check .
uv run ruff check .
uv run ty check --no-progress
uv run pytest tests/unit
実機 new 3DS XL capture board を使うテストは通常 CI では実行しません。
$env:PONKAN_RUN_N3DSXL = "1"
uv run pytest -m requires_n3dsxl tests/e2e
Safety
N3DSXL command は、VID/PID と product string が仕様で許可された device にだけ送ります。未知の FTDI device を N3DSXL として扱わないでください。
Git hooks は .githooks/ に配置しています。clone 後に scripts/install-git-hooks.ps1 または sh scripts/install-git-hooks.sh を実行すると、core.hooksPath が .githooks に設定されます。
Codex project-local policy は .codex/ に配置しています。Codex で有効にするには、この project layer を trust し、/hooks で hook を review/trust してください。
License and Attribution
This project is licensed under the MIT License.
This project references cc3dsfs by Lorenzooone, which is also licensed under
the MIT License. The upstream copyright notice is preserved in LICENSE and
NOTICE.md.
Release and publishing notes are kept in Publishing.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ponkan_python-0.1.0.tar.gz.
File metadata
- Download URL: ponkan_python-0.1.0.tar.gz
- Upload date:
- Size: 72.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b31d4709606219aec85a9dd76a7b281218ca32e01997513b249416668167a18b
|
|
| MD5 |
885dbf0de383318a8a9380e02748dc55
|
|
| BLAKE2b-256 |
29a6448071650753645b6dbf23dc229548661ae798eebba7a687fc703c387a8e
|
Provenance
The following attestation bundles were made for ponkan_python-0.1.0.tar.gz:
Publisher:
publish.yml on niart120/ponkan-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ponkan_python-0.1.0.tar.gz -
Subject digest:
b31d4709606219aec85a9dd76a7b281218ca32e01997513b249416668167a18b - Sigstore transparency entry: 1778300455
- Sigstore integration time:
-
Permalink:
niart120/ponkan-python@20114932f93f887b31e16e574c09079aca0c5f22 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/niart120
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20114932f93f887b31e16e574c09079aca0c5f22 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ponkan_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ponkan_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d593cda033bfbfdab9ef37b7c83a78b61c79a096b8fc9c6ce9bc3b83992c095e
|
|
| MD5 |
db2ea8be5921f5911930078848f84f7f
|
|
| BLAKE2b-256 |
0d6aabb04f701ca857a0e65f1136aece633ffe45b3be54174c94c34d781119b2
|
Provenance
The following attestation bundles were made for ponkan_python-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on niart120/ponkan-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ponkan_python-0.1.0-py3-none-any.whl -
Subject digest:
d593cda033bfbfdab9ef37b7c83a78b61c79a096b8fc9c6ce9bc3b83992c095e - Sigstore transparency entry: 1778300645
- Sigstore integration time:
-
Permalink:
niart120/ponkan-python@20114932f93f887b31e16e574c09079aca0c5f22 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/niart120
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20114932f93f887b31e16e574c09079aca0c5f22 -
Trigger Event:
push
-
Statement type: