top369 0.0.1__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.
- top369-0.0.1/LICENSE +21 -0
- top369-0.0.1/PKG-INFO +130 -0
- top369-0.0.1/README.md +111 -0
- top369-0.0.1/pyproject.toml +39 -0
- top369-0.0.1/setup.cfg +4 -0
- top369-0.0.1/src/top369/__init__.py +28 -0
- top369-0.0.1/src/top369/__main__.py +34 -0
- top369-0.0.1/src/top369/py.typed +0 -0
- top369-0.0.1/src/top369.egg-info/PKG-INFO +130 -0
- top369-0.0.1/src/top369.egg-info/SOURCES.txt +12 -0
- top369-0.0.1/src/top369.egg-info/dependency_links.txt +1 -0
- top369-0.0.1/src/top369.egg-info/entry_points.txt +2 -0
- top369-0.0.1/src/top369.egg-info/top_level.txt +1 -0
- top369-0.0.1/tests/test_smoke.py +26 -0
top369-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 top369 contributors
|
|
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.
|
top369-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: top369
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: top369 - a minimal, dependency-free Python package.
|
|
5
|
+
Author: top369 maintainers
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: top369
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# top369
|
|
21
|
+
|
|
22
|
+
一个最小化、零依赖的 Python 包骨架,可直接发布到 PyPI。
|
|
23
|
+
|
|
24
|
+
- 版本:0.0.1(Pre-Alpha)
|
|
25
|
+
- 依赖:无
|
|
26
|
+
- 支持:Python >= 3.9
|
|
27
|
+
|
|
28
|
+
## 为什么不做纯空包?
|
|
29
|
+
|
|
30
|
+
PyPI 的官方策略明确把「空包占名」列为无效项目:
|
|
31
|
+
|
|
32
|
+
> **Invalid projects** … project is name squatting (**package has no functionality or is empty**) …
|
|
33
|
+
> 这类项目会被直接从索引中移除。
|
|
34
|
+
> —— <https://docs.pypi.org/project-management/name-retention/>
|
|
35
|
+
|
|
36
|
+
也就是说,一个只含空 `__init__.py` 的包随时可能被管理员删掉,白忙一场。所以这里的做法是:
|
|
37
|
+
**保持体积最小的同时让它是一个真实可用的包**——能 import、有公开 API、有命令行入口、有测试。
|
|
38
|
+
这样它就不落进 "no functionality or is empty" 的判定里,名字也才真正守得住。
|
|
39
|
+
|
|
40
|
+
## 发布前先改这几处
|
|
41
|
+
|
|
42
|
+
1. `pyproject.toml` 里的 `description`、`authors`,以及被注释掉的 `[project.urls]`(填上仓库地址)。
|
|
43
|
+
2. `LICENSE` 里的版权主体。
|
|
44
|
+
3. `README.md` 改成你项目真正的内容。
|
|
45
|
+
|
|
46
|
+
## 本地安装与使用
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install -e .
|
|
50
|
+
python -m top369 # 打印包信息(JSON)
|
|
51
|
+
python -m top369 --version
|
|
52
|
+
top369 # console script
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
跑测试:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python -m pip install pytest
|
|
59
|
+
python -m pytest -q
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 发布到 PyPI
|
|
63
|
+
|
|
64
|
+
前置:注册 PyPI 账号并**开启两步验证**(PyPI 强制要求),然后在
|
|
65
|
+
<https://pypi.org/manage/account/token/> 创建 API token。
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 1) 安装构建与上传工具
|
|
69
|
+
python -m pip install --upgrade build twine
|
|
70
|
+
|
|
71
|
+
# 2) 清理旧产物并构建(会在 dist/ 生成 .tar.gz 与 .whl)
|
|
72
|
+
rm -rf dist build src/*.egg-info
|
|
73
|
+
python -m build
|
|
74
|
+
|
|
75
|
+
# 3) 先上传到 TestPyPI 试一遍(强烈建议)
|
|
76
|
+
python -m twine upload --repository testpypi dist/*
|
|
77
|
+
|
|
78
|
+
# 4) 确认无误后上传正式 PyPI
|
|
79
|
+
python -m twine upload dist/*
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
上传时:
|
|
83
|
+
- 用户名填 `__token__`
|
|
84
|
+
- 密码填 `pypi-` 开头的 token 原文
|
|
85
|
+
|
|
86
|
+
也可以写进 `~/.pypirc` 免得每次输入:
|
|
87
|
+
|
|
88
|
+
```ini
|
|
89
|
+
[distutils]
|
|
90
|
+
index-servers =
|
|
91
|
+
pypi
|
|
92
|
+
testpypi
|
|
93
|
+
|
|
94
|
+
[pypi]
|
|
95
|
+
username = __token__
|
|
96
|
+
password = pypi-xxxxxxxx
|
|
97
|
+
|
|
98
|
+
[testpypi]
|
|
99
|
+
repository = https://test.pypi.org/legacy/
|
|
100
|
+
username = __token__
|
|
101
|
+
password = pypi-xxxxxxxx
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> 注意:**PyPI 上的版本号只能前进不能复用**。同一个版本号即使删除后也无法重新上传,
|
|
105
|
+
> 所以每次改动记得升 `version`。
|
|
106
|
+
|
|
107
|
+
## 名字被占了怎么办?
|
|
108
|
+
|
|
109
|
+
PyPI 不做"占名"服务,但如果原持有者符合"被弃用"条件(联系不上 + 12 个月无发布 + 主页无活动),
|
|
110
|
+
可以走 PEP 541 流程申请转移:在 <https://github.com/pypi/support/issues> 用
|
|
111
|
+
`Name retention related request (PEP 541)` 模板提交。
|
|
112
|
+
|
|
113
|
+
## 目录结构
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
top369/
|
|
117
|
+
├─ pyproject.toml # 包元数据 + 构建配置
|
|
118
|
+
├─ README.md # 本文件(即 PyPI 项目页的正文)
|
|
119
|
+
├─ LICENSE # MIT
|
|
120
|
+
├─ .gitignore
|
|
121
|
+
├─ src/top369/
|
|
122
|
+
│ ├─ __init__.py # 公开 API:__version__ / info()
|
|
123
|
+
│ ├─ __main__.py # CLI 入口
|
|
124
|
+
│ └─ py.typed # 声明带类型标注
|
|
125
|
+
└─ tests/test_smoke.py
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|
top369-0.0.1/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# top369
|
|
2
|
+
|
|
3
|
+
一个最小化、零依赖的 Python 包骨架,可直接发布到 PyPI。
|
|
4
|
+
|
|
5
|
+
- 版本:0.0.1(Pre-Alpha)
|
|
6
|
+
- 依赖:无
|
|
7
|
+
- 支持:Python >= 3.9
|
|
8
|
+
|
|
9
|
+
## 为什么不做纯空包?
|
|
10
|
+
|
|
11
|
+
PyPI 的官方策略明确把「空包占名」列为无效项目:
|
|
12
|
+
|
|
13
|
+
> **Invalid projects** … project is name squatting (**package has no functionality or is empty**) …
|
|
14
|
+
> 这类项目会被直接从索引中移除。
|
|
15
|
+
> —— <https://docs.pypi.org/project-management/name-retention/>
|
|
16
|
+
|
|
17
|
+
也就是说,一个只含空 `__init__.py` 的包随时可能被管理员删掉,白忙一场。所以这里的做法是:
|
|
18
|
+
**保持体积最小的同时让它是一个真实可用的包**——能 import、有公开 API、有命令行入口、有测试。
|
|
19
|
+
这样它就不落进 "no functionality or is empty" 的判定里,名字也才真正守得住。
|
|
20
|
+
|
|
21
|
+
## 发布前先改这几处
|
|
22
|
+
|
|
23
|
+
1. `pyproject.toml` 里的 `description`、`authors`,以及被注释掉的 `[project.urls]`(填上仓库地址)。
|
|
24
|
+
2. `LICENSE` 里的版权主体。
|
|
25
|
+
3. `README.md` 改成你项目真正的内容。
|
|
26
|
+
|
|
27
|
+
## 本地安装与使用
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m pip install -e .
|
|
31
|
+
python -m top369 # 打印包信息(JSON)
|
|
32
|
+
python -m top369 --version
|
|
33
|
+
top369 # console script
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
跑测试:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m pip install pytest
|
|
40
|
+
python -m pytest -q
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 发布到 PyPI
|
|
44
|
+
|
|
45
|
+
前置:注册 PyPI 账号并**开启两步验证**(PyPI 强制要求),然后在
|
|
46
|
+
<https://pypi.org/manage/account/token/> 创建 API token。
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 1) 安装构建与上传工具
|
|
50
|
+
python -m pip install --upgrade build twine
|
|
51
|
+
|
|
52
|
+
# 2) 清理旧产物并构建(会在 dist/ 生成 .tar.gz 与 .whl)
|
|
53
|
+
rm -rf dist build src/*.egg-info
|
|
54
|
+
python -m build
|
|
55
|
+
|
|
56
|
+
# 3) 先上传到 TestPyPI 试一遍(强烈建议)
|
|
57
|
+
python -m twine upload --repository testpypi dist/*
|
|
58
|
+
|
|
59
|
+
# 4) 确认无误后上传正式 PyPI
|
|
60
|
+
python -m twine upload dist/*
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
上传时:
|
|
64
|
+
- 用户名填 `__token__`
|
|
65
|
+
- 密码填 `pypi-` 开头的 token 原文
|
|
66
|
+
|
|
67
|
+
也可以写进 `~/.pypirc` 免得每次输入:
|
|
68
|
+
|
|
69
|
+
```ini
|
|
70
|
+
[distutils]
|
|
71
|
+
index-servers =
|
|
72
|
+
pypi
|
|
73
|
+
testpypi
|
|
74
|
+
|
|
75
|
+
[pypi]
|
|
76
|
+
username = __token__
|
|
77
|
+
password = pypi-xxxxxxxx
|
|
78
|
+
|
|
79
|
+
[testpypi]
|
|
80
|
+
repository = https://test.pypi.org/legacy/
|
|
81
|
+
username = __token__
|
|
82
|
+
password = pypi-xxxxxxxx
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> 注意:**PyPI 上的版本号只能前进不能复用**。同一个版本号即使删除后也无法重新上传,
|
|
86
|
+
> 所以每次改动记得升 `version`。
|
|
87
|
+
|
|
88
|
+
## 名字被占了怎么办?
|
|
89
|
+
|
|
90
|
+
PyPI 不做"占名"服务,但如果原持有者符合"被弃用"条件(联系不上 + 12 个月无发布 + 主页无活动),
|
|
91
|
+
可以走 PEP 541 流程申请转移:在 <https://github.com/pypi/support/issues> 用
|
|
92
|
+
`Name retention related request (PEP 541)` 模板提交。
|
|
93
|
+
|
|
94
|
+
## 目录结构
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
top369/
|
|
98
|
+
├─ pyproject.toml # 包元数据 + 构建配置
|
|
99
|
+
├─ README.md # 本文件(即 PyPI 项目页的正文)
|
|
100
|
+
├─ LICENSE # MIT
|
|
101
|
+
├─ .gitignore
|
|
102
|
+
├─ src/top369/
|
|
103
|
+
│ ├─ __init__.py # 公开 API:__version__ / info()
|
|
104
|
+
│ ├─ __main__.py # CLI 入口
|
|
105
|
+
│ └─ py.typed # 声明带类型标注
|
|
106
|
+
└─ tests/test_smoke.py
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "top369"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "top369 - a minimal, dependency-free Python package."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "top369 maintainers" }]
|
|
14
|
+
keywords = ["top369"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
top369 = "top369.__main__:main"
|
|
28
|
+
|
|
29
|
+
# TODO 发布前填上你自己的仓库地址,例如:
|
|
30
|
+
# [project.urls]
|
|
31
|
+
# Homepage = "https://github.com/<you>/top369"
|
|
32
|
+
# Repository = "https://github.com/<you>/top369"
|
|
33
|
+
# Issues = "https://github.com/<you>/top369/issues"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.package-data]
|
|
39
|
+
top369 = ["py.typed"]
|
top369-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""top369 - a minimal, dependency-free Python package.
|
|
2
|
+
|
|
3
|
+
This is an intentionally tiny but *real* package: it imports, it exposes a
|
|
4
|
+
documented API, it ships a console script, and it has a test suite. Keeping it
|
|
5
|
+
real (rather than an empty placeholder) is deliberate - see "为什么不做纯空包"
|
|
6
|
+
in README.md.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
__all__ = ["__version__", "info"]
|
|
12
|
+
|
|
13
|
+
__version__ = "0.0.1"
|
|
14
|
+
|
|
15
|
+
_SUMMARY = "top369 - a minimal, dependency-free Python package."
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def info() -> dict[str, str]:
|
|
19
|
+
"""Return basic metadata about this package as a plain dict.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
A dict with the keys ``name``, ``version`` and ``summary``.
|
|
23
|
+
"""
|
|
24
|
+
return {
|
|
25
|
+
"name": "top369",
|
|
26
|
+
"version": __version__,
|
|
27
|
+
"summary": _SUMMARY,
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Command line entry point: ``python -m top369`` / ``top369``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from . import __version__, info
|
|
9
|
+
|
|
10
|
+
USAGE = "usage: top369 [-h | --version]"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main(argv: list[str] | None = None) -> int:
|
|
14
|
+
"""Run the CLI. Returns a process exit code."""
|
|
15
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
16
|
+
|
|
17
|
+
if args:
|
|
18
|
+
flag = args[0]
|
|
19
|
+
if flag in {"-h", "--help"}:
|
|
20
|
+
print(USAGE)
|
|
21
|
+
return 0
|
|
22
|
+
if flag in {"-V", "--version"}:
|
|
23
|
+
print(__version__)
|
|
24
|
+
return 0
|
|
25
|
+
print(f"top369: unrecognized argument: {flag}", file=sys.stderr)
|
|
26
|
+
print(USAGE, file=sys.stderr)
|
|
27
|
+
return 2
|
|
28
|
+
|
|
29
|
+
print(json.dumps(info(), indent=2, ensure_ascii=False))
|
|
30
|
+
return 0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
raise SystemExit(main())
|
|
File without changes
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: top369
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: top369 - a minimal, dependency-free Python package.
|
|
5
|
+
Author: top369 maintainers
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: top369
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# top369
|
|
21
|
+
|
|
22
|
+
一个最小化、零依赖的 Python 包骨架,可直接发布到 PyPI。
|
|
23
|
+
|
|
24
|
+
- 版本:0.0.1(Pre-Alpha)
|
|
25
|
+
- 依赖:无
|
|
26
|
+
- 支持:Python >= 3.9
|
|
27
|
+
|
|
28
|
+
## 为什么不做纯空包?
|
|
29
|
+
|
|
30
|
+
PyPI 的官方策略明确把「空包占名」列为无效项目:
|
|
31
|
+
|
|
32
|
+
> **Invalid projects** … project is name squatting (**package has no functionality or is empty**) …
|
|
33
|
+
> 这类项目会被直接从索引中移除。
|
|
34
|
+
> —— <https://docs.pypi.org/project-management/name-retention/>
|
|
35
|
+
|
|
36
|
+
也就是说,一个只含空 `__init__.py` 的包随时可能被管理员删掉,白忙一场。所以这里的做法是:
|
|
37
|
+
**保持体积最小的同时让它是一个真实可用的包**——能 import、有公开 API、有命令行入口、有测试。
|
|
38
|
+
这样它就不落进 "no functionality or is empty" 的判定里,名字也才真正守得住。
|
|
39
|
+
|
|
40
|
+
## 发布前先改这几处
|
|
41
|
+
|
|
42
|
+
1. `pyproject.toml` 里的 `description`、`authors`,以及被注释掉的 `[project.urls]`(填上仓库地址)。
|
|
43
|
+
2. `LICENSE` 里的版权主体。
|
|
44
|
+
3. `README.md` 改成你项目真正的内容。
|
|
45
|
+
|
|
46
|
+
## 本地安装与使用
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install -e .
|
|
50
|
+
python -m top369 # 打印包信息(JSON)
|
|
51
|
+
python -m top369 --version
|
|
52
|
+
top369 # console script
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
跑测试:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python -m pip install pytest
|
|
59
|
+
python -m pytest -q
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 发布到 PyPI
|
|
63
|
+
|
|
64
|
+
前置:注册 PyPI 账号并**开启两步验证**(PyPI 强制要求),然后在
|
|
65
|
+
<https://pypi.org/manage/account/token/> 创建 API token。
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 1) 安装构建与上传工具
|
|
69
|
+
python -m pip install --upgrade build twine
|
|
70
|
+
|
|
71
|
+
# 2) 清理旧产物并构建(会在 dist/ 生成 .tar.gz 与 .whl)
|
|
72
|
+
rm -rf dist build src/*.egg-info
|
|
73
|
+
python -m build
|
|
74
|
+
|
|
75
|
+
# 3) 先上传到 TestPyPI 试一遍(强烈建议)
|
|
76
|
+
python -m twine upload --repository testpypi dist/*
|
|
77
|
+
|
|
78
|
+
# 4) 确认无误后上传正式 PyPI
|
|
79
|
+
python -m twine upload dist/*
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
上传时:
|
|
83
|
+
- 用户名填 `__token__`
|
|
84
|
+
- 密码填 `pypi-` 开头的 token 原文
|
|
85
|
+
|
|
86
|
+
也可以写进 `~/.pypirc` 免得每次输入:
|
|
87
|
+
|
|
88
|
+
```ini
|
|
89
|
+
[distutils]
|
|
90
|
+
index-servers =
|
|
91
|
+
pypi
|
|
92
|
+
testpypi
|
|
93
|
+
|
|
94
|
+
[pypi]
|
|
95
|
+
username = __token__
|
|
96
|
+
password = pypi-xxxxxxxx
|
|
97
|
+
|
|
98
|
+
[testpypi]
|
|
99
|
+
repository = https://test.pypi.org/legacy/
|
|
100
|
+
username = __token__
|
|
101
|
+
password = pypi-xxxxxxxx
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> 注意:**PyPI 上的版本号只能前进不能复用**。同一个版本号即使删除后也无法重新上传,
|
|
105
|
+
> 所以每次改动记得升 `version`。
|
|
106
|
+
|
|
107
|
+
## 名字被占了怎么办?
|
|
108
|
+
|
|
109
|
+
PyPI 不做"占名"服务,但如果原持有者符合"被弃用"条件(联系不上 + 12 个月无发布 + 主页无活动),
|
|
110
|
+
可以走 PEP 541 流程申请转移:在 <https://github.com/pypi/support/issues> 用
|
|
111
|
+
`Name retention related request (PEP 541)` 模板提交。
|
|
112
|
+
|
|
113
|
+
## 目录结构
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
top369/
|
|
117
|
+
├─ pyproject.toml # 包元数据 + 构建配置
|
|
118
|
+
├─ README.md # 本文件(即 PyPI 项目页的正文)
|
|
119
|
+
├─ LICENSE # MIT
|
|
120
|
+
├─ .gitignore
|
|
121
|
+
├─ src/top369/
|
|
122
|
+
│ ├─ __init__.py # 公开 API:__version__ / info()
|
|
123
|
+
│ ├─ __main__.py # CLI 入口
|
|
124
|
+
│ └─ py.typed # 声明带类型标注
|
|
125
|
+
└─ tests/test_smoke.py
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/top369/__init__.py
|
|
5
|
+
src/top369/__main__.py
|
|
6
|
+
src/top369/py.typed
|
|
7
|
+
src/top369.egg-info/PKG-INFO
|
|
8
|
+
src/top369.egg-info/SOURCES.txt
|
|
9
|
+
src/top369.egg-info/dependency_links.txt
|
|
10
|
+
src/top369.egg-info/entry_points.txt
|
|
11
|
+
src/top369.egg-info/top_level.txt
|
|
12
|
+
tests/test_smoke.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
top369
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from top369 import __version__, info
|
|
4
|
+
from top369.__main__ import main
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_info_matches_version():
|
|
8
|
+
data = info()
|
|
9
|
+
assert data["name"] == "top369"
|
|
10
|
+
assert data["version"] == __version__
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_cli_version(capsys):
|
|
14
|
+
assert main(["--version"]) == 0
|
|
15
|
+
assert capsys.readouterr().out.strip() == __version__
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_cli_default_prints_json(capsys):
|
|
19
|
+
assert main([]) == 0
|
|
20
|
+
payload = json.loads(capsys.readouterr().out)
|
|
21
|
+
assert payload["name"] == "top369"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_cli_rejects_unknown_flag(capsys):
|
|
25
|
+
assert main(["--nope"]) == 2
|
|
26
|
+
assert "unrecognized" in capsys.readouterr().err
|