Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add Image Optimization Support

未关闭
#59 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api, backend

调研方向

从 stubs/wit_world/imports/image_optimizer.py 中的 WIT 绑定开始,检查 src/component/image_optimizer.rs 和 src/wiggle_abi/image_optimizer.rs 中尚未支持的实现。将所需的 wrapper 形状与 Rust 和 JavaScript API 进行比较,然后为参数验证、类型转换和 Unsupported 错误补充覆盖;完成的标准是文档化的 API 已存在,并且其测试通过,且不要求 Viceroy 支持。

由索引模型根据 Issue 内容生成。

描述

Overview

Add support for Fastly's Image Optimizer API, enabling on-the-fly image transformation and optimization.

WIT Interface

interface image-optimizer {
  use http-body.{body};
  use http-req.{request};
  use http-resp.{response-with-body};
  use types.{error};
  use backend.{backend};

  resource extra-image-optimizer-transform-options;

  record image-optimizer-transform-options {
    sdk-claims-opts: option<string>,
    extra: option<borrow<extra-image-optimizer-transform-options>>,
  }

  transform-image-optimizer-request: func(origin-image-request: borrow<request>, origin-image-request-body: option<body>, origin-image-request-backend: borrow<backend>, io-transform-options: image-optimizer-transform-options) -> result<response-with-body, error>;
}

WIT bindings: stubs/wit_world/imports/image_optimizer.py

API Design

  • Simple function-based API: transform_image(request, body, backend, options)
  • ImageOptimizerOptions dataclass for transformation parameters
  • Returns tuple of (Response, Body) with optimized image
  • Body should be io.IOBase-compatible for streaming large images
  • Supports query parameter-based transformations (width, height, format, quality, etc.)
  • Integration with Backend and Request/Response APIs

Cross-SDK Comparison: Rust has transform_image_optimizer_request(), JS has similar. Go support may vary. This is a specialized/premium feature - Python wrapper should match Rust's approach with transform function accepting request, backend, and options.

Viceroy Testing

Image Optimizer is NOT supported in Viceroy. The implementation returns Error::Unsupported for all calls (src/component/image_optimizer.rs:14, src/wiggle_abi/image_optimizer.rs:18).

Tests should:

  • Verify the API wrapper exists and accepts correct parameters
  • Skip or mark as expected to fail any tests that actually call transform_image_optimizer_request()
  • Focus on testing parameter validation, type conversions, and error handling for Unsupported errors

This API is primarily testable in production or staging environments.

Reference

主要语言
Python
星标
5
派生
1
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fastly/compute-sdk-python 的其他 Issue

查看 fastly/compute-sdk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。