pyproject.toml 10 KB

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