Skip to content

Commit 8584ed7

Browse files
committed
refactor: 重构下载模块并更新项目配置
- 升级版本号至1.1.21,更新项目元数据描述和分类 - 删除poetry.lock和uv.lock文件,统一使用pyproject.toml管理依赖 - 重构下载模块(base.py, book.py, rss.py),添加类型注解和文档字符串 - 改进错误处理和代码健壮性,添加更详细的异常处理 - 统一工具函数到utils/core.py模块,提高代码复用性 - 添加RSS源格式化类(RSSSourceFormat)和导出功能 - 更新代码格式配置,遵循ruff和black规范 - 修复示例文件中的代码格式问题 这些改进提升了代码的可维护性和可读性,同时保持了向后兼容性。
1 parent 2b44070 commit 8584ed7

11 files changed

Lines changed: 604 additions & 423 deletions

File tree

example/run3.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ def run1():
1212
task.snapshot_download()
1313
task.url_manage.delete_all()
1414
# task.add_book_source("https://bitbucket.org/xiu2/yuedu/raw/master/shuyuan")
15-
task.add_rss_source(
16-
"https://jt12.de/SYV2/2023/03/17/0/02/42/167898256264133da2869d4.json"
17-
)
15+
task.add_rss_source("https://jt12.de/SYV2/2023/03/17/0/02/42/167898256264133da2869d4.json")
1816
task.snapshot_upload()
1917

2018

poetry.lock

Lines changed: 0 additions & 62 deletions
This file was deleted.

pyproject.toml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,60 @@
11
[project]
22
name = "funread"
3-
version = "1.1.20"
4-
description = "Add your description here"
3+
version = "1.1.21"
4+
description = "一个用于管理和处理阅读源(Legado 阅读 APP 的书源和 RSS 源)的 Python 工具库"
55
readme = "README.md"
66
requires-python = ">=3.8"
7+
keywords = [ "legado", "reading", "book-source", "rss", "ebook",]
8+
classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup",]
79
dependencies = [ "dominate>=2.9.1", "funfile>=1.0.11", "funutil>=1.0.25",]
10+
[[project.authors]]
11+
name = "牛哥"
12+
email = "niuliangtao@qq.com"
13+
14+
[[project.authors]]
15+
name = "farfarfun"
16+
email = "farfarfun@qq.com"
17+
18+
[[project.maintainers]]
19+
name = "牛哥"
20+
email = "niuliangtao@qq.com"
21+
22+
[[project.maintainers]]
23+
name = "farfarfun"
24+
email = "farfarfun@qq.com"
25+
26+
[build-system]
27+
requires = [ "hatchling",]
28+
build-backend = "hatchling.build"
29+
30+
[project.license]
31+
text = "Apache-2.0"
32+
33+
[project.optional-dependencies]
34+
dev = [ "pytest>=7.0.0", "pytest-cov>=4.0.0", "ruff>=0.1.0", "mypy>=1.0.0", "black>=23.0.0",]
35+
36+
[project.urls]
37+
Organization = "https://github.com/farfarfun"
38+
Repository = "https://github.com/farfarfun/funread"
39+
Releases = "https://github.com/farfarfun/funread/releases"
40+
41+
[tool.ruff]
42+
line-length = 100
43+
target-version = "py38"
44+
45+
[tool.black]
46+
line-length = 100
47+
target-version = [ "py38",]
48+
49+
[tool.mypy]
50+
python_version = "3.8"
51+
warn_return_any = true
52+
warn_unused_configs = true
53+
disallow_untyped_defs = false
54+
55+
[tool.setuptools]
56+
license-files = []
57+
58+
[tool.ruff.lint]
59+
select = [ "E", "F", "I", "N", "W",]
60+
ignore = [ "E501",]
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
"""源下载和管理模块"""
2+
13
from .base import DownloadSource
2-
from .book import BookSourceFormat, BookSourceDownload
4+
from .book import BookSourceDownload, BookSourceFormat
35
from .generate import GenerateSourceTask
4-
from .rss import RSSSourceDownload
6+
from .rss import RSSSourceDownload, RSSSourceFormat
7+
8+
__all__ = [
9+
"DownloadSource",
10+
"BookSourceFormat",
11+
"BookSourceDownload",
12+
"GenerateSourceTask",
13+
"RSSSourceDownload",
14+
"RSSSourceFormat",
15+
]

0 commit comments

Comments
 (0)