flaxfile 1.0.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.
@@ -0,0 +1,155 @@
1
+ examples/
2
+ CACHE_LMDB
3
+ CHACHE_SQLITE3.db
4
+ CACHE_LEVELDB
5
+ Log
6
+ FLAXKV_DB
7
+ test_db/
8
+
9
+ /data/
10
+
11
+ /kunyuan*
12
+
13
+ /train_data_preview
14
+ # Configuration files (may contain passwords)
15
+ flaxkv.toml
16
+ .flaxkv.toml
17
+ *secret*.toml
18
+ *password*.toml
19
+
20
+ .pyc
21
+ .idea
22
+ .ipynb_checkpoints
23
+ .pytest_cache
24
+
25
+
26
+
27
+ # Byte-compiled / optimized / DLL files
28
+ __pycache__/
29
+ *.py[cod]
30
+ *$py.class
31
+
32
+ # C extensions
33
+ *.so
34
+
35
+ # Distribution / packaging
36
+ .Python
37
+ build/
38
+ develop-eggs/
39
+ dist/
40
+ downloads/
41
+ eggs/
42
+ .eggs/
43
+ lib/
44
+ lib64/
45
+ parts/
46
+ sdist/
47
+ var/
48
+ wheels/
49
+ pip-wheel-metadata/
50
+ share/python-wheels/
51
+ *.egg-info/
52
+ .installed.cfg
53
+ *.egg
54
+ MANIFEST
55
+
56
+ # PyInstaller
57
+ # Usually these files are written by a python script from a template
58
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
59
+ *.manifest
60
+ *.spec
61
+
62
+ # Installer logs
63
+ pip-log.txt
64
+ pip-delete-this-directory.txt
65
+
66
+ # Unit test / coverage reports
67
+ htmlcov/
68
+ .tox/
69
+ .nox/
70
+ .coverage
71
+ .coverage.*
72
+ .cache
73
+ nosetests.xml
74
+ coverage.xml
75
+ *.cover
76
+ *.py,cover
77
+ .hypothesis/
78
+ .pytest_cache/
79
+
80
+ # Translations
81
+ *.mo
82
+ *.pot
83
+
84
+ # Django stuff:
85
+ *.log
86
+ local_settings.py
87
+ db.sqlite3
88
+ db.sqlite3-journal
89
+
90
+ # Flask stuff:
91
+ instance/
92
+ .webassets-cache
93
+
94
+ # Scrapy stuff:
95
+ .scrapy
96
+
97
+ # Sphinx documentation
98
+ docs/_build/
99
+
100
+ # PyBuilder
101
+ target/
102
+
103
+ # Jupyter Notebook
104
+ .ipynb_checkpoints
105
+
106
+ # IPython
107
+ profile_default/
108
+ ipython_config.py
109
+
110
+ # pyenv
111
+ .python-version
112
+
113
+ # pipenv
114
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
115
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
116
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
117
+ # install all needed dependencies.
118
+ #Pipfile.lock
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .venv
132
+ env/
133
+ venv/
134
+ ENV/
135
+ env.bak/
136
+ venv.bak/
137
+
138
+ # Spyder project settings
139
+ .spyderproject
140
+ .spyproject
141
+
142
+ # Rope project settings
143
+ .ropeproject
144
+
145
+ # mkdocs documentation
146
+ /site
147
+
148
+ # mypy
149
+ .mypy_cache/
150
+ .dmypy.json
151
+ dmypy.json
152
+
153
+ # Pyre type checker
154
+ .pyre/
155
+ .vercel
@@ -0,0 +1,292 @@
1
+ Metadata-Version: 2.4
2
+ Name: flaxfile
3
+ Version: 1.0.0
4
+ Summary: 高性能文件传输工具 - 基于ZMQ优化的跨网络文件传输系统
5
+ Project-URL: Homepage, https://github.com/KenyonY/flaxkv
6
+ Project-URL: Documentation, https://github.com/KenyonY/flaxkv/tree/main/flaxfile#flaxfile
7
+ Project-URL: Issues, https://github.com/KenyonY/flaxkv/issues
8
+ Project-URL: Source, https://github.com/KenyonY/flaxkv/tree/main/flaxfile
9
+ Author-email: "K.Y" <beidongjiedeguang@gmail.com>
10
+ License: MIT
11
+ Keywords: file-transfer,high-performance,network,streaming,zmq
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: System :: Networking
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.8
25
+ Requires-Dist: fire>=0.5.0
26
+ Requires-Dist: pyzmq>=25.0.0
27
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # FlaxFile - 高性能文件传输工具
31
+
32
+ 基于ZMQ优化的跨网络文件传输系统,专为大文件高速传输设计。
33
+
34
+ ## ⚡ 性能
35
+
36
+ - **本地测试**: 3800+ MB/s
37
+ - **1Gbps网络**: 110-125 MB/s(跑满带宽)
38
+ - **10Gbps网络**: 1000-1200 MB/s
39
+
40
+ vs 其他方案:
41
+ - **vs HTTP**: 13倍更快
42
+ - **vs 原版ZMQ**: 2.7倍更快
43
+
44
+ ## 🚀 快速开始
45
+
46
+ ### 安装依赖
47
+
48
+ ```bash
49
+ pip install pyzmq fire
50
+ ```
51
+
52
+ ### 启动服务器
53
+
54
+ ```bash
55
+ # 方法1: 使用CLI
56
+ python -m flaxfile.cli serve
57
+
58
+ # 方法2: 直接运行
59
+ python flaxfile/server.py
60
+
61
+ # 监听所有网卡(允许远程连接)
62
+ python -m flaxfile.cli serve --host 0.0.0.0
63
+
64
+ # 自定义端口
65
+ python -m flaxfile.cli serve --upload-port 26555 --download-port 26556
66
+ ```
67
+
68
+ ### 使用客户端
69
+
70
+ ```bash
71
+ # 上传文件
72
+ python -m flaxfile.cli set myfile /path/to/file.bin
73
+
74
+ # 下载文件
75
+ python -m flaxfile.cli get myfile output.bin
76
+
77
+ # 删除文件
78
+ python -m flaxfile.cli delete myfile
79
+
80
+ # 查看版本
81
+ python -m flaxfile.cli version
82
+ ```
83
+
84
+ ## 📖 详细使用
85
+
86
+ ### 配置管理
87
+
88
+ ```bash
89
+ # 显示当前配置
90
+ python -m flaxfile.cli config show
91
+
92
+ # 添加远程服务器
93
+ python -m flaxfile.cli config add-server prod 192.168.1.100
94
+
95
+ # 添加服务器(自定义端口)
96
+ python -m flaxfile.cli config add-server dev 10.0.0.5 \
97
+ --upload-port 26555 \
98
+ --download-port 26556 \
99
+ --control-port 26557
100
+
101
+ # 设置默认服务器
102
+ python -m flaxfile.cli config set-default prod
103
+
104
+ # 删除服务器
105
+ python -m flaxfile.cli config remove-server dev
106
+ ```
107
+
108
+ 配置文件位置:`~/.flaxfile/config.json`
109
+
110
+ ### 使用远程服务器
111
+
112
+ ```bash
113
+ # 上传到指定服务器
114
+ python -m flaxfile.cli set myfile /path/to/file.bin --server prod
115
+
116
+ # 从指定服务器下载
117
+ python -m flaxfile.cli get myfile output.bin --server prod
118
+
119
+ # 删除远程服务器文件
120
+ python -m flaxfile.cli delete myfile --server prod
121
+ ```
122
+
123
+ ### Python API
124
+
125
+ ```python
126
+ from flaxfile import FlaxFileClient
127
+
128
+ # 创建客户端
129
+ client = FlaxFileClient(server_host="192.168.1.100")
130
+
131
+ # 上传文件
132
+ result = client.upload_file("test.bin", "remote_key")
133
+ print(f"上传吞吐量: {result['throughput']:.2f} MB/s")
134
+
135
+ # 下载文件
136
+ result = client.download_file("remote_key", "output.bin")
137
+ print(f"下载吞吐量: {result['throughput']:.2f} MB/s")
138
+
139
+ # 删除文件
140
+ client.delete_file("remote_key")
141
+
142
+ # 关闭连接
143
+ client.close()
144
+ ```
145
+
146
+ ## 🔧 高级配置
147
+
148
+ ### 服务器端
149
+
150
+ ```bash
151
+ # 仅本地访问(安全)
152
+ python -m flaxfile.cli serve --host 127.0.0.1
153
+
154
+ # 允许所有网卡访问(生产环境)
155
+ python -m flaxfile.cli serve --host 0.0.0.0
156
+
157
+ # 自定义所有端口
158
+ python -m flaxfile.cli serve \
159
+ --upload-port 26555 \
160
+ --download-port 26556 \
161
+ --control-port 26557
162
+ ```
163
+
164
+ ### 客户端端口配置
165
+
166
+ 如果服务器使用非默认端口,需要在配置中指定:
167
+
168
+ ```bash
169
+ python -m flaxfile.cli config add-server custom 192.168.1.100 \
170
+ --upload-port 26555 \
171
+ --download-port 26556 \
172
+ --control-port 26557
173
+ ```
174
+
175
+ ## 📊 性能优化技术
176
+
177
+ FlaxFile采用以下优化技术实现极致性能:
178
+
179
+ 1. **PUSH/PULL模式** - 单向数据流,无identity开销
180
+ 2. **批量接收** - 减少系统调用,提升吞吐量
181
+ 3. **大缓冲区** - 128MB缓冲区,充分利用网络
182
+ 4. **零拷贝发送** - 减少内存拷贝
183
+ 5. **大chunk size** - 4MB chunk,减少往返次数
184
+ 6. **TCP优化** - keepalive等参数优化
185
+
186
+ 详细技术文档:`../profile_results/FINAL_TCP_OPTIMIZATION_REPORT.md`
187
+
188
+ ## 🌐 网络性能
189
+
190
+ ### 本地loopback
191
+
192
+ | 文件大小 | 上传 | 下载 |
193
+ |---------|------|------|
194
+ | 500MB | 3868 MB/s | 1327 MB/s |
195
+ | 1GB+ | 3800+ MB/s | 1300+ MB/s |
196
+
197
+ ### 真实网络
198
+
199
+ | 网络 | 理论上限 | 实际吞吐量 |
200
+ |------|---------|----------|
201
+ | 1Gbps | 125 MB/s | 110-125 MB/s |
202
+ | 10Gbps | 1250 MB/s | 1000-1200 MB/s |
203
+
204
+ ## 🔒 安全注意事项
205
+
206
+ **当前版本不支持加密传输**,仅适用于:
207
+ - ✅ 内网/局域网传输
208
+ - ✅ 可信网络环境
209
+ - ✅ VPN隧道内传输
210
+
211
+ **不推荐**:
212
+ - ❌ 公网直接传输敏感数据
213
+ - ❌ 不可信网络环境
214
+
215
+ 未来版本将支持TLS/SSL加密。
216
+
217
+ ## 📁 项目结构
218
+
219
+ ```
220
+ flaxfile/
221
+ ├── __init__.py # 包初始化
222
+ ├── server.py # 服务器实现
223
+ ├── client.py # 客户端实现
224
+ ├── config.py # 配置管理
225
+ ├── cli.py # CLI接口
226
+ └── README.md # 本文档
227
+ ```
228
+
229
+ ## 🆚 vs 其他方案
230
+
231
+ | 方案 | 500MB上传 | 跨网络 | 大文件稳定 |
232
+ |------|----------|--------|----------|
233
+ | **FlaxFile** | **3868 MB/s** | ✅ | ✅ |
234
+ | HTTP (FastAPI) | 292 MB/s | ✅ | ❌ |
235
+ | scp | ~100 MB/s | ✅ | ✅ |
236
+ | rsync | ~120 MB/s | ✅ | ✅ |
237
+
238
+ ## 🛠️ 故障排除
239
+
240
+ ### 连接超时
241
+
242
+ ```bash
243
+ # 检查服务器是否启动
244
+ lsof -i :25555
245
+
246
+ # 检查防火墙
247
+ # macOS
248
+ sudo pfctl -s rules
249
+
250
+ # Linux
251
+ sudo iptables -L
252
+ ```
253
+
254
+ ### 端口已被占用
255
+
256
+ ```bash
257
+ # 使用不同端口
258
+ python -m flaxfile.cli serve --upload-port 26555 --download-port 26556 --control-port 26557
259
+ ```
260
+
261
+ ### 性能不佳
262
+
263
+ 1. 检查网络带宽是否为瓶颈
264
+ 2. 确保使用SSD而非HDD
265
+ 3. 检查CPU使用率
266
+ 4. 尝试增大系统TCP缓冲区:
267
+ ```bash
268
+ # Linux
269
+ sudo sysctl -w net.core.rmem_max=134217728
270
+ sudo sysctl -w net.core.wmem_max=134217728
271
+ ```
272
+
273
+ ## 📝 开发路线图
274
+
275
+ - [ ] 支持TLS/SSL加密传输
276
+ - [ ] 支持断点续传
277
+ - [ ] 支持文件列表功能
278
+ - [ ] 支持多文件批量传输
279
+ - [ ] Web界面管理
280
+ - [ ] 传输进度条美化
281
+
282
+ ## 📄 License
283
+
284
+ MIT License
285
+
286
+ ## 🙏 致谢
287
+
288
+ 基于ZeroMQ (ØMQ)高性能消息传递库构建。
289
+
290
+ ---
291
+
292
+ **FlaxFile** - 让大文件传输飞起来! 🚀
@@ -0,0 +1,146 @@
1
+ # FlaxFile PyPI 上传指南
2
+
3
+ ## ✅ 准备工作已完成
4
+
5
+ 1. ✅ 已创建 `pyproject.toml`(使用 hatchling 构建后端)
6
+ 2. ✅ 已重构目录结构为标准的 src-layout
7
+ 3. ✅ 已成功构建测试(v1.0.0)
8
+ 4. ✅ 已验证本地安装和功能
9
+
10
+ ## 📁 当前目录结构
11
+
12
+ ```
13
+ flaxfile/ (项目根目录)
14
+ ├── pyproject.toml # 项目配置文件
15
+ ├── README.md # 项目说明(会显示在 PyPI 页面)
16
+ ├── QUICKSTART.md # 快速开始指南
17
+ ├── dist/ # 构建产物
18
+ │ ├── flaxfile-1.0.0-py3-none-any.whl
19
+ │ └── flaxfile-1.0.0.tar.gz
20
+ └── src/
21
+ └── flaxfile/ # Python 包
22
+ ├── __init__.py # 包含版本号 __version__ = "1.0.0"
23
+ ├── cli.py
24
+ ├── client.py
25
+ ├── config.py
26
+ └── server.py
27
+ ```
28
+
29
+ ## 🚀 上传到 PyPI
30
+
31
+ ### 1. 安装上传工具
32
+
33
+ ```bash
34
+ pip install twine
35
+ ```
36
+
37
+ ### 2. 创建 PyPI 账号
38
+
39
+ - 访问 https://pypi.org/account/register/
40
+ - 注册账号并验证邮箱
41
+
42
+ ### 3. 配置 PyPI Token(推荐)
43
+
44
+ 1. 登录 PyPI,进入 Account Settings → API Tokens
45
+ 2. 创建新 token,scope 选择 "Entire account" 或针对 flaxfile 项目
46
+ 3. 保存 token(只会显示一次!)
47
+ 4. 在本地配置:
48
+
49
+ ```bash
50
+ # 创建 ~/.pypirc 文件
51
+ cat > ~/.pypirc << 'EOF'
52
+ [pypi]
53
+ username = __token__
54
+ password = pypi-AgEIcHlwaS5vcmc...你的token...
55
+ EOF
56
+
57
+ chmod 600 ~/.pypirc
58
+ ```
59
+
60
+ ### 4. 测试上传(可选,推荐首次使用)
61
+
62
+ 先上传到 TestPyPI 测试:
63
+
64
+ ```bash
65
+ # 注册 TestPyPI 账号:https://test.pypi.org/account/register/
66
+
67
+ # 上传到 TestPyPI
68
+ twine upload --repository testpypi dist/*
69
+
70
+ # 测试安装
71
+ pip install --index-url https://test.pypi.org/simple/ flaxfile
72
+ ```
73
+
74
+ ### 5. 正式上传到 PyPI
75
+
76
+ ```bash
77
+ cd /Users/kunyuan/github/flaxkv/flaxfile
78
+
79
+ # 确保构建是最新的
80
+ rm -rf dist/
81
+ python -m build
82
+
83
+ # 检查构建产物
84
+ twine check dist/*
85
+
86
+ # 上传到 PyPI
87
+ twine upload dist/*
88
+ ```
89
+
90
+ ### 6. 验证上传
91
+
92
+ - 访问 https://pypi.org/project/flaxfile/
93
+ - 测试安装:
94
+
95
+ ```bash
96
+ pip install flaxfile
97
+ flaxfile version
98
+ ```
99
+
100
+ ## 🔄 发布新版本
101
+
102
+ 1. 修改 `src/flaxfile/__init__.py` 中的版本号:
103
+ ```python
104
+ __version__ = "1.0.1"
105
+ ```
106
+
107
+ 2. 重新构建和上传:
108
+ ```bash
109
+ rm -rf dist/
110
+ python -m build
111
+ twine check dist/*
112
+ twine upload dist/*
113
+ ```
114
+
115
+ ## 📝 注意事项
116
+
117
+ 1. **版本号不可重复**:每次上传必须使用新的版本号
118
+ 2. **README.md**:会自动显示在 PyPI 项目页面
119
+ 3. **许可证**:使用父目录的 LICENSE 文件(MIT License)
120
+ 4. **依赖项**:
121
+ - pyzmq>=25.0.0
122
+ - fire>=0.5.0
123
+ 5. **Python 版本**:支持 Python 3.8+
124
+
125
+ ## ⚠️ 上传前检查清单
126
+
127
+ - [ ] README.md 内容完整准确
128
+ - [ ] 版本号已更新(如果不是首次发布)
129
+ - [ ] 所有功能已测试
130
+ - [ ] 构建成功:`python -m build`
131
+ - [ ] 包检查通过:`twine check dist/*`
132
+ - [ ] 本地安装测试:`pip install dist/*.whl`
133
+
134
+ ## 🎉 当前状态
135
+
136
+ ✅ **已准备就绪,可以直接上传到 PyPI!**
137
+
138
+ 当前构建的包:
139
+ - flaxfile-1.0.0-py3-none-any.whl (16 KB)
140
+ - flaxfile-1.0.0.tar.gz (14 KB)
141
+
142
+ 执行以下命令即可上传:
143
+ ```bash
144
+ pip install twine
145
+ twine upload dist/*
146
+ ```