torch-rechub 0.0.3__tar.gz → 0.0.5__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.
- torch_rechub-0.0.5/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
- torch_rechub-0.0.5/.github/ISSUE_TEMPLATE/config.yml +7 -0
- torch_rechub-0.0.5/.github/ISSUE_TEMPLATE/feature_request.md +40 -0
- torch_rechub-0.0.5/.github/ISSUE_TEMPLATE/help_wanted.md +118 -0
- torch_rechub-0.0.5/.github/dependabot.yml +29 -0
- torch_rechub-0.0.5/.github/pull_request_template.md +33 -0
- torch_rechub-0.0.5/.github/release.yml +43 -0
- torch_rechub-0.0.5/.github/workflows/ci.yml +383 -0
- torch_rechub-0.0.5/.github/workflows/deploy.yml +37 -0
- torch_rechub-0.0.5/.gitignore +176 -0
- torch_rechub-0.0.5/.pre-commit-config.yaml +55 -0
- torch_rechub-0.0.5/CHANGELOG.md +83 -0
- torch_rechub-0.0.5/CODE_OF_CONDUCT.md +206 -0
- torch_rechub-0.0.5/CONTRIBUTING.md +244 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/LICENSE +21 -21
- torch_rechub-0.0.5/PKG-INFO +402 -0
- torch_rechub-0.0.5/README.md +354 -0
- torch_rechub-0.0.5/README_en.md +345 -0
- torch_rechub-0.0.5/config/.flake8 +73 -0
- torch_rechub-0.0.5/config/.pep8 +4 -0
- torch_rechub-0.0.5/config/.pre-commit-config.yaml +56 -0
- torch_rechub-0.0.5/config/CONFIG_GUIDE.md +682 -0
- torch_rechub-0.0.5/config/fix_encoding.py +59 -0
- torch_rechub-0.0.5/config/format_code.py +87 -0
- torch_rechub-0.0.5/config/pytest.ini +87 -0
- torch_rechub-0.0.5/docs/.vitepress/config.mts +154 -0
- torch_rechub-0.0.5/docs/.vitepress/theme/custom.css +394 -0
- torch_rechub-0.0.5/docs/.vitepress/theme/index.ts +27 -0
- torch_rechub-0.0.5/docs/.vitepress/theme/style.css +139 -0
- torch_rechub-0.0.5/docs/en/blog/hllm_reproduction.md +861 -0
- torch_rechub-0.0.5/docs/en/blog/match.md +126 -0
- torch_rechub-0.0.5/docs/en/blog/rank.md +8 -0
- torch_rechub-0.0.5/docs/en/contributing.md +176 -0
- torch_rechub-0.0.5/docs/en/index.md +52 -0
- torch_rechub-0.0.5/docs/en/introduction.md +78 -0
- torch_rechub-0.0.5/docs/en/manual/api-reference/basic.md +105 -0
- torch_rechub-0.0.5/docs/en/manual/api-reference/models.md +206 -0
- torch_rechub-0.0.5/docs/en/manual/api-reference/trainers.md +114 -0
- torch_rechub-0.0.5/docs/en/manual/api-reference/utils.md +163 -0
- torch_rechub-0.0.5/docs/en/manual/faq.md +85 -0
- torch_rechub-0.0.5/docs/en/manual/getting-started.md +63 -0
- torch_rechub-0.0.5/docs/en/manual/installation.md +95 -0
- torch_rechub-0.0.5/docs/en/manual/tutorials/matching.md +155 -0
- torch_rechub-0.0.5/docs/en/manual/tutorials/multi-task.md +195 -0
- torch_rechub-0.0.5/docs/en/manual/tutorials/ranking.md +186 -0
- torch_rechub-0.0.5/docs/public/favicon.ico +0 -0
- torch_rechub-0.0.5/docs/public/img/banner.png +0 -0
- torch_rechub-0.0.5/docs/public/img/logo.png +0 -0
- torch_rechub-0.0.5/docs/public/img/logo_with_name.png +0 -0
- torch_rechub-0.0.5/docs/public/img/project_framework.jpg +0 -0
- torch_rechub-0.0.5/docs/public/img/win_install_annoy_error.png +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1606.07792_l8JrVnuYXA.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1703.04247_sFSyE7q3U1.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1706.06978_0xZD_K10S2.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1708.05123_f3lKSqxIvw.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1711.00165_eosOSOmTfE.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1804.07931_ybf_jOAFRp.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1808.09781-3_bmRm284Rxd.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1808.09781v1.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/1905.06336_2oH3RMtROA.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2006.11632_qiN67CrHNs.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2020 (Tencent) (Recsys) [PLE] Progressive Layered .pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2102.09267_cdwBFKPCrj.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2105.08489-2_XnVVGxN9GG.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2203.06801v1-3_qUTY4TbvSL.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/2959100.2959190_jRzTU81Xmq.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/3219819.3219950_aTMFXHL3JB.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/3219819.3220007_zvaZg_CZ6z.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/4545-Article Text-7584-1-10-20190706.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/6c8a86c981a62b0126a11896b7f6ae0dae4c3566_1QYYhqJR8.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/Caruana1997_Article_MultitaskLearning_ySprcjzJ6v.pdf +0 -0
- Practical.pdf +0 -0
- torch_rechub-0.0.5/docs/public/pdf/cikm2013_DSSM_fullversion_c9ZSdM19XJ.pdf +0 -0
- torch_rechub-0.0.5/docs/zh/blog/hllm_reproduction.md +855 -0
- torch_rechub-0.0.5/docs/zh/blog/hstu_reproduction.md +254 -0
- torch_rechub-0.0.5/docs/zh/blog/match.md +126 -0
- torch_rechub-0.0.5/docs/zh/blog/rank.md +8 -0
- torch_rechub-0.0.5/docs/zh/contributing.md +176 -0
- torch_rechub-0.0.5/docs/zh/index.md +52 -0
- torch_rechub-0.0.5/docs/zh/introduction.md +78 -0
- torch_rechub-0.0.5/docs/zh/manual/api-reference/basic.md +105 -0
- torch_rechub-0.0.5/docs/zh/manual/api-reference/models.md +206 -0
- torch_rechub-0.0.5/docs/zh/manual/api-reference/trainers.md +114 -0
- torch_rechub-0.0.5/docs/zh/manual/api-reference/utils.md +163 -0
- torch_rechub-0.0.5/docs/zh/manual/faq.md +85 -0
- torch_rechub-0.0.5/docs/zh/manual/getting-started.md +70 -0
- torch_rechub-0.0.5/docs/zh/manual/installation.md +95 -0
- torch_rechub-0.0.5/docs/zh/manual/tutorials/matching.md +155 -0
- torch_rechub-0.0.5/docs/zh/manual/tutorials/multi-task.md +195 -0
- torch_rechub-0.0.5/docs/zh/manual/tutorials/ranking.md +186 -0
- torch_rechub-0.0.5/docs/zh//345/217/202/350/200/203/350/265/204/346/226/231//345/217/202/350/200/203/350/265/204/346/226/231.md +22 -0
- torch_rechub-0.0.5/examples/generative/data/amazon-books/README.md +96 -0
- torch_rechub-0.0.5/examples/generative/data/amazon-books/preprocess_amazon_books.py +245 -0
- torch_rechub-0.0.5/examples/generative/data/amazon-books/preprocess_amazon_books_hllm.py +208 -0
- torch_rechub-0.0.5/examples/generative/data/ml-1m/README +170 -0
- torch_rechub-0.0.5/examples/generative/data/ml-1m/preprocess_hllm_data.py +264 -0
- torch_rechub-0.0.5/examples/generative/data/ml-1m/preprocess_ml_hstu.py +402 -0
- torch_rechub-0.0.5/examples/generative/run_hllm_amazon_books.py +270 -0
- torch_rechub-0.0.5/examples/generative/run_hllm_movielens.py +372 -0
- torch_rechub-0.0.5/examples/generative/run_hstu_movielens.py +263 -0
- torch_rechub-0.0.5/examples/matching/README.md +101 -0
- torch_rechub-0.0.5/examples/matching/data/million-song-dataset/process_msd.py +72 -0
- torch_rechub-0.0.5/examples/matching/data/ml-1m/preprocess_ml.py +13 -0
- torch_rechub-0.0.5/examples/matching/data/session_based/preprocess_session_based.py +154 -0
- torch_rechub-0.0.5/examples/matching/data/yidian_news/preprocess.py +31 -0
- torch_rechub-0.0.5/examples/matching/movielens_utils.py +67 -0
- torch_rechub-0.0.5/examples/matching/run_ml_comirec.py +114 -0
- torch_rechub-0.0.5/examples/matching/run_ml_dssm.py +112 -0
- torch_rechub-0.0.5/examples/matching/run_ml_facebook_dssm.py +122 -0
- torch_rechub-0.0.5/examples/matching/run_ml_gru4rec.py +105 -0
- torch_rechub-0.0.5/examples/matching/run_ml_mind.py +105 -0
- torch_rechub-0.0.5/examples/matching/run_ml_sine.py +120 -0
- torch_rechub-0.0.5/examples/matching/run_ml_youtube_dnn.py +105 -0
- torch_rechub-0.0.5/examples/matching/run_ml_youtube_sbc.py +115 -0
- torch_rechub-0.0.5/examples/matching/run_sbr.py +116 -0
- torch_rechub-0.0.5/examples/ranking/README.md +190 -0
- torch_rechub-0.0.5/examples/ranking/data/ali-ccp/preprocess_ali_ccp.py +182 -0
- torch_rechub-0.0.5/examples/ranking/data/amazon-beauty/preprocess_amazon_beauty.py +28 -0
- torch_rechub-0.0.5/examples/ranking/data/amazon-books/preprocess_amazon_books.py +28 -0
- torch_rechub-0.0.5/examples/ranking/data/amazon-electronics/preprocess_amazon_electronics.py +49 -0
- torch_rechub-0.0.5/examples/ranking/data/avazu/download_avazu.py +29 -0
- torch_rechub-0.0.5/examples/ranking/data/census-income/preprocess_census.py +92 -0
- torch_rechub-0.0.5/examples/ranking/run_ali_ccp_ctr_ranking.py +79 -0
- torch_rechub-0.0.5/examples/ranking/run_ali_ccp_multi_task.py +111 -0
- torch_rechub-0.0.5/examples/ranking/run_aliexpress.py +79 -0
- torch_rechub-0.0.5/examples/ranking/run_amazon_electronics.py +81 -0
- torch_rechub-0.0.5/examples/ranking/run_avazu.py +190 -0
- torch_rechub-0.0.5/examples/ranking/run_census.py +115 -0
- torch_rechub-0.0.5/examples/ranking/run_criteo.py +112 -0
- torch_rechub-0.0.5/examples/ranking/run_gradnorm.py +94 -0
- torch_rechub-0.0.5/examples/ranking/run_metabalance.py +94 -0
- torch_rechub-0.0.5/package-lock.json +2287 -0
- torch_rechub-0.0.5/package.json +16 -0
- torch_rechub-0.0.5/pyproject.toml +134 -0
- torch_rechub-0.0.5/tests/test_e2e_matching.py +130 -0
- torch_rechub-0.0.5/tests/test_e2e_multitask.py +98 -0
- torch_rechub-0.0.5/tests/test_e2e_ranking.py +111 -0
- torch_rechub-0.0.5/tests/test_onnx_export.py +475 -0
- torch_rechub-0.0.5/tests/test_regularization.py +183 -0
- torch_rechub-0.0.5/torch_rechub/__init__.py +14 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/activation.py +54 -54
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/callback.py +33 -33
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/features.py +87 -94
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/initializers.py +92 -92
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/layers.py +994 -720
- torch_rechub-0.0.5/torch_rechub/basic/loss_func.py +223 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/basic/metaoptimizer.py +76 -72
- torch_rechub-0.0.5/torch_rechub/basic/metric.py +251 -0
- torch_rechub-0.0.5/torch_rechub/models/generative/__init__.py +6 -0
- torch_rechub-0.0.5/torch_rechub/models/generative/hllm.py +249 -0
- torch_rechub-0.0.5/torch_rechub/models/generative/hstu.py +189 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/__init__.py +13 -11
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/comirec.py +193 -188
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/dssm.py +72 -66
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/dssm_facebook.py +77 -79
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/dssm_senet.py +28 -16
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/gru4rec.py +85 -87
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/mind.py +103 -101
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/narm.py +82 -76
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/sasrec.py +143 -140
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/sine.py +148 -151
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/stamp.py +81 -83
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/youtube_dnn.py +75 -71
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/matching/youtube_sbc.py +98 -98
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/__init__.py +7 -5
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/aitm.py +83 -84
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/esmm.py +56 -55
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/mmoe.py +58 -58
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/ple.py +116 -130
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/multi_task/shared_bottom.py +45 -45
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/__init__.py +14 -11
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/afm.py +65 -63
- torch_rechub-0.0.5/torch_rechub/models/ranking/autoint.py +102 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/bst.py +61 -63
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/dcn.py +38 -38
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/dcn_v2.py +59 -69
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/deepffm.py +131 -123
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/deepfm.py +43 -42
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/dien.py +191 -191
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/din.py +93 -91
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/edcn.py +101 -117
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/fibinet.py +42 -50
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/models/ranking/widedeep.py +41 -41
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/trainers/__init__.py +4 -3
- torch_rechub-0.0.5/torch_rechub/trainers/ctr_trainer.py +288 -0
- torch_rechub-0.0.5/torch_rechub/trainers/match_trainer.py +336 -0
- torch_rechub-0.0.5/torch_rechub/trainers/matching.md +3 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/trainers/mtl_trainer.py +356 -207
- torch_rechub-0.0.5/torch_rechub/trainers/seq_trainer.py +427 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/utils/data.py +492 -360
- torch_rechub-0.0.5/torch_rechub/utils/hstu_utils.py +198 -0
- torch_rechub-0.0.5/torch_rechub/utils/match.py +457 -0
- torch_rechub-0.0.5/torch_rechub/utils/model_utils.py +233 -0
- {torch_rechub-0.0.3 → torch_rechub-0.0.5}/torch_rechub/utils/mtl.py +136 -126
- torch_rechub-0.0.5/torch_rechub/utils/onnx_export.py +220 -0
- torch_rechub-0.0.5/torch_rechub/utils/visualization.py +271 -0
- torch_rechub-0.0.5/tutorials/DIN.ipynb +784 -0
- torch_rechub-0.0.5/tutorials/DeepFM.ipynb +709 -0
- torch_rechub-0.0.5/tutorials/Matching.ipynb +909 -0
- torch_rechub-0.0.5/tutorials/Milvus.ipynb +621 -0
- torch_rechub-0.0.5/tutorials/Multi_Task.ipynb +424 -0
- torch_rechub-0.0.5/uv.lock +3798 -0
- torch_rechub-0.0.3/PKG-INFO +0 -177
- torch_rechub-0.0.3/README.md +0 -143
- torch_rechub-0.0.3/setup.cfg +0 -4
- torch_rechub-0.0.3/setup.py +0 -37
- torch_rechub-0.0.3/torch_rechub/basic/loss_func.py +0 -34
- torch_rechub-0.0.3/torch_rechub/basic/metric.py +0 -250
- torch_rechub-0.0.3/torch_rechub/trainers/ctr_trainer.py +0 -128
- torch_rechub-0.0.3/torch_rechub/trainers/match_trainer.py +0 -170
- torch_rechub-0.0.3/torch_rechub/utils/__init__.py +0 -0
- torch_rechub-0.0.3/torch_rechub/utils/match.py +0 -274
- torch_rechub-0.0.3/torch_rechub.egg-info/PKG-INFO +0 -177
- torch_rechub-0.0.3/torch_rechub.egg-info/SOURCES.txt +0 -58
- torch_rechub-0.0.3/torch_rechub.egg-info/dependency_links.txt +0 -1
- torch_rechub-0.0.3/torch_rechub.egg-info/requires.txt +0 -6
- torch_rechub-0.0.3/torch_rechub.egg-info/top_level.txt +0 -1
- {torch_rechub-0.0.3/torch_rechub → torch_rechub-0.0.5/torch_rechub/basic}/__init__.py +0 -0
- {torch_rechub-0.0.3/torch_rechub/basic → torch_rechub-0.0.5/torch_rechub/models}/__init__.py +0 -0
- {torch_rechub-0.0.3/torch_rechub/models → torch_rechub-0.0.5/torch_rechub/utils}/__init__.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report / Bug反馈
|
|
3
|
+
about: Report a bug to help us improve / 报告Bug帮助我们改进
|
|
4
|
+
title: '[BUG] '
|
|
5
|
+
labels: 'bug'
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Bug Description / Bug描述
|
|
10
|
+
|
|
11
|
+
Describe the bug you encountered / 描述您遇到的Bug
|
|
12
|
+
|
|
13
|
+
## Environment / 环境信息
|
|
14
|
+
|
|
15
|
+
- OS / 操作系统: [e.g. Ubuntu 20.04, Windows 10]
|
|
16
|
+
- Python: [e.g. 3.9]
|
|
17
|
+
- PyTorch: [e.g. 1.12.0]
|
|
18
|
+
- torch-rechub: [e.g. 0.0.4]
|
|
19
|
+
|
|
20
|
+
## To Reproduce / 复现步骤
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
# Minimal code to reproduce the issue / 最小复现代码
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Expected vs Actual / 期望 vs 实际
|
|
27
|
+
|
|
28
|
+
- **Expected / 期望**:
|
|
29
|
+
- **Actual / 实际**:
|
|
30
|
+
|
|
31
|
+
## Error Message / 错误信息
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
# Paste error message here / 粘贴错误信息
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Additional Context / 额外信息
|
|
38
|
+
|
|
39
|
+
Any other context about the problem / 其他相关信息
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request / 功能请求
|
|
3
|
+
about: Suggest a new model, dataset, or feature / 建议新模型、数据集或功能
|
|
4
|
+
title: '[FEATURE] '
|
|
5
|
+
labels: 'enhancement'
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Feature Type / 功能类型
|
|
10
|
+
|
|
11
|
+
What kind of feature are you requesting? / 您请求什么类型的功能?
|
|
12
|
+
|
|
13
|
+
- [ ] New model implementation / 新模型实现
|
|
14
|
+
- [ ] New dataset support / 新数据集支持
|
|
15
|
+
- [ ] API improvement / API改进
|
|
16
|
+
- [ ] Documentation / 文档改进
|
|
17
|
+
- [ ] Other / 其他
|
|
18
|
+
|
|
19
|
+
## Description / 描述
|
|
20
|
+
|
|
21
|
+
Describe what you would like to see added / 描述您希望添加的功能
|
|
22
|
+
|
|
23
|
+
## Motivation / 动机
|
|
24
|
+
|
|
25
|
+
Why is this feature useful for the recommender system community? / 为什么这个功能对推荐系统社区有用?
|
|
26
|
+
|
|
27
|
+
## Example Usage / 使用示例
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
# How would you like to use this feature? / 您希望如何使用这个功能?
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## References / 参考资料
|
|
34
|
+
|
|
35
|
+
- Paper/Blog: [Link if applicable / 相关论文或博客链接]
|
|
36
|
+
- Similar implementations: [Other libraries / 其他库的类似实现]
|
|
37
|
+
|
|
38
|
+
## Additional Context / 额外信息
|
|
39
|
+
|
|
40
|
+
Any other context or examples / 其他上下文或示例
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Help Wanted / 寻求帮助
|
|
3
|
+
about: Community contribution opportunities for torch-rechub development / torch-rechub开发的社区贡献机会
|
|
4
|
+
title: '[HELP WANTED] '
|
|
5
|
+
labels: 'help wanted, good first issue'
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 任务类型 / Task Type
|
|
10
|
+
|
|
11
|
+
请选择任务类型 / Please select the task type:
|
|
12
|
+
|
|
13
|
+
- [ ] 新模型实现 / New model implementation
|
|
14
|
+
- [ ] 数据集支持 / Dataset support
|
|
15
|
+
- [ ] 文档编写 / Documentation
|
|
16
|
+
- [ ] 教程制作 / Tutorial creation
|
|
17
|
+
- [ ] 代码优化 / Code optimization
|
|
18
|
+
- [ ] 测试用例 / Test cases
|
|
19
|
+
- [ ] Bug修复 / Bug fixes
|
|
20
|
+
- [ ] 其他 / Other
|
|
21
|
+
|
|
22
|
+
## 任务描述 / Task Description
|
|
23
|
+
|
|
24
|
+
### 背景 / Background
|
|
25
|
+
<!-- 描述任务的背景和重要性 / Describe the background and importance of the task -->
|
|
26
|
+
|
|
27
|
+
### 目标 / Objectives
|
|
28
|
+
<!-- 明确说明需要完成的具体目标 / Clearly state the specific objectives to be completed -->
|
|
29
|
+
|
|
30
|
+
### 详细要求 / Detailed Requirements
|
|
31
|
+
<!-- 列出具体的技术要求和实现细节 / List specific technical requirements and implementation details -->
|
|
32
|
+
|
|
33
|
+
## 技能要求 / Required Skills
|
|
34
|
+
|
|
35
|
+
### 必需技能 / Required Skills
|
|
36
|
+
- [ ] Python编程 / Python programming
|
|
37
|
+
- [ ] PyTorch框架 / PyTorch framework
|
|
38
|
+
- [ ] 推荐系统基础 / Recommender systems basics
|
|
39
|
+
- [ ] 其他: / Other:
|
|
40
|
+
|
|
41
|
+
### 加分技能 / Preferred Skills
|
|
42
|
+
- [ ] 深度学习 / Deep learning
|
|
43
|
+
- [ ] 机器学习 / Machine learning
|
|
44
|
+
- [ ] 数据处理 / Data processing
|
|
45
|
+
- [ ] 文档写作 / Technical writing
|
|
46
|
+
- [ ] 其他: / Other:
|
|
47
|
+
|
|
48
|
+
## 预期产出 / Expected Deliverables
|
|
49
|
+
|
|
50
|
+
- [ ] 代码实现 / Code implementation
|
|
51
|
+
- [ ] 单元测试 / Unit tests
|
|
52
|
+
- [ ] 文档更新 / Documentation updates
|
|
53
|
+
- [ ] 使用示例 / Usage examples
|
|
54
|
+
- [ ] 其他: / Other:
|
|
55
|
+
|
|
56
|
+
## 参考资料 / References
|
|
57
|
+
|
|
58
|
+
### 相关论文 / Related Papers
|
|
59
|
+
<!-- 提供相关的学术论文链接 / Provide links to relevant academic papers -->
|
|
60
|
+
|
|
61
|
+
### 代码参考 / Code References
|
|
62
|
+
<!-- 提供参考的代码实现或类似项目 / Provide reference implementations or similar projects -->
|
|
63
|
+
|
|
64
|
+
### 文档资源 / Documentation Resources
|
|
65
|
+
<!-- 提供相关的文档和教程链接 / Provide links to relevant documentation and tutorials -->
|
|
66
|
+
|
|
67
|
+
## 难度评估 / Difficulty Level
|
|
68
|
+
|
|
69
|
+
- [ ] 🟢 初级 (适合新手) / Beginner (Good for newcomers)
|
|
70
|
+
- [ ] 🟡 中级 (需要一定经验) / Intermediate (Requires some experience)
|
|
71
|
+
- [ ] 🔴 高级 (需要深入理解) / Advanced (Requires deep understanding)
|
|
72
|
+
|
|
73
|
+
## 预估工作量 / Estimated Effort
|
|
74
|
+
|
|
75
|
+
- [ ] 📅 1-3天 / 1-3 days
|
|
76
|
+
- [ ] 📅 1周 / 1 week
|
|
77
|
+
- [ ] 📅 2-4周 / 2-4 weeks
|
|
78
|
+
- [ ] 📅 1个月以上 / More than 1 month
|
|
79
|
+
|
|
80
|
+
## 贡献指南 / Contribution Guidelines
|
|
81
|
+
|
|
82
|
+
### 开始之前 / Before You Start
|
|
83
|
+
1. 请在评论中表明您的兴趣,避免重复工作 / Please comment to express your interest to avoid duplicate work
|
|
84
|
+
2. 阅读 [CONTRIBUTING.md](../../CONTRIBUTING.md) 了解开发流程 / Read CONTRIBUTING.md to understand the development process
|
|
85
|
+
3. 设置开发环境并熟悉项目结构 / Set up the development environment and familiarize yourself with the project structure
|
|
86
|
+
|
|
87
|
+
### 开发流程 / Development Process
|
|
88
|
+
1. Fork 项目并创建新分支 / Fork the project and create a new branch
|
|
89
|
+
2. 实现功能并编写测试 / Implement the feature and write tests
|
|
90
|
+
3. 运行代码格式化: `python config/format_code.py` / Run code formatting
|
|
91
|
+
4. 提交 Pull Request / Submit a Pull Request
|
|
92
|
+
|
|
93
|
+
### 代码规范 / Code Standards
|
|
94
|
+
- 遵循项目的代码风格 / Follow the project's code style
|
|
95
|
+
- 添加适当的注释和文档字符串 / Add appropriate comments and docstrings
|
|
96
|
+
- 确保所有测试通过 / Ensure all tests pass
|
|
97
|
+
- 更新相关文档 / Update relevant documentation
|
|
98
|
+
|
|
99
|
+
## 联系方式 / Contact Information
|
|
100
|
+
|
|
101
|
+
### 获取帮助 / Getting Help
|
|
102
|
+
- 💬 在此 Issue 下评论提问 / Comment on this issue with questions
|
|
103
|
+
- 📧 联系项目维护者: [morningsky](https://github.com/morningsky)
|
|
104
|
+
- 🔗 查看更多 Issues: [GitHub Issues](https://github.com/datawhalechina/torch-rechub/issues)
|
|
105
|
+
|
|
106
|
+
### 社区支持 / Community Support
|
|
107
|
+
- 📖 查看项目文档和示例 / Check project documentation and examples
|
|
108
|
+
- 🤝 与其他贡献者交流 / Communicate with other contributors
|
|
109
|
+
- ⭐ 关注项目更新 / Follow project updates
|
|
110
|
+
|
|
111
|
+
## 额外信息 / Additional Information
|
|
112
|
+
|
|
113
|
+
<!-- 添加任何其他相关信息、截图或示例 / Add any other relevant information, screenshots, or examples -->
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
**感谢您对 torch-rechub 项目的贡献兴趣!我们期待与您合作。**
|
|
118
|
+
**Thank you for your interest in contributing to torch-rechub! We look forward to working with you.**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
open-pull-requests-limit: 5
|
|
8
|
+
labels:
|
|
9
|
+
- "dependencies"
|
|
10
|
+
- "python"
|
|
11
|
+
commit-message:
|
|
12
|
+
prefix: "chore(deps)"
|
|
13
|
+
allow:
|
|
14
|
+
- dependency-type: "direct"
|
|
15
|
+
- dependency-type: "indirect"
|
|
16
|
+
ignore:
|
|
17
|
+
- dependency-name: "*"
|
|
18
|
+
update-types: ["version-update:semver-major"]
|
|
19
|
+
|
|
20
|
+
- package-ecosystem: "github-actions"
|
|
21
|
+
directory: "/"
|
|
22
|
+
schedule:
|
|
23
|
+
interval: "weekly"
|
|
24
|
+
open-pull-requests-limit: 2
|
|
25
|
+
labels:
|
|
26
|
+
- "dependencies"
|
|
27
|
+
- "github-actions"
|
|
28
|
+
commit-message:
|
|
29
|
+
prefix: "chore(actions)"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Pull Request / 拉取请求
|
|
2
|
+
|
|
3
|
+
## What does this PR do? / 这个PR做了什么?
|
|
4
|
+
|
|
5
|
+
Briefly describe your changes / 简要描述您的更改
|
|
6
|
+
|
|
7
|
+
## Type of Change / 变更类型
|
|
8
|
+
|
|
9
|
+
- [ ] 🐛 Bug fix / Bug修复
|
|
10
|
+
- [ ] ✨ New model/feature / 新模型/功能
|
|
11
|
+
- [ ] 📝 Documentation / 文档
|
|
12
|
+
- [ ] 🔧 Maintenance / 维护
|
|
13
|
+
|
|
14
|
+
## Related Issues / 相关Issues
|
|
15
|
+
|
|
16
|
+
Fixes #(issue number) / 修复 #(issue编号)
|
|
17
|
+
|
|
18
|
+
## How to Test / 如何测试
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
# Example of how to test your changes / 如何测试您的更改的示例
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Checklist / 检查清单
|
|
25
|
+
|
|
26
|
+
- [ ] Code follows project style (ran `python config/format_code.py`) / 代码遵循项目风格(运行了格式化脚本)
|
|
27
|
+
- [ ] Added tests for new functionality / 为新功能添加了测试
|
|
28
|
+
- [ ] Updated documentation if needed / 如需要已更新文档
|
|
29
|
+
- [ ] All tests pass locally / 所有测试在本地通过
|
|
30
|
+
|
|
31
|
+
## Additional Notes / 附加说明
|
|
32
|
+
|
|
33
|
+
Any other information for reviewers / 给审查者的其他信息
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# GitHub 自动生成 Release Notes 的配置
|
|
2
|
+
# 当你点击 "Generate release notes" 按钮时,会根据此配置生成内容
|
|
3
|
+
# 文档: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
|
|
4
|
+
|
|
5
|
+
changelog:
|
|
6
|
+
exclude:
|
|
7
|
+
labels:
|
|
8
|
+
- ignore-for-release
|
|
9
|
+
- duplicate
|
|
10
|
+
- invalid
|
|
11
|
+
- wontfix
|
|
12
|
+
authors:
|
|
13
|
+
- dependabot
|
|
14
|
+
- dependabot[bot]
|
|
15
|
+
|
|
16
|
+
categories:
|
|
17
|
+
- title: "✨ 新特性 / Features"
|
|
18
|
+
labels:
|
|
19
|
+
- enhancement
|
|
20
|
+
|
|
21
|
+
- title: "🐛 Bug 修复 / Bug Fixes"
|
|
22
|
+
labels:
|
|
23
|
+
- bug
|
|
24
|
+
|
|
25
|
+
- title: "⚡ 性能优化 / Performance"
|
|
26
|
+
labels:
|
|
27
|
+
- performance
|
|
28
|
+
|
|
29
|
+
- title: "📝 文档更新 / Documentation"
|
|
30
|
+
labels:
|
|
31
|
+
- documentation
|
|
32
|
+
|
|
33
|
+
- title: "🔧 模型更新 / Models"
|
|
34
|
+
labels:
|
|
35
|
+
- model
|
|
36
|
+
|
|
37
|
+
- title: "📦 依赖更新 / Dependencies"
|
|
38
|
+
labels:
|
|
39
|
+
- dependencies
|
|
40
|
+
|
|
41
|
+
- title: "🔄 其他变更 / Other Changes"
|
|
42
|
+
labels:
|
|
43
|
+
- "*"
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# ===================================================================
|
|
2
|
+
# CI/CD 流程配置 - 代码质量检查、测试、构建、发布
|
|
3
|
+
# ===================================================================
|
|
4
|
+
# 触发条件:
|
|
5
|
+
# - push/pull_request: 运行完整 CI 检查(lint, test, security, build)
|
|
6
|
+
# - release: 仅运行发布流程(跳过已执行的检查)
|
|
7
|
+
|
|
8
|
+
name: CI/CD Pipeline
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ main, develop ]
|
|
13
|
+
paths:
|
|
14
|
+
- 'torch_rechub/**'
|
|
15
|
+
- 'tutorials/**'
|
|
16
|
+
- 'examples/**'
|
|
17
|
+
- 'config/**'
|
|
18
|
+
- 'tests/**'
|
|
19
|
+
- 'pyproject.toml'
|
|
20
|
+
- '.github/workflows/ci.yml'
|
|
21
|
+
pull_request:
|
|
22
|
+
branches: [ main, develop ]
|
|
23
|
+
paths:
|
|
24
|
+
- 'torch_rechub/**'
|
|
25
|
+
- 'tutorials/**'
|
|
26
|
+
- 'examples/**'
|
|
27
|
+
- 'config/**'
|
|
28
|
+
- 'tests/**'
|
|
29
|
+
- 'pyproject.toml'
|
|
30
|
+
- '.github/workflows/ci.yml'
|
|
31
|
+
release:
|
|
32
|
+
types: [published]
|
|
33
|
+
|
|
34
|
+
# 环境变量
|
|
35
|
+
env:
|
|
36
|
+
PYTHON_VERSION: '3.9'
|
|
37
|
+
TORCH_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
# ===================================================================
|
|
41
|
+
# 代码质量检查 (仅在 push/PR 时运行,release 时跳过)
|
|
42
|
+
# ===================================================================
|
|
43
|
+
lint:
|
|
44
|
+
name: Code Quality Checks
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
# 跳过 release 事件,因为代码已在合并时检查过
|
|
47
|
+
if: github.event_name != 'release'
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- name: Checkout code
|
|
51
|
+
uses: actions/checkout@v6
|
|
52
|
+
|
|
53
|
+
- name: Set up Python
|
|
54
|
+
uses: actions/setup-python@v6
|
|
55
|
+
with:
|
|
56
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
57
|
+
|
|
58
|
+
- name: Cache pip packages
|
|
59
|
+
uses: actions/cache@v4
|
|
60
|
+
with:
|
|
61
|
+
path: ~/.cache/pip
|
|
62
|
+
key: ${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml') }}
|
|
63
|
+
restore-keys: |
|
|
64
|
+
${{ runner.os }}-pip-lint-
|
|
65
|
+
${{ runner.os }}-pip-
|
|
66
|
+
|
|
67
|
+
- name: Install Dependencies
|
|
68
|
+
run: |
|
|
69
|
+
pip install --upgrade pip
|
|
70
|
+
# 安装特定版本的格式化工具以确保一致性(与 pyproject.toml 保持一致)
|
|
71
|
+
pip install yapf==0.43.0 isort==5.13.2 flake8>=3.8.0 mypy>=0.800 toml>=0.10.2
|
|
72
|
+
|
|
73
|
+
- name: Format & Lint
|
|
74
|
+
run: |
|
|
75
|
+
# 步骤1: isort
|
|
76
|
+
isort --profile black torch_rechub/ examples/ tests/
|
|
77
|
+
# 步骤2: yapf
|
|
78
|
+
yapf_style="{based_on_style: google, column_limit: 248, join_multiple_lines: false, split_all_comma_separated_values: true, split_before_logical_operator: true, dedent_closing_brackets: true, align_closing_bracket_with_visual_indent: true, indent_width: 4}"
|
|
79
|
+
yapf --in-place --recursive --style="$yapf_style" torch_rechub/ examples/ tests/
|
|
80
|
+
|
|
81
|
+
# 步骤3: 检查工作区是否干净,确认所有格式化都已提交
|
|
82
|
+
git diff --exit-code
|
|
83
|
+
|
|
84
|
+
# 步骤4: 运行flake8进行最终的代码质量检查
|
|
85
|
+
flake8 --max-line-length=248 --extend-ignore=E203,W503,E501,E722,E402,F821,F523,E711,E741,F401,E265,C901,E301,E305,W293,E261,W291,W292,E111,E117,F841,E302 --max-complexity=30 torch_rechub/ examples/ tests/
|
|
86
|
+
|
|
87
|
+
- name: Type checking (MyPy) - Optional
|
|
88
|
+
continue-on-error: true
|
|
89
|
+
run: |
|
|
90
|
+
mypy torch_rechub/ --ignore-missing-imports
|
|
91
|
+
|
|
92
|
+
# ===================================================================
|
|
93
|
+
# 完整测试 (Python 3.9) - 运行所有测试和覆盖率报告
|
|
94
|
+
# (仅在 push/PR 时运行,release 时跳过)
|
|
95
|
+
# ===================================================================
|
|
96
|
+
test:
|
|
97
|
+
name: Full Test Suite (Python 3.9)
|
|
98
|
+
runs-on: ${{ matrix.os }}
|
|
99
|
+
needs: lint
|
|
100
|
+
if: github.event_name != 'release'
|
|
101
|
+
|
|
102
|
+
strategy:
|
|
103
|
+
fail-fast: false
|
|
104
|
+
matrix:
|
|
105
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
106
|
+
|
|
107
|
+
steps:
|
|
108
|
+
- name: Checkout code
|
|
109
|
+
uses: actions/checkout@v6
|
|
110
|
+
|
|
111
|
+
- name: Set up Python 3.9
|
|
112
|
+
uses: actions/setup-python@v6
|
|
113
|
+
with:
|
|
114
|
+
python-version: '3.9'
|
|
115
|
+
|
|
116
|
+
- name: Cache pip packages
|
|
117
|
+
uses: actions/cache@v4
|
|
118
|
+
with:
|
|
119
|
+
path: |
|
|
120
|
+
~/.cache/pip
|
|
121
|
+
~/.cache/torch
|
|
122
|
+
key: ${{ runner.os }}-py3.9-${{ hashFiles('pyproject.toml') }}
|
|
123
|
+
restore-keys: |
|
|
124
|
+
${{ runner.os }}-py3.9-
|
|
125
|
+
${{ runner.os }}-
|
|
126
|
+
|
|
127
|
+
- name: Install system dependencies (Ubuntu)
|
|
128
|
+
if: matrix.os == 'ubuntu-latest'
|
|
129
|
+
run: |
|
|
130
|
+
sudo apt-get update
|
|
131
|
+
sudo apt-get install -y build-essential
|
|
132
|
+
|
|
133
|
+
- name: Install dependencies
|
|
134
|
+
run: |
|
|
135
|
+
python -m pip install --upgrade pip
|
|
136
|
+
# Install CPU-only PyTorch for faster CI
|
|
137
|
+
pip install torch --index-url ${{ env.TORCH_INDEX_URL }}
|
|
138
|
+
# Install the package with dev and onnx dependencies
|
|
139
|
+
pip install -e ".[dev,onnx]" || pip install -r requirements-dev.txt && pip install -e .
|
|
140
|
+
|
|
141
|
+
- name: Run tests
|
|
142
|
+
run: |
|
|
143
|
+
pytest -c config/pytest.ini tests/ -v
|
|
144
|
+
|
|
145
|
+
- name: Run tests with coverage (Ubuntu only)
|
|
146
|
+
if: matrix.os == 'ubuntu-latest'
|
|
147
|
+
run: |
|
|
148
|
+
pytest -c config/pytest.ini tests/ -v --cov=torch_rechub --cov-report=xml --cov-report=term
|
|
149
|
+
|
|
150
|
+
- name: Upload coverage to Codecov
|
|
151
|
+
if: matrix.os == 'ubuntu-latest'
|
|
152
|
+
uses: codecov/codecov-action@v5
|
|
153
|
+
with:
|
|
154
|
+
files: ./coverage.xml
|
|
155
|
+
flags: unittests
|
|
156
|
+
name: codecov-umbrella
|
|
157
|
+
|
|
158
|
+
# ===================================================================
|
|
159
|
+
# 依赖兼容性验证 (Python 3.10+) - 仅验证依赖安装成功
|
|
160
|
+
# (仅在 push/PR 时运行,release 时跳过)
|
|
161
|
+
# ===================================================================
|
|
162
|
+
compatibility:
|
|
163
|
+
name: Dependency Check (Python ${{ matrix.python-version }})
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
needs: lint
|
|
166
|
+
if: github.event_name != 'release'
|
|
167
|
+
|
|
168
|
+
strategy:
|
|
169
|
+
fail-fast: false
|
|
170
|
+
matrix:
|
|
171
|
+
python-version: ['3.10', '3.11', '3.12', '3.13']
|
|
172
|
+
|
|
173
|
+
steps:
|
|
174
|
+
- name: Checkout code
|
|
175
|
+
uses: actions/checkout@v6
|
|
176
|
+
|
|
177
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
178
|
+
uses: actions/setup-python@v6
|
|
179
|
+
with:
|
|
180
|
+
python-version: ${{ matrix.python-version }}
|
|
181
|
+
|
|
182
|
+
- name: Install dependencies
|
|
183
|
+
run: |
|
|
184
|
+
python -m pip install --upgrade pip
|
|
185
|
+
# Install CPU-only PyTorch for faster CI
|
|
186
|
+
pip install torch --index-url ${{ env.TORCH_INDEX_URL }}
|
|
187
|
+
# Verify package installation with all optional dependencies
|
|
188
|
+
pip install -e ".[dev,onnx]"
|
|
189
|
+
|
|
190
|
+
- name: Verify imports
|
|
191
|
+
run: |
|
|
192
|
+
python -c "import torch_rechub; print(f'torch-rechub {torch_rechub.__version__ if hasattr(torch_rechub, \"__version__\") else \"installed\"} on Python ${{ matrix.python-version }}')"
|
|
193
|
+
python -c "import onnx; import onnxruntime; print('ONNX dependencies OK')"
|
|
194
|
+
|
|
195
|
+
# ===================================================================
|
|
196
|
+
# 安全检查 (仅在 push/PR 时运行,release 时跳过)
|
|
197
|
+
# ===================================================================
|
|
198
|
+
security:
|
|
199
|
+
name: Security Scan
|
|
200
|
+
runs-on: ubuntu-latest
|
|
201
|
+
needs: lint
|
|
202
|
+
if: github.event_name != 'release'
|
|
203
|
+
|
|
204
|
+
steps:
|
|
205
|
+
- name: Checkout code
|
|
206
|
+
uses: actions/checkout@v6
|
|
207
|
+
|
|
208
|
+
- name: Set up Python
|
|
209
|
+
uses: actions/setup-python@v6
|
|
210
|
+
with:
|
|
211
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
212
|
+
|
|
213
|
+
- name: Install bandit
|
|
214
|
+
run: |
|
|
215
|
+
python -m pip install --upgrade pip
|
|
216
|
+
pip install bandit
|
|
217
|
+
|
|
218
|
+
- name: Run security scan
|
|
219
|
+
run: |
|
|
220
|
+
bandit -r torch_rechub/ -s B101,B311,B614 -x tests,docs,examples -f json -o bandit-report.json || true
|
|
221
|
+
bandit -r torch_rechub/ -s B101,B311,B614 -x tests,docs,examples -f txt
|
|
222
|
+
|
|
223
|
+
- name: Upload security scan results
|
|
224
|
+
uses: actions/upload-artifact@v5
|
|
225
|
+
if: always()
|
|
226
|
+
with:
|
|
227
|
+
name: bandit-security-report
|
|
228
|
+
path: bandit-report.json
|
|
229
|
+
|
|
230
|
+
# ===================================================================
|
|
231
|
+
# 构建检查 (仅在 push/PR 时运行,release 时跳过)
|
|
232
|
+
# ===================================================================
|
|
233
|
+
build:
|
|
234
|
+
name: Build Package
|
|
235
|
+
runs-on: ubuntu-latest
|
|
236
|
+
needs: [test, compatibility, security]
|
|
237
|
+
if: github.event_name != 'release'
|
|
238
|
+
|
|
239
|
+
steps:
|
|
240
|
+
- name: Checkout code
|
|
241
|
+
uses: actions/checkout@v6
|
|
242
|
+
|
|
243
|
+
- name: Set up Python
|
|
244
|
+
uses: actions/setup-python@v6
|
|
245
|
+
with:
|
|
246
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
247
|
+
|
|
248
|
+
- name: Install build dependencies
|
|
249
|
+
run: |
|
|
250
|
+
python -m pip install --upgrade pip
|
|
251
|
+
pip install build twine wheel setuptools
|
|
252
|
+
|
|
253
|
+
- name: Build package
|
|
254
|
+
run: |
|
|
255
|
+
python -m build
|
|
256
|
+
|
|
257
|
+
- name: Check package
|
|
258
|
+
run: |
|
|
259
|
+
twine check dist/*
|
|
260
|
+
|
|
261
|
+
- name: Upload build artifacts
|
|
262
|
+
uses: actions/upload-artifact@v5
|
|
263
|
+
with:
|
|
264
|
+
name: dist-packages
|
|
265
|
+
path: dist/
|
|
266
|
+
|
|
267
|
+
# ===================================================================
|
|
268
|
+
# 自动发布到 PyPI 和 GitHub Release (使用 uv)
|
|
269
|
+
# 功能:
|
|
270
|
+
# - 从 GitHub Release 自动同步版本号
|
|
271
|
+
# - 更新 CHANGELOG.md
|
|
272
|
+
# - 构建并发布到 PyPI
|
|
273
|
+
# - 上传构建产物到 GitHub Release 页面
|
|
274
|
+
# 注意:此 job 仅在 release 事件时运行,不依赖其他 job(代码已在合并时检查过)
|
|
275
|
+
# ===================================================================
|
|
276
|
+
publish:
|
|
277
|
+
name: Publish to PyPI & GitHub Release
|
|
278
|
+
runs-on: ubuntu-latest
|
|
279
|
+
# 不再依赖 build job,直接运行(代码质量已在 PR 合并时验证)
|
|
280
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
281
|
+
environment: pypi
|
|
282
|
+
permissions:
|
|
283
|
+
id-token: write # Required for trusted publishing
|
|
284
|
+
contents: write # Required for pushing changes and uploading release assets
|
|
285
|
+
|
|
286
|
+
steps:
|
|
287
|
+
- name: Checkout code
|
|
288
|
+
uses: actions/checkout@v6
|
|
289
|
+
with:
|
|
290
|
+
ref: main
|
|
291
|
+
fetch-depth: 0
|
|
292
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
293
|
+
|
|
294
|
+
- name: Get version from tag
|
|
295
|
+
id: get_version
|
|
296
|
+
run: |
|
|
297
|
+
# 从 tag 提取版本号 (去掉 v 前缀)
|
|
298
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
299
|
+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
300
|
+
echo "📦 Version: $VERSION"
|
|
301
|
+
|
|
302
|
+
- name: Update version in pyproject.toml
|
|
303
|
+
run: |
|
|
304
|
+
# 更新 pyproject.toml 中的版本号
|
|
305
|
+
sed -i "s/^version = \".*\"/version = \"${{ steps.get_version.outputs.VERSION }}\"/" pyproject.toml
|
|
306
|
+
echo "✅ Updated pyproject.toml version to ${{ steps.get_version.outputs.VERSION }}"
|
|
307
|
+
grep "^version" pyproject.toml
|
|
308
|
+
|
|
309
|
+
- name: Update CHANGELOG.md
|
|
310
|
+
env:
|
|
311
|
+
RELEASE_BODY: ${{ github.event.release.body }}
|
|
312
|
+
RELEASE_NAME: ${{ github.event.release.name }}
|
|
313
|
+
run: |
|
|
314
|
+
VERSION="${{ steps.get_version.outputs.VERSION }}"
|
|
315
|
+
DATE=$(date +%Y-%m-%d)
|
|
316
|
+
|
|
317
|
+
# 创建新的 changelog 条目
|
|
318
|
+
NEW_ENTRY="## [${VERSION}] - ${DATE}
|
|
319
|
+
|
|
320
|
+
${RELEASE_BODY}
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
"
|
|
325
|
+
|
|
326
|
+
# 在第一个 --- 分隔符之后插入新版本记录
|
|
327
|
+
awk -v entry="$NEW_ENTRY" '
|
|
328
|
+
!found && /^---$/ { print; print ""; print entry; found=1; next }
|
|
329
|
+
{ print }
|
|
330
|
+
' CHANGELOG.md > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md
|
|
331
|
+
|
|
332
|
+
echo "✅ Updated CHANGELOG.md with version $VERSION"
|
|
333
|
+
|
|
334
|
+
- name: Commit and push changes
|
|
335
|
+
run: |
|
|
336
|
+
git config user.name "github-actions[bot]"
|
|
337
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
338
|
+
|
|
339
|
+
git add pyproject.toml CHANGELOG.md
|
|
340
|
+
|
|
341
|
+
# 检查是否有变更
|
|
342
|
+
if git diff --staged --quiet; then
|
|
343
|
+
echo "No changes to commit"
|
|
344
|
+
else
|
|
345
|
+
git commit -m "chore(release): v${{ steps.get_version.outputs.VERSION }} [skip ci]"
|
|
346
|
+
git push origin main
|
|
347
|
+
echo "✅ Pushed version changes to main branch"
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
- name: Install uv
|
|
351
|
+
uses: astral-sh/setup-uv@v4
|
|
352
|
+
with:
|
|
353
|
+
version: "latest"
|
|
354
|
+
|
|
355
|
+
- name: Set up Python
|
|
356
|
+
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
357
|
+
|
|
358
|
+
- name: Build package with uv
|
|
359
|
+
id: build
|
|
360
|
+
run: |
|
|
361
|
+
uv build
|
|
362
|
+
echo "✅ Package built successfully"
|
|
363
|
+
ls -la dist/
|
|
364
|
+
# 输出构建产物文件名供后续步骤使用
|
|
365
|
+
echo "WHEEL_FILE=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
|
|
366
|
+
echo "SDIST_FILE=$(ls dist/*.tar.gz)" >> $GITHUB_OUTPUT
|
|
367
|
+
|
|
368
|
+
- name: Publish to PyPI
|
|
369
|
+
env:
|
|
370
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
371
|
+
run: |
|
|
372
|
+
uv publish
|
|
373
|
+
echo "🚀 Published to PyPI successfully!"
|
|
374
|
+
|
|
375
|
+
- name: Upload release assets to GitHub Release
|
|
376
|
+
uses: softprops/action-gh-release@v2
|
|
377
|
+
with:
|
|
378
|
+
files: |
|
|
379
|
+
dist/*.whl
|
|
380
|
+
dist/*.tar.gz
|
|
381
|
+
fail_on_unmatched_files: true
|
|
382
|
+
env:
|
|
383
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|