py4project 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py4project-0.1.0/.github/workflows/publish.yml +89 -0
- py4project-0.1.0/.github/workflows/test.yml +65 -0
- py4project-0.1.0/.gitignore +8 -0
- py4project-0.1.0/LICENSE +21 -0
- py4project-0.1.0/PKG-INFO +65 -0
- py4project-0.1.0/README.md +41 -0
- py4project-0.1.0/examples/data_project.csv +18 -0
- py4project-0.1.0/examples/example.ipynb +964 -0
- py4project-0.1.0/pyproject.toml +39 -0
- py4project-0.1.0/src/py4project/__init__.py +23 -0
- py4project-0.1.0/src/py4project/core.py +633 -0
- py4project-0.1.0/tests/test_basic.py +236 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# GitHub 上で Release を「公開(published)」したときに PyPI へアップロードする。
|
|
4
|
+
# 手動実行(workflow_dispatch)を選ぶと TestPyPI へアップロードする。
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
name: 配布物をビルド
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: リポジトリをチェックアウト
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Python をセットアップ
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: ビルド用ツールをインストール
|
|
24
|
+
run: python -m pip install --upgrade pip build twine
|
|
25
|
+
|
|
26
|
+
- name: 配布物をビルド
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: メタデータを検査
|
|
30
|
+
run: python -m twine check dist/*
|
|
31
|
+
|
|
32
|
+
- name: 配布物を成果物として保存
|
|
33
|
+
uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
|
|
38
|
+
publish-to-pypi:
|
|
39
|
+
name: PyPI へ公開
|
|
40
|
+
# Release を公開したときだけ実行する
|
|
41
|
+
if: github.event_name == 'release'
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
|
|
45
|
+
# PyPI 側の Trusted Publisher 設定で指定する環境名。
|
|
46
|
+
# GitHub の Settings > Environments で "pypi" を作成しておく。
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/project/py4project/
|
|
50
|
+
|
|
51
|
+
permissions:
|
|
52
|
+
# Trusted Publishing(OIDC)に必要。API トークンは不要。
|
|
53
|
+
id-token: write
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- name: 配布物をダウンロード
|
|
57
|
+
uses: actions/download-artifact@v4
|
|
58
|
+
with:
|
|
59
|
+
name: dist
|
|
60
|
+
path: dist/
|
|
61
|
+
|
|
62
|
+
- name: PyPI へアップロード
|
|
63
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
64
|
+
|
|
65
|
+
publish-to-testpypi:
|
|
66
|
+
name: TestPyPI へ公開
|
|
67
|
+
# 手動実行したときだけ TestPyPI に上げる(本番前の確認用)
|
|
68
|
+
if: github.event_name == 'workflow_dispatch'
|
|
69
|
+
needs: build
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
|
|
72
|
+
environment:
|
|
73
|
+
name: testpypi
|
|
74
|
+
url: https://test.pypi.org/project/py4project/
|
|
75
|
+
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- name: 配布物をダウンロード
|
|
81
|
+
uses: actions/download-artifact@v4
|
|
82
|
+
with:
|
|
83
|
+
name: dist
|
|
84
|
+
path: dist/
|
|
85
|
+
|
|
86
|
+
- name: TestPyPI へアップロード
|
|
87
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
88
|
+
with:
|
|
89
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
# push と pull request のたびにテストを実行する。
|
|
4
|
+
# 手動実行(workflow_dispatch)も可能。
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [main]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
# 1つのバージョンが失敗しても他のバージョンのテストは最後まで走らせる
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: リポジトリをチェックアウト
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Python ${{ matrix.python-version }} をセットアップ
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
cache: pip
|
|
30
|
+
|
|
31
|
+
- name: 依存パッケージとパッケージ本体をインストール
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip
|
|
34
|
+
python -m pip install -e .
|
|
35
|
+
python -m pip install pytest
|
|
36
|
+
|
|
37
|
+
- name: インストールされたバージョンを記録
|
|
38
|
+
run: python -m pip list
|
|
39
|
+
|
|
40
|
+
- name: pytest を実行
|
|
41
|
+
# matplotlib が画面のない環境で動くように Agg バックエンドを使う
|
|
42
|
+
env:
|
|
43
|
+
MPLBACKEND: Agg
|
|
44
|
+
run: python -m pytest tests/ -v
|
|
45
|
+
|
|
46
|
+
build:
|
|
47
|
+
# 配布物が正しくビルドでき、PyPI のメタデータ検査を通ることを確認する
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: リポジトリをチェックアウト
|
|
51
|
+
uses: actions/checkout@v4
|
|
52
|
+
|
|
53
|
+
- name: Python をセットアップ
|
|
54
|
+
uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: "3.12"
|
|
57
|
+
|
|
58
|
+
- name: ビルド用ツールをインストール
|
|
59
|
+
run: python -m pip install --upgrade pip build twine
|
|
60
|
+
|
|
61
|
+
- name: 配布物をビルド
|
|
62
|
+
run: python -m build
|
|
63
|
+
|
|
64
|
+
- name: メタデータを検査
|
|
65
|
+
run: python -m twine check dist/*
|
py4project-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tetsugen HARUYAMA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: py4project
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 授業用回帰分析・散布図・バープロット・ボックスプロットのユーティリティ
|
|
5
|
+
Project-URL: Homepage, https://github.com/Py4Project/py4project
|
|
6
|
+
Project-URL: Repository, https://github.com/Py4Project/py4project
|
|
7
|
+
Project-URL: Issues, https://github.com/Py4Project/py4project/issues
|
|
8
|
+
Author-email: Tetsugen HARUYAMA <tetsu.yes@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: matplotlib,regional-economics,shift-share,statistics
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: Japanese
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: japanize-matplotlib-jlite
|
|
19
|
+
Requires-Dist: matplotlib>=3.9
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: pandas
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# py4project
|
|
26
|
+
|
|
27
|
+
授業用分析・可視化ユーティリティです。pandas DataFrame から回帰分析・散布図・横バープロット・ボックスプロットを簡単に作成できます。
|
|
28
|
+
|
|
29
|
+
## インストール
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install py4project
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 提供している関数
|
|
36
|
+
|
|
37
|
+
- `regression(x, y, data)` — 単回帰分析(R²、95%信頼区間、回帰式を表示)
|
|
38
|
+
- `regression_plot(x, y, data, ...)` — 散布図+回帰直線
|
|
39
|
+
- `scatter_plot(x, y, data, ...)` — 散布図+トレンド線(対数軸オプションあり)
|
|
40
|
+
- `bar_plot(x, data, ...)` — 横バープロット(複数系列・シフトシェア分解の配色に対応)
|
|
41
|
+
- `box_plot(x, data, ...)` — ボックスプロット(外れ値の自動ラベル表示、対数化オプションあり)
|
|
42
|
+
|
|
43
|
+
## 使用例
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import pandas as pd
|
|
47
|
+
from py4project import regression, bar_plot
|
|
48
|
+
|
|
49
|
+
df = pd.DataFrame({
|
|
50
|
+
"産業": ["製造業", "卸売業", "小売業"],
|
|
51
|
+
"全国成長効果": [120, 80, 60],
|
|
52
|
+
"産業構成効果": [-20, 10, 5],
|
|
53
|
+
"地域固有効果": [30, -5, 15],
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
bar_plot(["全国成長効果", "産業構成効果", "地域固有効果"], df, title="シフトシェア分解")
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 依存パッケージ
|
|
60
|
+
|
|
61
|
+
`numpy`, `pandas`, `scipy`, `matplotlib`, `japanize_matplotlib_jlite`(日本語フォントを自動設定します)
|
|
62
|
+
|
|
63
|
+
## ライセンス
|
|
64
|
+
|
|
65
|
+
MIT License
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# py4project
|
|
2
|
+
|
|
3
|
+
授業用分析・可視化ユーティリティです。pandas DataFrame から回帰分析・散布図・横バープロット・ボックスプロットを簡単に作成できます。
|
|
4
|
+
|
|
5
|
+
## インストール
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install py4project
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 提供している関数
|
|
12
|
+
|
|
13
|
+
- `regression(x, y, data)` — 単回帰分析(R²、95%信頼区間、回帰式を表示)
|
|
14
|
+
- `regression_plot(x, y, data, ...)` — 散布図+回帰直線
|
|
15
|
+
- `scatter_plot(x, y, data, ...)` — 散布図+トレンド線(対数軸オプションあり)
|
|
16
|
+
- `bar_plot(x, data, ...)` — 横バープロット(複数系列・シフトシェア分解の配色に対応)
|
|
17
|
+
- `box_plot(x, data, ...)` — ボックスプロット(外れ値の自動ラベル表示、対数化オプションあり)
|
|
18
|
+
|
|
19
|
+
## 使用例
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import pandas as pd
|
|
23
|
+
from py4project import regression, bar_plot
|
|
24
|
+
|
|
25
|
+
df = pd.DataFrame({
|
|
26
|
+
"産業": ["製造業", "卸売業", "小売業"],
|
|
27
|
+
"全国成長効果": [120, 80, 60],
|
|
28
|
+
"産業構成効果": [-20, 10, 5],
|
|
29
|
+
"地域固有効果": [30, -5, 15],
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
bar_plot(["全国成長効果", "産業構成効果", "地域固有効果"], df, title="シフトシェア分解")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 依存パッケージ
|
|
36
|
+
|
|
37
|
+
`numpy`, `pandas`, `scipy`, `matplotlib`, `japanize_matplotlib_jlite`(日本語フォントを自動設定します)
|
|
38
|
+
|
|
39
|
+
## ライセンス
|
|
40
|
+
|
|
41
|
+
MIT License
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
地域コード,地域,産業コード,産業,w2016,w2021,e2016,e2021
|
|
2
|
+
0,全国,AB,農林漁業,363024,453703,32676,42458
|
|
3
|
+
0,全国,C,鉱業,採石業,砂利採取業,19467,19697,1851,1865
|
|
4
|
+
0,全国,D,建設業,3690740,3737415,492734,485135
|
|
5
|
+
0,全国,E,製造業,8864253,8803643,454800,412617
|
|
6
|
+
0,全国,F,電気・ガス・熱供給・水道業,187818,202149,4654,9139
|
|
7
|
+
0,全国,G,情報通信業,1642042,1986839,63574,76559
|
|
8
|
+
0,全国,H,運輸業,郵便業,3197231,3264734,130459,128224
|
|
9
|
+
0,全国,I,卸売業,小売業,11843869,11611924,1355060,1228920
|
|
10
|
+
0,全国,J,金融業,保険業,1530002,1494436,84041,83852
|
|
11
|
+
0,全国,K,不動産業,物品賃貸業,1462395,1618138,353155,374456
|
|
12
|
+
0,全国,L,学術研究,専門・技術サービス業,1842795,2118920,223439,252340
|
|
13
|
+
0,全国,M,宿泊業,飲食サービス業,5362088,4678739,696396,599058
|
|
14
|
+
0,全国,N,生活関連サービス業,娯楽業,2420557,2176139,470713,434209
|
|
15
|
+
0,全国,O,教育,学習支援業,1827596,1950734,167662,163357
|
|
16
|
+
0,全国,P,医療,福祉,7374844,8162398,429173,462531
|
|
17
|
+
0,全国,Q,複合サービス事業,484260,435970,33780,32131
|
|
18
|
+
0,全国,R,サービス業(他に分類されないもの),4759845,5234337,346616,369212
|