forked from SwanHubX/SwanLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
149 lines (124 loc) · 5.74 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# 在此处完成python项目的配置以及依赖安装
[build-system] # 指定构建系统与一些依赖
requires = [
"hatchling",
"hatch-requirements-txt",
"hatch-fancy-pypi-readme>=22.5.0",
]
build-backend = "hatchling.build"
[project]
name = "swanlab" # 项目名称
dynamic = ["version", "dependencies", "optional-dependencies", "readme"] # 动态配置版本,依赖,可选依赖,readme
description = "Python library for streamlined tracking and management of AI training processes." # 项目描述
license = "Apache-2.0" # 项目许可证
requires-python = ">=3.8" # python版本要求,我们只维护python3.8以上版本
authors = [ # 项目作者
{ name = "Cunyue", email = "[email protected]" },
{ name = "Feudalman", email = "[email protected]" },
{name="ZeYi Lin", email = "[email protected]"},
{name="KashiwaByte", email="[email protected]"}
]
keywords = [ # 项目关键词
"machine learning",
"reproducibility",
"visualization"
]
classifiers = [ # 项目分类
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Visualization',
]
[project.scripts] # 项目脚本
swanlab = "swanlab.cli:cli" # 项目命令行工具(可添加多个)
[project.urls] # 项目链接
"Homepage" = "https://swanhub.co"
"Source" = "https://github.com/SwanHubX/SwanLab"
"Bug Reports" = "https://github.com/SwanHubX/SwanLab/issues"
"Documentation" = "https://geektechstudio.feishu.cn/wiki/space/7310593325374013444?ccm_open_type=lark_wiki_spaceLink&open_tab_from=wiki_home"
[tool.hatch.version] # 动态设置项目版本
path = "swanlab/package.json" # package.json文件,从中获取版本号
pattern = ".*\"version\":\\s*\"(?P<version>[^\"]+)\""
[tool.hatch.metadata.hooks.requirements_txt] # 动态设置依赖
filename = "requirements.txt"
[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] # 动态设置可选依赖
oauth = ["requirements-swan.txt"] # 连接swanlab云端的可选依赖
[tool.hatch.metadata.hooks.fancy-pypi-readme] # 动态设置readme
content-type = "text/markdown"
fragments = [{ path = "README.md" }]
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # 动态设置readme中的图片链接,渲染为html格式,gradio设置了,暂时不知道有什么用
pattern = "(website/homepage|readme_files)/"
replacement = 'https://raw.githubusercontent.com/SwanHubX/swanlab/main/\g<1>/'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # 动态设置中文README跳转规则
pattern = "README_zh-hans.md"
replacement = 'https://github.com/SwanHubX/SwanLab/blob/main/README_zh-hans.md'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # 动态设置README跳转规则
pattern = "README.md"
replacement = "https://github.com/SwanHubX/SwanLab/blob/main/README.md"
[tool.hatch.build]
artifacts = [ # 将一些非python文件打包到项目中
"/swanlab/template",
"*.json",
"*.pyi", # 类型提示文件
]
# [tool.hatch.build.targets.wheel.hooks.custom] # 构建wheel时,用python执行一些脚本
# path = ".config/copy_frontend.py" # TODO 拷贝前端文件的脚本
[tool.hatch.build.targets.sdist] # 在执行构建之前,将一些必要文件拷贝到虚拟环境中,以便构建,此时已经完成了vue的编译
include = [
"/swanlab",
"/test", # 包含一些测试脚本,确保测试成功
"/README.md", # 包含readme
"/requirements.txt", # 包含依赖
"/requirements-swan.txt", # 包含可选依赖
"/.config/copy_frontend.py", # 包含拷贝前端文件的脚本
"/package.json", # 包含前端的package.json文件
]
[tool.hatch.build.targets.wheel]
packages = ["swanlab"] # 指定项目包名
[tool.pyright] # 静态类型检查
include = ["swanlab/**/*.py"] # 检查的文件
exclude = [] # 排除的文件
[tool.ruff] # 代码风格检查
target-version = "py37"
extend-select = ["B", "C", "I", "N", "SIM", "UP"]
ignore = [
"C901", # function is too complex (TODO: un-ignore this)
"B023", # function definition in loop (TODO: un-ignore this)
"B008", # function call in argument defaults
"B017", # pytest.raises considered evil
"B028", # explicit stacklevel for warnings
"E501", # from scripts/lint_backend.sh
"SIM105", # contextlib.suppress (has a performance cost)
"SIM117", # multiple nested with blocks (doesn't look good with gr.Row etc)
"UP007", # use X | Y for type annotations (TODO: can be enabled once Pydantic plays nice with them)
"UP006", # use `list` instead of `List` for type annotations (fails for 3.8)
]
exclude = []
# [tool.ruff.per-file-ignores] # 指定某些文件的忽略规则,暂时没什么用
# "目录/*" = [
# "E402", # Demos may have imports not at the top
# "E741", # Demos may have ambiguous variable names
# "F405", # Demos may use star imports
# "I", # Don't care about import order
# ]
# "目录/__init__.py" = [
# "F401", # "Imported but unused" (TODO: it would be better to be explicit and use __all__)
# ]
# "目录/routes.py" = [
# "UP006", # Pydantic on Python 3.7 requires old-style type annotations (TODO: drop when Python 3.7 is dropped)
# ]
# "目录/cli/commands/files/NoTemplateComponent.py" = ["ALL"]
# 可以在此处指定一些环境变量
[tool.pytest.ini_options]
# black配置,与构建无关
[tool.black]
line-length = 120