@@ -9,7 +9,7 @@ This helps your routine reporting work that have many manual copy-paste from exc
99 - Building a new powerpoint presentation file from a "template" pptx file which contains "id"
1010 - Import some strings and CSV data which is defined in a JSON config file or a Python dict
1111 - "id" in pptx template is expressed as a tiny DSL, like "{sales.0.june.us}"
12- - requires python envirionment (2 or 3), pandas, python-pptx
12+ - requires python envirionment (3), pandas, python-pptx
1313 - for now, only UTF-8 encoding is supported for json, csv
1414
1515### Text substitution
@@ -25,7 +25,7 @@ pptx-template は pptx のテンプレートを元に、別途用意した JSON
2525定型レポートなどで大量のグラフ付きスライドを作成する際の作業を代行してくれます。
2626
2727 - テンプレートには "{sales.0.june.us}" のような形で JSON内の値を指す id を記入できます
28- - python 2 または 3, pandas, pptx に依存しています
28+ - python 3, pandas, pptx に依存しています
2929 - 扱う json や csv の 文字コードは utf-8 前提です
3030
3131## Getting started
@@ -40,3 +40,101 @@ $ echo '{ "slides": [ { "greeting" : "Hello!!" } ] }' > model.json
4040
4141$ pptx-template --out out.pptx --template test.pptx --model model.json
4242```
43+
44+ ## Development (Japanese)
45+
46+ ### インストールの流れ
47+
48+ pyenvをインストールしておく
49+ ```
50+ git clone https://github.com/m3dev/pptx-template.git
51+
52+ pyenv install 3.7.1 # Pythonをインストール
53+ pyenv shell 3.7.1 # シェルで使うPython
54+
55+ venv .venv # 開発用の仮想環境を作成
56+ source .venv/bin/activate # 仮想環境を使用する
57+
58+ python setup.py develop # パッケージを開発用にインストール&依存パッケージをインストール
59+ pip install -r requirements.txt # 開発用のパッケージをインストール
60+ ```
61+
62+ ### REPLで実行 ※開発時はこの方法
63+
64+ pythonのREPLを起動
65+
66+ ```
67+ cd {プロジェクトフォルダ}
68+ pyenv shell 3.7.1
69+ python
70+ ```
71+
72+ REPL内で実行
73+
74+ ```
75+ import sys
76+ from importlib import reload
77+ import pptx_template.cli as cli
78+
79+
80+ ## 実行引数設定
81+ ## sys.argv = ['{pyファイル名}', '--out', '{出力pptxファイルパス}', '--template', '{テンプレートpptxファイルパス}', '--model', '{設定xlsxファイルパス}', '--debug']
82+ ## 以下の設定でテストファイルにて実行できます
83+ sys.argv = ['dummy.py', '--out', 'test/data3/out.pptx', '--template', 'test/data3/in.pptx', '--model', 'test/data3/in.xlsx', '--debug']
84+
85+ ## 実行
86+ cli.main()
87+
88+ ## 変更したソースをリロードして実行
89+ reload(sys.modules.get('pptx_template.xlsx_model'))
90+ reload(sys.modules.get('pptx_template.text'))
91+ reload(sys.modules.get('pptx_template.table'))
92+ reload(sys.modules.get('pptx_template.chart'))
93+ reload(sys.modules.get('pptx_template.core'))
94+ reload(sys.modules.get('pptx_template.cli'))
95+ cli.main()
96+ ```
97+
98+ ### コマンドラインで実行 ※githubに上がっているものの動作確認をしたい場合はこの方法
99+
100+ ```
101+ ## pptx_template --out {出力pptxファイルパス} --template {テンプレートpptxファイルパス} --model {設定xlsxファイルパス} --debug
102+ pptx_template --out test/data3/out.pptx --template test/data3/in.pptx --model test/data3/in.xlsx --debug
103+ ```
104+
105+ ### テスト実行
106+
107+ ```
108+ pytest
109+ ```
110+
111+ ### ロールアウト手順
112+ 1 . featureブランチを作成する
113+ 2 . 実装する
114+ 3 . 全pythonバージョンでtestが動くようにする
115+ 4 . pushする
116+ 5 . github上でpull requestを作成する
117+ 6 . コードレビューを依頼する
118+ 7 . QAを実施する(QAする人は、上記ローカル環境構築が必要)
119+ 8 . pll requestをマージする
120+ 9 . PyPIにアップロードする(PyPIのリポジトリ管理者のみ可)
121+
122+ ### PyPIへのアップロード手順
123+ 1 . パッケージインストール
124+
125+ ```
126+ pip install wheel
127+ pip install twine
128+ ```
129+
130+ 2 . コンパイル
131+
132+ ```
133+ python setup.py bdist_wheel
134+ ```
135+
136+ 3 . PyPIにアップロード
137+
138+ ```
139+ twine upload dist/*
140+ ```
0 commit comments