Skip to main content

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 互換出力
  • profile / layout / device discovery metadata の提供
  • D3XX / D3XX native backend による streaming MVP

詳細は次の仕様書を参照してください。

  • spec/initial/cc3dsfs_python_rebuild_spec.md
  • spec/initial/cc3dsfs_python_n3dsxl_implementation_workflow.md

Installation

Python 3.12 以上を対象にしています。現在の検証基準は Python 3.12 / 3.13 です。

pip install ponkan-python

Windows の FTDI D3XX backend では、通常依存として PyD3XX を利用します。D3XX 用の optional extra はありません。PNG 変換には Pillow extra を追加します。

pip install "ponkan-python[image]"

Usage

高レベル API では、new 3DS XL capture board を開いて read() で RGB8 numpy.ndarray を取得できます。

from ponkan 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 ponkan import CaptureOutput, open_capture

with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
    top_bgr = cap.read()

backend="auto" は Windows では d3xx-native に解決されます。従来の sequential D3XX path を使う場合は backend="d3xx" を明示します。libusb は discovery / lower-level path では使われますが、high-level open_capture() では現在未対応です。

3DS 固有の上画面・下画面・sequence などが必要な場合は read_frame() を使います。

from ponkan 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 を利用できます。

ponkan-list-devices
ponkan-capture-raw --out captures/n3dsxl/raw_2d_001.bin
ponkan-raw-to-png captures/n3dsxl/raw_2d_001.bin --metadata captures/n3dsxl/raw_2d_001.json --out captures/n3dsxl/png
ponkan-stream-n3dsxl --duration 10 --stats

ponkan-list-devices は libusb descriptor path で FTDI-family device を分類し、N3DSXL command は送信しません。実機へ 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.

Metadata

Release files for ponkan-python 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ponkan-python 0.2.1
File Size Uploaded Provenance Actions
ponkan_python-0.2.1.tar.gz 88.0 kB With provenance Details for ponkan_python-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ponkan-python 0.2.1
File Interpreter ABI Platform Actions
ponkan_python-0.2.1-py3-none-any.whl Python 3 none any Details for ponkan_python-0.2.1-py3-none-any.whl

Total release size: 158.2 kB

Release files / ponkan_python-0.2.1.tar.gz

Download URL ponkan_python-0.2.1.tar.gz
Size 88.0 kB
Tags Source
SHA-256 checksum
How to use checksums
838d9450b6427338138ed9fe22ffd8cc5e30bc6ffb570784d6488dd20dfad323
BLAKE2b-256 checksum
How to use checksums
9ee73447a367b8ee28c478af0c8d40da56f0b49ff75670d369db7a115b2dd8b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / ponkan_python-0.2.1-py3-none-any.whl

Download URL ponkan_python-0.2.1-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dbea73641047941f8985001919e2dce690e07d789d2dfc66b340177e7bb7360
BLAKE2b-256 checksum
How to use checksums
a70d5947e116ed7d38c701defeb1d78711f73c7a845a2ac59d9d11925cb82673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for ponkan-python 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ponkan_python-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page