pyproject.toml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. [project]
  2. name = "borgbackup"
  3. dynamic = ["version", "readme"]
  4. authors = [{name="The Borg Collective (see AUTHORS file)"}]
  5. maintainers = [
  6. {name="Thomas Waldmann", email="tw@waldmann-edv.de"},
  7. ]
  8. description = "Deduplicated, encrypted, authenticated, and compressed backups"
  9. requires-python = ">=3.10"
  10. keywords = ["backup", "borgbackup"]
  11. classifiers = [
  12. "Development Status :: 4 - Beta",
  13. "Environment :: Console",
  14. "Intended Audience :: System Administrators",
  15. "Operating System :: POSIX :: BSD :: FreeBSD",
  16. "Operating System :: POSIX :: BSD :: OpenBSD",
  17. "Operating System :: POSIX :: BSD :: NetBSD",
  18. "Operating System :: MacOS :: MacOS X",
  19. "Operating System :: POSIX :: Linux",
  20. "Programming Language :: Python",
  21. "Programming Language :: Python :: 3",
  22. "Programming Language :: Python :: 3.10",
  23. "Programming Language :: Python :: 3.11",
  24. "Programming Language :: Python :: 3.12",
  25. "Programming Language :: Python :: 3.13",
  26. "Programming Language :: Python :: 3.14",
  27. "Topic :: Security :: Cryptography",
  28. "Topic :: System :: Archiving :: Backup",
  29. ]
  30. license = "BSD-3-Clause"
  31. license-files = ["LICENSE", "AUTHORS"]
  32. dependencies = [
  33. "borghash ~= 0.1.0",
  34. "borgstore ~= 0.3.0",
  35. "msgpack >=1.0.3, <=1.1.2",
  36. "packaging",
  37. "platformdirs >=3.0.0, <5.0.0; sys_platform == 'darwin'", # for macOS: breaking changes in 3.0.0.
  38. "platformdirs >=2.6.0, <5.0.0; sys_platform != 'darwin'", # for others: 2.6+ works consistently.
  39. "argon2-cffi",
  40. "shtab>=1.8.0",
  41. ]
  42. [project.optional-dependencies]
  43. llfuse = ["llfuse >= 1.3.8"]
  44. pyfuse3 = ["pyfuse3 >= 3.1.1"]
  45. nofuse = []
  46. s3 = ["borgstore[s3] ~= 0.3.0"]
  47. sftp = ["borgstore[sftp] ~= 0.3.0"]
  48. cockpit = ["textual>=6.8.0"] # might also work with older versions, untested
  49. [project.urls]
  50. "Homepage" = "https://borgbackup.org/"
  51. "Bug Tracker" = "https://github.com/borgbackup/borg/issues"
  52. "Documentation" = "https://borgbackup.readthedocs.io/"
  53. "Repository" = "https://github.com/borgbackup/borg"
  54. "Changelog" = "https://github.com/borgbackup/borg/blob/master/docs/changes.rst"
  55. [project.scripts]
  56. borg = "borg.archiver:main"
  57. borgfs = "borg.archiver:main"
  58. [tool.setuptools]
  59. # See also the MANIFEST.in file.
  60. # We want to install all the files in the package directories...
  61. include-package-data = true
  62. [tool.setuptools.packages.find]
  63. where = ["src"]
  64. [tool.setuptools.exclude-package-data]
  65. # ...except the source files which have been compiled (C extensions):
  66. "*" = ["*.c", "*.h", "*.pyx"]
  67. [build-system]
  68. requires = ["setuptools>=78.1.1", "wheel", "pkgconfig", "Cython>=3.0.3", "setuptools_scm[toml]>=6.2"]
  69. build-backend = "setuptools.build_meta"
  70. [tool.setuptools_scm]
  71. # Make sure we have the same versioning scheme with all setuptools_scm versions, to avoid different autogenerated files.
  72. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015052
  73. # https://github.com/borgbackup/borg/issues/6875
  74. write_to = "src/borg/_version.py"
  75. write_to_template = "__version__ = version = {version!r}\n"
  76. [tool.black]
  77. line-length = 120
  78. skip-magic-trailing-comma = true
  79. [tool.ruff]
  80. line-length = 120
  81. target-version = "py310"
  82. # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
  83. select = ["E", "F"]
  84. # for reference ...
  85. # E402 module level import not at top
  86. # E501 line too long
  87. # F401 import unused
  88. # F405 undefined or defined from star imports
  89. # F811 redef of unused var
  90. # borg code style guidelines:
  91. # Ignoring E203 due to https://github.com/PyCQA/pycodestyle/issues/373.
  92. ignore = ["E203", "F405", "E402"]
  93. # Allow autofix for all enabled rules (when `--fix` is provided).
  94. fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
  95. unfixable = []
  96. # Exclude a variety of commonly ignored directories.
  97. exclude = [
  98. ".cache",
  99. ".eggs",
  100. ".git",
  101. ".git-rewrite",
  102. ".idea",
  103. ".mypy_cache",
  104. ".ruff_cache",
  105. ".tox",
  106. "build",
  107. "dist",
  108. ]
  109. # Allow unused variables when underscore-prefixed.
  110. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
  111. # Code style violation exceptions:
  112. # please note that the values are adjusted so that they do not cause failures
  113. # with existing code. if you want to change them, you should first fix all
  114. # ruff failures that appear with your change.
  115. [tool.ruff.per-file-ignores]
  116. "scripts/make.py" = ["E501"]
  117. "src/borg/archive.py" = ["E501"]
  118. "src/borg/archiver/help_cmd.py" = ["E501"]
  119. "src/borg/cache.py" = ["E501"]
  120. "src/borg/helpers/__init__.py" = ["F401"]
  121. "src/borg/platform/__init__.py" = ["F401"]
  122. "src/borg/testsuite/archiver/disk_full_test.py" = ["F811"]
  123. "src/borg/testsuite/archiver/return_codes_test.py" = ["F811"]
  124. "src/borg/testsuite/benchmark_test.py" = ["F811"]
  125. "src/borg/testsuite/platform_test.py" = ["F811"]
  126. [tool.pytest.ini_options]
  127. markers = []
  128. [tool.mypy]
  129. python_version = "3.10"
  130. strict_optional = false
  131. local_partial_types = true
  132. show_error_codes = true
  133. files = "src/borg/**/*.py"
  134. [[tool.mypy.overrides]]
  135. module = [
  136. "msgpack.*",
  137. "llfuse",
  138. "pyfuse3",
  139. "trio",
  140. "borg.crypto.low_level",
  141. "borg.platform.*",
  142. ]
  143. ignore_missing_imports = true
  144. [tool.tox]
  145. requires = ["tox>=4.19", "pkgconfig", "cython", "wheel", "setuptools_scm"]
  146. # Important: when adding/removing Python versions here,
  147. # also update the section "Test environments with different FUSE implementations" accordingly.
  148. env_list = ["py{310,311,312,313,314}-{none,fuse2,fuse3}", "docs", "ruff", "mypy", "bandit"]
  149. [tool.tox.env_run_base]
  150. package = "editable-legacy" # without this it does not find setup_docs when running under fakeroot
  151. deps = ["-rrequirements.d/development.txt"]
  152. commands = [["python", "-m", "pytest", "-v", "-n", "{env:XDISTN:auto}", "-rs", "--cov=borg", "--cov-config=pyproject.toml", "--benchmark-skip", "--pyargs", "{posargs:borg.testsuite}"]]
  153. pass_env = ["*"] # fakeroot -u needs some env vars
  154. [tool.tox.env_pkg_base]
  155. pass_env = ["*"] # needed by tox4, so env vars are visible for building borg
  156. # Test environments with different FUSE implementations
  157. [tool.tox.env.py310-none]
  158. [tool.tox.env.py310-fuse2]
  159. set_env = {BORG_FUSE_IMPL = "llfuse"}
  160. extras = ["llfuse", "sftp", "s3"]
  161. [tool.tox.env.py310-fuse3]
  162. set_env = {BORG_FUSE_IMPL = "pyfuse3"}
  163. extras = ["pyfuse3", "sftp", "s3"]
  164. [tool.tox.env.py311-none]
  165. [tool.tox.env.py311-fuse2]
  166. set_env = {BORG_FUSE_IMPL = "llfuse"}
  167. extras = ["llfuse", "sftp", "s3"]
  168. [tool.tox.env.py311-fuse3]
  169. set_env = {BORG_FUSE_IMPL = "pyfuse3"}
  170. extras = ["pyfuse3", "sftp", "s3"]
  171. [tool.tox.env.py312-none]
  172. [tool.tox.env.py312-fuse2]
  173. set_env = {BORG_FUSE_IMPL = "llfuse"}
  174. extras = ["llfuse", "sftp", "s3"]
  175. [tool.tox.env.py312-fuse3]
  176. set_env = {BORG_FUSE_IMPL = "pyfuse3"}
  177. extras = ["pyfuse3", "sftp", "s3"]
  178. [tool.tox.env.py313-none]
  179. [tool.tox.env.py313-fuse2]
  180. set_env = {BORG_FUSE_IMPL = "llfuse"}
  181. extras = ["llfuse", "sftp", "s3"]
  182. [tool.tox.env.py313-fuse3]
  183. set_env = {BORG_FUSE_IMPL = "pyfuse3"}
  184. extras = ["pyfuse3", "sftp", "s3"]
  185. [tool.tox.env.py314-none]
  186. [tool.tox.env.py314-fuse2]
  187. set_env = {BORG_FUSE_IMPL = "llfuse"}
  188. extras = ["llfuse", "sftp", "s3"]
  189. [tool.tox.env.py314-fuse3]
  190. set_env = {BORG_FUSE_IMPL = "pyfuse3"}
  191. extras = ["pyfuse3", "sftp", "s3"]
  192. [tool.tox.env.ruff]
  193. skip_install = true
  194. deps = ["ruff"]
  195. commands = [["ruff", "check", "."]]
  196. [tool.tox.env.mypy]
  197. deps = ["pytest", "mypy", "pkgconfig"]
  198. commands = [["mypy", "--ignore-missing-imports"]]
  199. [tool.tox.env.docs]
  200. change_dir = "docs"
  201. deps = ["sphinx", "sphinxcontrib-jquery", "guzzle_sphinx_theme"]
  202. commands = [["sphinx-build", "-n", "-v", "-W", "--keep-going", "-b", "html", "-d", "{envtmpdir}/doctrees", ".", "{envtmpdir}/html"]]
  203. [tool.bandit]
  204. exclude_dirs = [".cache", ".eggs", ".git", ".git-rewrite", ".idea", ".mypy_cache", ".ruff_cache", ".tox", "build", "dist", "src/borg/testsuite"]
  205. skips = [
  206. "B101", # skip assert warnings, we do not allow running borg with assertions disabled.
  207. "B404", # do not warn about just import subprocess
  208. ]
  209. [tool.tox.env.bandit]
  210. skip_install = true
  211. deps = ["bandit[toml]"]
  212. commands = [["bandit", "-r", "src/borg", "-c", "pyproject.toml"]]
  213. [tool.coverage.run]
  214. branch = true
  215. disable_warnings = ["module-not-measured", "no-ctracer"]
  216. source = ["src/borg"]
  217. omit = [
  218. "*/borg/__init__.py",
  219. "*/borg/__main__.py",
  220. "*/borg/_version.py",
  221. "*/borg/fuse.py",
  222. "*/borg/support/*",
  223. "*/borg/testsuite/*",
  224. "*/borg/hash_sizes.py",
  225. ]
  226. [tool.coverage.report]
  227. exclude_lines = [
  228. "pragma: no cover",
  229. "pragma: freebsd only",
  230. "pragma: unknown platform only",
  231. "def __repr__",
  232. "raise AssertionError",
  233. "raise NotImplementedError",
  234. "if 0:",
  235. "if __name__ == .__main__.:",
  236. ]
  237. ignore_errors = true