| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- #[build-system] #remove for python2
- #requires = ["setuptools>=64.0", "wheel", "setuptools_scm"]
- #build-backend = "setuptools.build_meta"
- #[tool.setuptools_scm]
- #local_scheme = "no-local-version"
- [project]
- name = "ddns"
- dynamic = ["version"]
- description = "Dynamic DNS client for multiple providers, supporting IPv4 and IPv6."
- authors = [{ name = "NewFuture", email = "[email protected]" }]
- readme = "README.md"
- license = "MIT"
- requires-python = ">=2.7"
- classifiers = [
- "Development Status :: 5 - Production/Stable",
- "Intended Audience :: Developers",
- "Intended Audience :: End Users/Desktop",
- "Intended Audience :: Information Technology",
- "Intended Audience :: System Administrators",
- "Topic :: Internet",
- "Topic :: Internet :: Name Service (DNS)",
- "Topic :: System :: Networking",
- "Topic :: Software Development",
- 'Programming Language :: Python :: 2.7',
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: 3.7",
- "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",
- "Programming Language :: Python :: 3.13",
- ]
- keywords = ["ddns", "ipv6", "ipv4", "dns", "dnspod", "alidns", "cloudflare"]
- dependencies = []
- [project.urls]
- Homepage = "https://ddns.newfuture.cc"
- Documentation = "https://ddns.newfuture.cc"
- Repository = "https://github.com/NewFuture/DDNS"
- "Bug Tracker" = "https://github.com/NewFuture/DDNS/issues"
- Source = "https://github.com/NewFuture/DDNS"
- [project.scripts]
- ddns = "ddns.__main__:main"
- # Optional dependencies
- [project.optional-dependencies]
- dev = [
- "ruff",
- "mock;python_version<'3.3'", # For Python 2.7 compatibility
- ]
- # 可选的 pytest 支持(不是默认测试框架)
- pytest = [
- "pytest>=6.0",
- "pytest-cov",
- "mock;python_version<'3.3'",
- ]
- # Setuptools configuration
- [tool.setuptools]
- platforms = ["any"]
- packages = ["ddns", "ddns.config", "ddns.provider", "ddns.scheduler", "ddns.util"]
- package-dir= {"ddns" = "ddns"}
- #[tool.setuptools.packages.find]
- #where = ["."]
- [tool.setuptools.dynamic]
- version = { attr = "ddns.__version__" }
- # description = { attr = "ddns.__description__" }
- # 测试配置 - 使用 unittest 作为默认测试框架
- [tool.unittest]
- start-directory = "tests"
- pattern = "test_*.py"
- # unittest 不需要额外配置,使用内置的 test discovery
- # pytest 兼容配置(保持与 pytest 的兼容性)
- [tool.pytest.ini_options]
- testpaths = ["tests"]
- python_files = ["test_*.py"]
- python_classes = ["Test*"]
- python_functions = ["test_*"]
- addopts = ["-v", "--tb=short"]
- # 确保 pytest 可以找到 test_base 模块
- pythonpath = [".", "tests"]
- # Ruff configuration - unified formatting and linting
- [tool.ruff]
- # Same line length as black was using
- line-length = 120
- # Ruff minimum supported version is py37, but project supports py27+
- target-version = "py37"
- exclude = [
- ".eggs",
- ".git",
- ".hg",
- ".mypy_cache",
- ".tox",
- ".venv",
- "build",
- "dist",
- "__pycache__",
- "*.egg-info",
- ]
- [tool.ruff.lint]
- # Enable pycodestyle (E, W), pyflakes (F), and mccabe (C) - same as flake8 defaults
- # Deliberately exclude pyupgrade (UP) rules to maintain Python 2 compatibility
- # (UP rules would convert u"" strings to "" which breaks py2 compatibility)
- select = ["E", "W", "F", "C"]
- # Same ignores as flake8 configuration, but using ruff rule codes
- ignore = [
- # "E203", # whitespace before ':' - not needed in ruff, formatter handles this
- "E501", # line too long (handled by formatter)
- "UP025", # unicode-kind-prefix (keep u"..." for Py2 compatibility)
- ]
- # Same max complexity as flake8
- mccabe = { max-complexity = 12 }
- [tool.ruff.lint.per-file-ignores]
- # Allow unused imports and redefined names in tests (same as flake8)
- "tests/*" = ["F401", "F811"]
- [tool.ruff.format]
- line-ending = "auto"
- indent-style = "space"
- quote-style = "double"
- skip-magic-trailing-comma = true # py2
- docstring-code-format = true
- docstring-code-line-length = "dynamic"
- # 类型检查配置
- [tool.pyright]
- typeCheckingMode = "standard"
- autoImportCompletions = true
- autoFormatStrings = true
- completeFunctionParens = true
- supportAllPythonDocuments = true
- importFormat = "relative"
- generateWithTypeAnnotation = true
- diagnosticMode = "workspace"
- indexing = true
- useLibraryCodeForTypes = true
- # Coverage configuration (可选,仅在使用 pytest-cov 时需要)
- # 要使用覆盖率报告,需要安装: pip install pytest pytest-cov
- # 然后运行: pytest tests/ --cov=ddns --cov-report=term-missing
- [tool.coverage.run]
- source = ["ddns"]
- omit = [
- "*/tests/*",
- "*/test_*",
- "*/__pycache__/*",
- "*/.*",
- ]
- [tool.coverage.report]
- exclude_lines = [
- "pragma: no cover",
- "def __repr__",
- "if self.debug:",
- "if settings.DEBUG",
- "raise AssertionError",
- "raise NotImplementedError",
- "if 0:",
- "if __name__ == .__main__.:",
- "class .*\\bProtocol\\):",
- "@(abc\\.)?abstractmethod",
- ]
- show_missing = true
- precision = 2
|