Metadata-Version: 2.4
Name: spu-sku-images
Version: 0.1.2
Summary: Classify SPU product images by mother/reference images and output ordered SKU image sets.
Author: SPU SKU Images Maintainers
License-Expression: LicenseRef-Proprietary
Keywords: sku,spu,image-classification,ecommerce
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: Pillow==12.2.0

# SPU SKU Images

按母图对 SPU 产品图进行 SKU 分类，并输出适合电商上架的 SKU 图片排序。

## 安装

在项目目录运行：

```powershell
python -m pip install .
```

开发调试时可以用可编辑安装：

```powershell
python -m pip install -e .
```

## 最简使用

如果当前目录下有：

```text
母图/
spu-2/
```

直接运行：

```powershell
sku-images spu-2
```

也可以用短别名：

```powershell
sku-spu spu-2
```

默认输出到：

```text
sku_output/spu-2_年月日_时分秒/
```

## 指定母图和输出目录

```powershell
sku-images spu-2 --mother 母图 --out result_001
```

## 不把母图放进最终排序图集

```powershell
sku-images spu-2 --no-include-mother-main
```

## 兼容旧脚本方式

```powershell
python .\scripts\sku_image_pipeline.py spu-2 --mother 母图 --out result_001
```

## 发布到 PyPI

先跑测试：

```powershell
python -m unittest discover -s tests -p "test_*.py"
```

构建发布包：

```powershell
python -m pip install --user --upgrade build twine
python -m build --outdir dist_pypi
python -m twine check .\dist_pypi\*
```

上传到正式 PyPI：

```powershell
$env:TWINE_USERNAME="__token__"
$env:TWINE_PASSWORD="pypi-你的token"
python -m twine upload .\dist_pypi\*
```

发布后安装：

```powershell
python -m pip install spu-sku-images
```

## 输出内容

```text
result_001/
  spu-2_by_mother/
    classification_manifest.csv
    classification_preview.jpg

  spu-2_sku_best_order/
    best_order_manifest.csv
    best_order_preview.jpg
```

脚本默认不会清空旧目录。如果输出目录已有内容，会停止并提示换一个 `--out`。
