noticecard 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.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: noticecard
3
+ Version: 0.1.0
4
+ Summary: NoticeCard server with RESTful API and web UI
5
+ Author: NoticeCard Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://gitee.com/candy_xt/noticecard-server
8
+ Project-URL: Documentation, https://gitee.com/candy_xt/noticecard-server#readme
9
+ Project-URL: Repository, https://gitee.com/candy_xt/noticecard-server
10
+ Project-URL: Issues, https://gitee.com/candy_xt/noticecard-server/issues
11
+ Keywords: noticecard,api,fastapi,card-management
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: fastapi>=0.104.0
23
+ Requires-Dist: uvicorn[standard]>=0.24.0
24
+ Requires-Dist: sqlalchemy>=2.0.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: click>=8.1.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
29
+ Requires-Dist: httpx>=0.25.0; extra == "dev"
30
+
31
+ # NoticeCard Server
32
+
33
+ 一个基于 FastAPI 的卡片管理系统,提供完整的 RESTful API 和现代化的 Web UI 界面。
34
+
35
+ ## 特性
36
+
37
+ - ✨ 基于 FastAPI 的高性能 RESTful API
38
+ - 📝 完整的 CRUD 操作支持
39
+ - 🎨 集成 Tabler UI 的响应式前端界面
40
+ - 📱 自适应布局,支持手机、平板和桌面设备
41
+ - 📚 自动生成的 OpenAPI/Swagger 文档
42
+ - 💾 SQLite 数据库,轻量级无需额外配置
43
+ - 🛠️ 命令行工具,简化部署和管理
44
+ - 🔄 CORS 支持,便于前后端分离开发
45
+ - 📄 分页支持,高效处理大量数据
46
+ - 🚨 完善的错误处理和事务回滚
47
+ - ⚡ 开发模式支持热重载
48
+
49
+ ## 安装
50
+
51
+ ### 从 PyPI 安装(发布后)
52
+
53
+ ```bash
54
+ pip install noticecard
55
+ ```
56
+
57
+ ### 本地开发安装
58
+
59
+ ```bash
60
+ # 克隆仓库
61
+ git clone https://gitee.com/candy_xt/noticecard-server.git
62
+ cd noticecard-server
63
+
64
+ # 安装依赖
65
+ pip install -e .
66
+ ```
67
+
68
+ ## 快速开始
69
+
70
+ ### 启动服务器
71
+
72
+ ```bash
73
+ # 使用默认配置启动(0.0.0.0:3143)
74
+ ncard serve
75
+
76
+ # 指定主机和端口
77
+ ncard serve --host 127.0.0.1 --port 8080
78
+
79
+ # 指定工作目录(数据库存储位置)
80
+ ncard serve --dir ./my_data
81
+
82
+ # 开发模式(自动重载)
83
+ ncard serve --reload
84
+
85
+ # 指定日志级别
86
+ ncard serve --log-level debug
87
+
88
+ # 组合使用
89
+ ncard serve --host 0.0.0.0 --port 8080 --dir ./data --reload --log-level info
90
+ ```
91
+
92
+ ### 访问服务
93
+
94
+ - Web UI: http://localhost:3143
95
+ - API 文档 (Swagger): http://localhost:3143/docs
96
+ - API 文档 (ReDoc): http://localhost:3143/redoc
97
+ - OpenAPI JSON: http://localhost:3143/openapi.json
98
+
99
+ ## API 端点
100
+
101
+ ### 卡片管理
102
+
103
+ - `GET /cards/` - 获取所有卡片(支持分页)
104
+ - 查询参数:`skip`(跳过数量,默认0)、`limit`(限制数量,默认100)
105
+ - `GET /cards/{card_id}` - 获取指定卡片
106
+ - `POST /cards/` - 创建新卡片
107
+ - `PUT /cards/{card_id}` - 更新卡片
108
+ - `DELETE /cards/{card_id}` - 删除卡片
109
+
110
+ ### 请求示例
111
+
112
+ 创建卡片:
113
+ ```bash
114
+ curl -X POST "http://localhost:3143/cards/" \
115
+ -H "Content-Type: application/json" \
116
+ -d '{
117
+ "title": "会议通知",
118
+ "desc1": "下午两点",
119
+ "desc2": "一号会议室"
120
+ }'
121
+ ```
122
+
123
+ 获取所有卡片:
124
+ ```bash
125
+ curl "http://localhost:3143/cards/"
126
+
127
+ # 使用分页
128
+ curl "http://localhost:3143/cards/?skip=0&limit=10"
129
+ ```
130
+
131
+ ## 数据模型
132
+
133
+ ### Card
134
+
135
+ | 字段 | 类型 | 说明 |
136
+ |------|------|------|
137
+ | id | Integer | 主键,自动生成 |
138
+ | title | String | 标题(必填) |
139
+ | desc1 | String | 描述1(可选) |
140
+ | desc2 | String | 描述2(可选) |
141
+ | created_at | DateTime | 创建时间 |
142
+ | updated_at | DateTime | 更新时间 |
143
+
144
+ ## CLI 命令
145
+
146
+ ### serve
147
+
148
+ 启动 NoticeCard 服务器。
149
+
150
+ ```bash
151
+ ncard serve [OPTIONS]
152
+ ```
153
+
154
+ 选项:
155
+ - `--host TEXT` - 绑定的主机地址(默认:0.0.0.0)
156
+ - `--port INTEGER` - 绑定的端口(默认:3143)
157
+ - `--dir TEXT` - 工作目录,用于存储数据库(默认:当前目录)
158
+ - `--reload` - 启用自动重载(开发模式)
159
+ - `--log-level` - 日志级别:critical, error, warning, info, debug(默认:info)
160
+
161
+ ### init
162
+
163
+ 初始化数据库。
164
+
165
+ ```bash
166
+ ncard init [OPTIONS]
167
+ ```
168
+
169
+ 选项:
170
+ - `--dir TEXT` - 工作目录(默认:当前目录)
171
+
172
+ ## 开发
173
+
174
+ ### 项目结构
175
+
176
+ ```
177
+ noticecard/
178
+ ├── noticecard/
179
+ │ ├── __init__.py
180
+ │ ├── app.py # FastAPI 应用
181
+ │ ├── models.py # 数据库模型
182
+ │ ├── schemas.py # Pydantic 模型
183
+ │ ├── templates.py # HTML 模板
184
+ │ └── cli.py # CLI 工具
185
+ ├── pyproject.toml # 项目配置
186
+ ├── README.md
187
+ └── .gitignore
188
+ ```
189
+
190
+ ### 运行测试
191
+
192
+ ```bash
193
+ pip install -e ".[dev]"
194
+ pytest
195
+ ```
196
+
197
+ ### 构建发布包
198
+
199
+ ```bash
200
+ pip install build twine
201
+ python -m build
202
+ twine upload dist/*
203
+ ```
204
+
205
+ ## 技术栈
206
+
207
+ - **FastAPI** - 现代化的 Python Web 框架
208
+ - **SQLAlchemy** - SQL 工具包和 ORM
209
+ - **Pydantic** - 数据验证和设置管理
210
+ - **Click** - 命令行工具框架
211
+ - **Uvicorn** - ASGI 服务器
212
+ - **Tabler UI** - 响应式前端框架
213
+
214
+ ## 贡献
215
+
216
+ 欢迎提交 Issue 和 Pull Request!
217
+
218
+ 仓库地址:https://gitee.com/candy_xt/noticecard-server
219
+
220
+ ## 许可证
221
+
222
+ MIT License
@@ -0,0 +1,192 @@
1
+ # NoticeCard Server
2
+
3
+ 一个基于 FastAPI 的卡片管理系统,提供完整的 RESTful API 和现代化的 Web UI 界面。
4
+
5
+ ## 特性
6
+
7
+ - ✨ 基于 FastAPI 的高性能 RESTful API
8
+ - 📝 完整的 CRUD 操作支持
9
+ - 🎨 集成 Tabler UI 的响应式前端界面
10
+ - 📱 自适应布局,支持手机、平板和桌面设备
11
+ - 📚 自动生成的 OpenAPI/Swagger 文档
12
+ - 💾 SQLite 数据库,轻量级无需额外配置
13
+ - 🛠️ 命令行工具,简化部署和管理
14
+ - 🔄 CORS 支持,便于前后端分离开发
15
+ - 📄 分页支持,高效处理大量数据
16
+ - 🚨 完善的错误处理和事务回滚
17
+ - ⚡ 开发模式支持热重载
18
+
19
+ ## 安装
20
+
21
+ ### 从 PyPI 安装(发布后)
22
+
23
+ ```bash
24
+ pip install noticecard
25
+ ```
26
+
27
+ ### 本地开发安装
28
+
29
+ ```bash
30
+ # 克隆仓库
31
+ git clone https://gitee.com/candy_xt/noticecard-server.git
32
+ cd noticecard-server
33
+
34
+ # 安装依赖
35
+ pip install -e .
36
+ ```
37
+
38
+ ## 快速开始
39
+
40
+ ### 启动服务器
41
+
42
+ ```bash
43
+ # 使用默认配置启动(0.0.0.0:3143)
44
+ ncard serve
45
+
46
+ # 指定主机和端口
47
+ ncard serve --host 127.0.0.1 --port 8080
48
+
49
+ # 指定工作目录(数据库存储位置)
50
+ ncard serve --dir ./my_data
51
+
52
+ # 开发模式(自动重载)
53
+ ncard serve --reload
54
+
55
+ # 指定日志级别
56
+ ncard serve --log-level debug
57
+
58
+ # 组合使用
59
+ ncard serve --host 0.0.0.0 --port 8080 --dir ./data --reload --log-level info
60
+ ```
61
+
62
+ ### 访问服务
63
+
64
+ - Web UI: http://localhost:3143
65
+ - API 文档 (Swagger): http://localhost:3143/docs
66
+ - API 文档 (ReDoc): http://localhost:3143/redoc
67
+ - OpenAPI JSON: http://localhost:3143/openapi.json
68
+
69
+ ## API 端点
70
+
71
+ ### 卡片管理
72
+
73
+ - `GET /cards/` - 获取所有卡片(支持分页)
74
+ - 查询参数:`skip`(跳过数量,默认0)、`limit`(限制数量,默认100)
75
+ - `GET /cards/{card_id}` - 获取指定卡片
76
+ - `POST /cards/` - 创建新卡片
77
+ - `PUT /cards/{card_id}` - 更新卡片
78
+ - `DELETE /cards/{card_id}` - 删除卡片
79
+
80
+ ### 请求示例
81
+
82
+ 创建卡片:
83
+ ```bash
84
+ curl -X POST "http://localhost:3143/cards/" \
85
+ -H "Content-Type: application/json" \
86
+ -d '{
87
+ "title": "会议通知",
88
+ "desc1": "下午两点",
89
+ "desc2": "一号会议室"
90
+ }'
91
+ ```
92
+
93
+ 获取所有卡片:
94
+ ```bash
95
+ curl "http://localhost:3143/cards/"
96
+
97
+ # 使用分页
98
+ curl "http://localhost:3143/cards/?skip=0&limit=10"
99
+ ```
100
+
101
+ ## 数据模型
102
+
103
+ ### Card
104
+
105
+ | 字段 | 类型 | 说明 |
106
+ |------|------|------|
107
+ | id | Integer | 主键,自动生成 |
108
+ | title | String | 标题(必填) |
109
+ | desc1 | String | 描述1(可选) |
110
+ | desc2 | String | 描述2(可选) |
111
+ | created_at | DateTime | 创建时间 |
112
+ | updated_at | DateTime | 更新时间 |
113
+
114
+ ## CLI 命令
115
+
116
+ ### serve
117
+
118
+ 启动 NoticeCard 服务器。
119
+
120
+ ```bash
121
+ ncard serve [OPTIONS]
122
+ ```
123
+
124
+ 选项:
125
+ - `--host TEXT` - 绑定的主机地址(默认:0.0.0.0)
126
+ - `--port INTEGER` - 绑定的端口(默认:3143)
127
+ - `--dir TEXT` - 工作目录,用于存储数据库(默认:当前目录)
128
+ - `--reload` - 启用自动重载(开发模式)
129
+ - `--log-level` - 日志级别:critical, error, warning, info, debug(默认:info)
130
+
131
+ ### init
132
+
133
+ 初始化数据库。
134
+
135
+ ```bash
136
+ ncard init [OPTIONS]
137
+ ```
138
+
139
+ 选项:
140
+ - `--dir TEXT` - 工作目录(默认:当前目录)
141
+
142
+ ## 开发
143
+
144
+ ### 项目结构
145
+
146
+ ```
147
+ noticecard/
148
+ ├── noticecard/
149
+ │ ├── __init__.py
150
+ │ ├── app.py # FastAPI 应用
151
+ │ ├── models.py # 数据库模型
152
+ │ ├── schemas.py # Pydantic 模型
153
+ │ ├── templates.py # HTML 模板
154
+ │ └── cli.py # CLI 工具
155
+ ├── pyproject.toml # 项目配置
156
+ ├── README.md
157
+ └── .gitignore
158
+ ```
159
+
160
+ ### 运行测试
161
+
162
+ ```bash
163
+ pip install -e ".[dev]"
164
+ pytest
165
+ ```
166
+
167
+ ### 构建发布包
168
+
169
+ ```bash
170
+ pip install build twine
171
+ python -m build
172
+ twine upload dist/*
173
+ ```
174
+
175
+ ## 技术栈
176
+
177
+ - **FastAPI** - 现代化的 Python Web 框架
178
+ - **SQLAlchemy** - SQL 工具包和 ORM
179
+ - **Pydantic** - 数据验证和设置管理
180
+ - **Click** - 命令行工具框架
181
+ - **Uvicorn** - ASGI 服务器
182
+ - **Tabler UI** - 响应式前端框架
183
+
184
+ ## 贡献
185
+
186
+ 欢迎提交 Issue 和 Pull Request!
187
+
188
+ 仓库地址:https://gitee.com/candy_xt/noticecard-server
189
+
190
+ ## 许可证
191
+
192
+ MIT License
@@ -0,0 +1,3 @@
1
+ """NoticeCard Server - A FastAPI-based card management system."""
2
+
3
+ __version__ = "0.1.0"