pyproject.toml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. [build-system]
  2. requires = ["hatchling"]
  3. build-backend = "hatchling.build"
  4. [project]
  5. name = "yt-dlp"
  6. maintainers = [
  7. {name = "pukkandan", email = "pukkandan.ytdlp@gmail.com"},
  8. {name = "Grub4K", email = "contact@grub4k.xyz"},
  9. {name = "bashonly", email = "bashonly@protonmail.com"},
  10. {name = "coletdjnz", email = "coletdjnz@protonmail.com"},
  11. {name = "sepro", email = "sepro@sepr0.com"},
  12. ]
  13. description = "A feature-rich command-line audio/video downloader"
  14. readme = "README.md"
  15. requires-python = ">=3.8"
  16. keywords = [
  17. "youtube-dl",
  18. "video-downloader",
  19. "youtube-downloader",
  20. "sponsorblock",
  21. "youtube-dlc",
  22. "yt-dlp",
  23. ]
  24. license = {file = "LICENSE"}
  25. classifiers = [
  26. "Topic :: Multimedia :: Video",
  27. "Development Status :: 5 - Production/Stable",
  28. "Environment :: Console",
  29. "Programming Language :: Python",
  30. "Programming Language :: Python :: 3 :: Only",
  31. "Programming Language :: Python :: 3.8",
  32. "Programming Language :: Python :: 3.9",
  33. "Programming Language :: Python :: 3.10",
  34. "Programming Language :: Python :: 3.11",
  35. "Programming Language :: Python :: 3.12",
  36. "Programming Language :: Python :: Implementation",
  37. "Programming Language :: Python :: Implementation :: CPython",
  38. "Programming Language :: Python :: Implementation :: PyPy",
  39. "License :: OSI Approved :: The Unlicense (Unlicense)",
  40. "Operating System :: OS Independent",
  41. ]
  42. dynamic = ["version"]
  43. dependencies = [
  44. "brotli; implementation_name=='cpython'",
  45. "brotlicffi; implementation_name!='cpython'",
  46. "certifi",
  47. "mutagen",
  48. "pycryptodomex",
  49. "requests>=2.32.2,<3",
  50. "urllib3>=1.26.17,<3",
  51. "websockets>=13.0",
  52. ]
  53. [project.optional-dependencies]
  54. default = []
  55. curl-cffi = [
  56. "curl-cffi==0.5.10; os_name=='nt' and implementation_name=='cpython'",
  57. "curl-cffi>=0.5.10,!=0.6.*,<0.7.2; os_name!='nt' and implementation_name=='cpython'",
  58. ]
  59. secretstorage = [
  60. "cffi",
  61. "secretstorage",
  62. ]
  63. build = [
  64. "build",
  65. "hatchling",
  66. "pip",
  67. "setuptools>=71.0.2", # 71.0.0 broke pyinstaller
  68. "wheel",
  69. ]
  70. dev = [
  71. "pre-commit",
  72. "yt-dlp[static-analysis]",
  73. "yt-dlp[test]",
  74. ]
  75. static-analysis = [
  76. "autopep8~=2.0",
  77. "ruff~=0.6.0",
  78. ]
  79. test = [
  80. "pytest~=8.1",
  81. "pytest-rerunfailures~=14.0",
  82. ]
  83. pyinstaller = [
  84. "pyinstaller>=6.10.0", # Windows temp cleanup fixed in 6.10.0
  85. ]
  86. py2exe = [
  87. "py2exe>=0.12",
  88. ]
  89. [project.urls]
  90. Documentation = "https://github.com/yt-dlp/yt-dlp#readme"
  91. Repository = "https://github.com/yt-dlp/yt-dlp"
  92. Tracker = "https://github.com/yt-dlp/yt-dlp/issues"
  93. Funding = "https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators"
  94. [project.scripts]
  95. yt-dlp = "yt_dlp:main"
  96. [project.entry-points.pyinstaller40]
  97. hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
  98. [tool.hatch.build.targets.sdist]
  99. include = [
  100. "/yt_dlp",
  101. "/devscripts",
  102. "/test",
  103. "/.gitignore", # included by default, needed for auto-excludes
  104. "/Changelog.md",
  105. "/LICENSE", # included as license
  106. "/pyproject.toml", # included by default
  107. "/README.md", # included as readme
  108. "/setup.cfg",
  109. "/supportedsites.md",
  110. ]
  111. artifacts = [
  112. "/yt_dlp/extractor/lazy_extractors.py",
  113. "/completions",
  114. "/AUTHORS", # included by default
  115. "/README.txt",
  116. "/yt-dlp.1",
  117. ]
  118. [tool.hatch.build.targets.wheel]
  119. packages = ["yt_dlp"]
  120. artifacts = ["/yt_dlp/extractor/lazy_extractors.py"]
  121. [tool.hatch.build.targets.wheel.shared-data]
  122. "completions/bash/yt-dlp" = "share/bash-completion/completions/yt-dlp"
  123. "completions/zsh/_yt-dlp" = "share/zsh/site-functions/_yt-dlp"
  124. "completions/fish/yt-dlp.fish" = "share/fish/vendor_completions.d/yt-dlp.fish"
  125. "README.txt" = "share/doc/yt_dlp/README.txt"
  126. "yt-dlp.1" = "share/man/man1/yt-dlp.1"
  127. [tool.hatch.version]
  128. path = "yt_dlp/version.py"
  129. pattern = "_pkg_version = '(?P<version>[^']+)'"
  130. [tool.hatch.envs.default]
  131. features = ["curl-cffi", "default"]
  132. dependencies = ["pre-commit"]
  133. path = ".venv"
  134. installer = "uv"
  135. [tool.hatch.envs.default.scripts]
  136. setup = "pre-commit install --config .pre-commit-hatch.yaml"
  137. yt-dlp = "python -Werror -Xdev -m yt_dlp {args}"
  138. [tool.hatch.envs.hatch-static-analysis]
  139. detached = true
  140. features = ["static-analysis"]
  141. dependencies = [] # override hatch ruff version
  142. config-path = "pyproject.toml"
  143. [tool.hatch.envs.hatch-static-analysis.scripts]
  144. format-check = "autopep8 --diff {args:.}"
  145. format-fix = "autopep8 --in-place {args:.}"
  146. lint-check = "ruff check {args:.}"
  147. lint-fix = "ruff check --fix {args:.}"
  148. [tool.hatch.envs.hatch-test]
  149. features = ["test"]
  150. dependencies = [
  151. "pytest-randomly~=3.15",
  152. "pytest-xdist[psutil]~=3.5",
  153. ]
  154. [tool.hatch.envs.hatch-test.scripts]
  155. run = "python -m devscripts.run_tests {args}"
  156. run-cov = "echo Code coverage not implemented && exit 1"
  157. [[tool.hatch.envs.hatch-test.matrix]]
  158. python = [
  159. "3.8",
  160. "3.9",
  161. "3.10",
  162. "3.11",
  163. "3.12",
  164. "pypy3.8",
  165. "pypy3.9",
  166. "pypy3.10",
  167. ]
  168. [tool.ruff]
  169. line-length = 120
  170. [tool.ruff.lint]
  171. ignore = [
  172. "E402", # module-import-not-at-top-of-file
  173. "E501", # line-too-long
  174. "E731", # lambda-assignment
  175. "E741", # ambiguous-variable-name
  176. "UP036", # outdated-version-block
  177. "B006", # mutable-argument-default
  178. "B008", # function-call-in-default-argument
  179. "B011", # assert-false
  180. "B017", # assert-raises-exception
  181. "B023", # function-uses-loop-variable (false positives)
  182. "B028", # no-explicit-stacklevel
  183. "B904", # raise-without-from-inside-except
  184. "C401", # unnecessary-generator-set
  185. "C402", # unnecessary-generator-dict
  186. "PIE790", # unnecessary-placeholder
  187. "SIM102", # collapsible-if
  188. "SIM108", # if-else-block-instead-of-if-exp
  189. "SIM112", # uncapitalized-environment-variables
  190. "SIM113", # enumerate-for-loop
  191. "SIM114", # if-with-same-arms
  192. "SIM115", # open-file-with-context-handler
  193. "SIM117", # multiple-with-statements
  194. "SIM223", # expr-and-false
  195. "SIM300", # yoda-conditions
  196. "TD001", # invalid-todo-tag
  197. "TD002", # missing-todo-author
  198. "TD003", # missing-todo-link
  199. "PLE0604", # invalid-all-object (false positives)
  200. "PLE0643", # potential-index-error (false positives)
  201. "PLW0603", # global-statement
  202. "PLW1510", # subprocess-run-without-check
  203. "PLW2901", # redefined-loop-name
  204. "RUF001", # ambiguous-unicode-character-string
  205. "RUF012", # mutable-class-default
  206. "RUF100", # unused-noqa (flake8 has slightly different behavior)
  207. ]
  208. select = [
  209. "E", # pycodestyle Error
  210. "W", # pycodestyle Warning
  211. "F", # Pyflakes
  212. "I", # isort
  213. "Q", # flake8-quotes
  214. "N803", # invalid-argument-name
  215. "N804", # invalid-first-argument-name-for-class-method
  216. "UP", # pyupgrade
  217. "B", # flake8-bugbear
  218. "A", # flake8-builtins
  219. "COM", # flake8-commas
  220. "C4", # flake8-comprehensions
  221. "FA", # flake8-future-annotations
  222. "ISC", # flake8-implicit-str-concat
  223. "ICN003", # banned-import-from
  224. "PIE", # flake8-pie
  225. "T20", # flake8-print
  226. "RSE", # flake8-raise
  227. "RET504", # unnecessary-assign
  228. "SIM", # flake8-simplify
  229. "TID251", # banned-api
  230. "TD", # flake8-todos
  231. "PLC", # Pylint Convention
  232. "PLE", # Pylint Error
  233. "PLW", # Pylint Warning
  234. "RUF", # Ruff-specific rules
  235. ]
  236. [tool.ruff.lint.per-file-ignores]
  237. "devscripts/lazy_load_template.py" = [
  238. "F401", # unused-import
  239. ]
  240. "!yt_dlp/extractor/**.py" = [
  241. "I", # isort
  242. "ICN003", # banned-import-from
  243. "T20", # flake8-print
  244. "A002", # builtin-argument-shadowing
  245. "C408", # unnecessary-collection-call
  246. ]
  247. "yt_dlp/jsinterp.py" = [
  248. "UP031", # printf-string-formatting
  249. ]
  250. [tool.ruff.lint.isort]
  251. known-first-party = [
  252. "bundle",
  253. "devscripts",
  254. "test",
  255. ]
  256. relative-imports-order = "closest-to-furthest"
  257. [tool.ruff.lint.flake8-quotes]
  258. docstring-quotes = "double"
  259. multiline-quotes = "single"
  260. inline-quotes = "single"
  261. avoid-escape = false
  262. [tool.ruff.lint.pep8-naming]
  263. classmethod-decorators = [
  264. "yt_dlp.utils.classproperty",
  265. ]
  266. [tool.ruff.lint.flake8-import-conventions]
  267. banned-from = [
  268. "base64",
  269. "datetime",
  270. "functools",
  271. "glob",
  272. "hashlib",
  273. "itertools",
  274. "json",
  275. "math",
  276. "os",
  277. "pathlib",
  278. "random",
  279. "re",
  280. "string",
  281. "sys",
  282. "time",
  283. "urllib.parse",
  284. "uuid",
  285. "xml",
  286. ]
  287. [tool.ruff.lint.flake8-tidy-imports.banned-api]
  288. "yt_dlp.compat.compat_str".msg = "Use `str` instead."
  289. "yt_dlp.compat.compat_b64decode".msg = "Use `base64.b64decode` instead."
  290. "yt_dlp.compat.compat_urlparse".msg = "Use `urllib.parse` instead."
  291. "yt_dlp.compat.compat_parse_qs".msg = "Use `urllib.parse.parse_qs` instead."
  292. "yt_dlp.compat.compat_urllib_parse_unquote".msg = "Use `urllib.parse.unquote` instead."
  293. "yt_dlp.compat.compat_urllib_parse_urlencode".msg = "Use `urllib.parse.urlencode` instead."
  294. "yt_dlp.compat.compat_urllib_parse_urlparse".msg = "Use `urllib.parse.urlparse` instead."
  295. "yt_dlp.compat.compat_shlex_quote".msg = "Use `yt_dlp.utils.shell_quote` instead."
  296. "yt_dlp.utils.error_to_compat_str".msg = "Use `str` instead."
  297. [tool.autopep8]
  298. max_line_length = 120
  299. recursive = true
  300. exit-code = true
  301. jobs = 0
  302. select = [
  303. "E101",
  304. "E112",
  305. "E113",
  306. "E115",
  307. "E116",
  308. "E117",
  309. "E121",
  310. "E122",
  311. "E123",
  312. "E124",
  313. "E125",
  314. "E126",
  315. "E127",
  316. "E128",
  317. "E129",
  318. "E131",
  319. "E201",
  320. "E202",
  321. "E203",
  322. "E211",
  323. "E221",
  324. "E222",
  325. "E223",
  326. "E224",
  327. "E225",
  328. "E226",
  329. "E227",
  330. "E228",
  331. "E231",
  332. "E241",
  333. "E242",
  334. "E251",
  335. "E252",
  336. "E261",
  337. "E262",
  338. "E265",
  339. "E266",
  340. "E271",
  341. "E272",
  342. "E273",
  343. "E274",
  344. "E275",
  345. "E301",
  346. "E302",
  347. "E303",
  348. "E304",
  349. "E305",
  350. "E306",
  351. "E502",
  352. "E701",
  353. "E702",
  354. "E704",
  355. "W391",
  356. "W504",
  357. ]
  358. [tool.pytest.ini_options]
  359. addopts = "-ra -v --strict-markers"
  360. markers = [
  361. "download",
  362. ]