Skip to content

Commit dc448cb

Browse files
Merge pull request #37 from noboru-fukaishi/feature/python-3.13-support
feat: Upgrade to v1.0.0 with Python 3.10-3.13 support
1 parent bccd957 commit dc448cb

File tree

15 files changed

+919
-227
lines changed

15 files changed

+919
-227
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.10', '3.11', '3.12', '3.13']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v4
20+
- name: Run tests
21+
run: uv run --python ${{ matrix.python-version }} --extra dev pytest

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.ja.md

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,107 @@
1-
# pptx-template [![Build Status](https://travis-ci.org/m3dev/pptx-template.svg?branch=master)](https://travis-ci.org/m3dev/pptx-template)
1+
# pptx-template
22

3-
## Overview
3+
[![Test](https://github.com/m3dev/pptx-template/actions/workflows/test.yml/badge.svg)](https://github.com/m3dev/pptx-template/actions/workflows/test.yml)
4+
[![Python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/)
5+
[![License](https://img.shields.io/badge/license-Apache%202.0-green)](LICENSE)
6+
7+
## 概要
48

59
pptx-template は pptx のテンプレートを元に、別途用意した JSON 中の文字列や CSV データを差し込んだ pptx を生成するツールです。
610

711
定型レポートなどで大量のグラフ付きスライドを作成する際の作業を代行してくれます。
812

913
- テンプレートには "{sales.0.june.us}" のような形で JSON内の値を指す id を記入できます
10-
- python 3, pandas, pptx に依存しています
14+
- Python 3.10+, pandas, python-pptx に依存しています
1115
- 扱う json や csv の 文字コードは utf-8 前提です
1216

13-
### Text substitution
17+
### テキスト置換
1418

1519
<img src="docs/01.png?raw=true" width="80%" />
1620

17-
### CSV Import
21+
### CSVインポート
1822

1923
<img src="docs/02.png?raw=true" width="80%" />
2024

21-
## Getting started
25+
## はじめに
26+
27+
```bash
28+
pip install pptx-template
29+
echo '{ "slides": [ { "greeting" : "Hello!!" } ] }' > model.json
2230

23-
TBD
31+
# "{greeting}" を含むテンプレートファイル (test.pptx) を用意してください
2432

33+
pptx_template --out out.pptx --template test.pptx --model model.json
2534
```
26-
$ pip install pptx-template
27-
$ echo '{ "slides": [ { "greeting" : "Hello!!" } ] }' > model.json
2835

29-
# prepare your template file (test.pptx) which contains "{greeting}" in somewhere
36+
## 開発
3037

31-
$ pptx-template --out out.pptx --template test.pptx --model model.json
32-
```
38+
### 必要条件
39+
40+
- Python 3.10, 3.11, 3.12, または 3.13
41+
- [uv](https://docs.astral.sh/uv/)(推奨)または pip
3342

34-
## 開発工程
43+
### インストール
3544

36-
### インストールの流れ
45+
```bash
46+
git clone https://github.com/m3dev/pptx-template.git
47+
cd pptx-template
3748

38-
pyenvをインストールしておく
49+
# uvを使う場合(推奨)
50+
uv sync --extra dev
3951

52+
# pipを使う場合
53+
pip install -e ".[dev]"
4054
```
41-
git clone https://github.com/m3dev/pptx-template.git
4255

43-
pyenv install 3.7.1 # Pythonをインストール
44-
pyenv shell 3.7.1 # シェルで使うPython
56+
### テスト実行
57+
58+
```bash
59+
# uvを使う場合
60+
uv run --extra dev pytest
4561

46-
venv .venv # 開発用の仮想環境を作成
47-
source .venv/bin/activate # 仮想環境を使用する
62+
# 特定のPythonバージョンで実行
63+
uv run --python 3.13 --extra dev pytest
4864

49-
python setup.py develop # パッケージを開発用にインストール&依存パッケージをインストール
50-
pip install -r requirements.txt # 開発用のパッケージをインストール
65+
# pip インストール後
66+
pytest
5167
```
5268

53-
### REPLで実行 ※開発時はこの方法
69+
### コマンドラインで実行
5470

55-
pythonのREPLを起動
71+
```bash
72+
# uvを使う場合
73+
uv run pptx_template \
74+
--template test/data3/in.pptx \
75+
--model test/data3/in.xlsx \
76+
--out test/data3/out.pptx \
77+
--debug
5678

57-
```
58-
cd {プロジェクトフォルダ}
59-
pyenv shell 3.7.1
60-
python
79+
# pip インストール後
80+
pptx_template \
81+
--template test/data3/in.pptx \
82+
--model test/data3/in.xlsx \
83+
--out test/data3/out.pptx \
84+
--debug
6185
```
6286

63-
REPL内で実行
87+
### REPLで実行(開発時)
6488

89+
```bash
90+
uv run python
6591
```
92+
93+
```python
6694
import sys
6795
from importlib import reload
6896
import pptx_template.cli as cli
6997

70-
71-
## 実行引数設定
72-
## sys.argv = ['{pyファイル名}', '--out', '{出力pptxファイルパス}', '--template', '{テンプレートpptxファイルパス}', '--model', '{設定xlsxファイルパス}', '--debug']
73-
## 以下の設定でテストファイルにて実行できます
98+
# 実行引数設定
7499
sys.argv = ['dummy.py', '--out', 'test/data3/out.pptx', '--template', 'test/data3/in.pptx', '--model', 'test/data3/in.xlsx', '--debug']
75100

76-
## 実行
101+
# 実行
77102
cli.main()
78103

79-
## 変更したソースをリロードして実行
104+
# ソースコード変更後、リロードして再実行
80105
reload(sys.modules.get('pptx_template.xlsx_model'))
81106
reload(sys.modules.get('pptx_template.text'))
82107
reload(sys.modules.get('pptx_template.table'))
@@ -86,48 +111,24 @@ reload(sys.modules.get('pptx_template.cli'))
86111
cli.main()
87112
```
88113

89-
### コマンドラインで実行 ※githubに上がっているものの動作確認をしたい場合はこの方法
90-
91-
```
92-
## pptx_template --out {出力pptxファイルパス} --template {テンプレートpptxファイルパス} --model {設定xlsxファイルパス} --debug
93-
pptx_template --out test/data3/out.pptx --template test/data3/in.pptx --model test/data3/in.xlsx --debug
94-
```
95-
96-
### テスト実行
97-
98-
```
99-
pytest
100-
```
101-
102-
### ロールアウト手順
114+
### リリース手順
103115

104116
1. featureブランチを作成する
105117
2. 実装する
106-
3. 全pythonバージョンでtestが動くようにする
118+
3. 全Pythonバージョン(3.10, 3.11, 3.12, 3.13)でテストを実行する
107119
4. pushする
108-
5. github上でpull requestを作成する
120+
5. GitHub上でPull Requestを作成する
109121
6. コードレビューを依頼する
110-
7. QAを実施する(QAする人は、上記ローカル環境構築が必要)
111-
8. pll requestをマージする
122+
7. QAを実施する
123+
8. Pull Requestをマージする
112124
9. PyPIにアップロードする(PyPIのリポジトリ管理者のみ可)
113125

114-
### PyPIへのアップロード手順
126+
### PyPIへのアップロード
115127

116-
1. パッケージインストール
128+
```bash
129+
# ビルド
130+
uv build
117131

118-
```
119-
pip install wheel
120-
pip install twine
121-
```
122-
123-
2. コンパイル
124-
125-
```
126-
python setup.py bdist_wheel
127-
```
128-
129-
3. PyPIにアップロード
130-
131-
```
132-
twine upload dist/*
132+
# PyPIにアップロード
133+
uv publish
133134
```

0 commit comments

Comments
 (0)