pyproject.toml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. ]
  12. description = "A feature-rich command-line audio/video downloader"
  13. readme = "README.md"
  14. requires-python = ">=3.8"
  15. keywords = [
  16. "youtube-dl",
  17. "video-downloader",
  18. "youtube-downloader",
  19. "sponsorblock",
  20. "youtube-dlc",
  21. "yt-dlp",
  22. ]
  23. license = {file = "LICENSE"}
  24. classifiers = [
  25. "Topic :: Multimedia :: Video",
  26. "Development Status :: 5 - Production/Stable",
  27. "Environment :: Console",
  28. "Programming Language :: Python",
  29. "Programming Language :: Python :: 3 :: Only",
  30. "Programming Language :: Python :: 3.8",
  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 :: Implementation",
  36. "Programming Language :: Python :: Implementation :: CPython",
  37. "Programming Language :: Python :: Implementation :: PyPy",
  38. "License :: OSI Approved :: The Unlicense (Unlicense)",
  39. "Operating System :: OS Independent",
  40. ]
  41. dynamic = ["version"]
  42. dependencies = [
  43. "brotli; implementation_name=='cpython'",
  44. "brotlicffi; implementation_name!='cpython'",
  45. "certifi",
  46. "mutagen",
  47. "pycryptodomex",
  48. "requests>=2.32.2,<3",
  49. "urllib3>=1.26.17,<3",
  50. "websockets>=12.0",
  51. ]
  52. [project.optional-dependencies]
  53. default = []
  54. curl-cffi = ["curl-cffi==0.5.10; implementation_name=='cpython'"]
  55. secretstorage = [
  56. "cffi",
  57. "secretstorage",
  58. ]
  59. build = [
  60. "build",
  61. "hatchling",
  62. "pip",
  63. "setuptools",
  64. "wheel",
  65. ]
  66. dev = [
  67. "pre-commit",
  68. "yt-dlp[static-analysis]",
  69. "yt-dlp[test]",
  70. ]
  71. static-analysis = [
  72. "autopep8~=2.0",
  73. "ruff~=0.5.0",
  74. ]
  75. test = [
  76. "pytest~=8.1",
  77. ]
  78. pyinstaller = [
  79. "pyinstaller>=6.7.0", # for compat with setuptools>=70
  80. ]
  81. py2exe = [
  82. "py2exe>=0.12",
  83. ]
  84. [project.urls]
  85. Documentation = "https://github.com/yt-dlp/yt-dlp#readme"
  86. Repository = "https://github.com/yt-dlp/yt-dlp"
  87. Tracker = "https://github.com/yt-dlp/yt-dlp/issues"
  88. Funding = "https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators"
  89. [project.scripts]
  90. yt-dlp = "yt_dlp:main"
  91. [project.entry-points.pyinstaller40]
  92. hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
  93. [tool.hatch.build.targets.sdist]
  94. include = [
  95. "/yt_dlp",
  96. "/devscripts",
  97. "/test",
  98. "/.gitignore", # included by default, needed for auto-excludes
  99. "/Changelog.md",
  100. "/LICENSE", # included as license
  101. "/pyproject.toml", # included by default
  102. "/README.md", # included as readme
  103. "/setup.cfg",
  104. "/supportedsites.md",
  105. ]
  106. artifacts = [
  107. "/yt_dlp/extractor/lazy_extractors.py",
  108. "/completions",
  109. "/AUTHORS", # included by default
  110. "/README.txt",
  111. "/yt-dlp.1",
  112. ]
  113. [tool.hatch.build.targets.wheel]
  114. packages = ["yt_dlp"]
  115. artifacts = ["/yt_dlp/extractor/lazy_extractors.py"]
  116. [tool.hatch.build.targets.wheel.shared-data]
  117. "completions/bash/yt-dlp" = "share/bash-completion/completions/yt-dlp"
  118. "completions/zsh/_yt-dlp" = "share/zsh/site-functions/_yt-dlp"
  119. "completions/fish/yt-dlp.fish" = "share/fish/vendor_completions.d/yt-dlp.fish"
  120. "README.txt" = "share/doc/yt_dlp/README.txt"
  121. "yt-dlp.1" = "share/man/man1/yt-dlp.1"
  122. [tool.hatch.version]
  123. path = "yt_dlp/version.py"
  124. pattern = "_pkg_version = '(?P<version>[^']+)'"
  125. [tool.hatch.envs.default]
  126. features = ["curl-cffi", "default"]
  127. dependencies = ["pre-commit"]
  128. path = ".venv"
  129. installer = "uv"
  130. [tool.hatch.envs.default.scripts]
  131. setup = "pre-commit install --config .pre-commit-hatch.yaml"
  132. yt-dlp = "python -Werror -Xdev -m yt_dlp {args}"
  133. [tool.hatch.envs.hatch-static-analysis]
  134. detached = true
  135. features = ["static-analysis"]
  136. dependencies = [] # override hatch ruff version
  137. config-path = "pyproject.toml"
  138. [tool.hatch.envs.hatch-static-analysis.scripts]
  139. format-check = "autopep8 --diff {args:.}"
  140. format-fix = "autopep8 --in-place {args:.}"
  141. lint-check = "ruff check {args:.}"
  142. lint-fix = "ruff check --fix {args:.}"
  143. [tool.hatch.envs.hatch-test]
  144. features = ["test"]
  145. dependencies = [
  146. "pytest-randomly~=3.15",
  147. "pytest-rerunfailures~=14.0",
  148. "pytest-xdist[psutil]~=3.5",
  149. ]
  150. [tool.hatch.envs.hatch-test.scripts]
  151. run = "python -m devscripts.run_tests {args}"
  152. run-cov = "echo Code coverage not implemented && exit 1"
  153. [[tool.hatch.envs.hatch-test.matrix]]
  154. python = [
  155. "3.8",
  156. "3.9",
  157. "3.10",
  158. "3.11",
  159. "3.12",
  160. "pypy3.8",
  161. "pypy3.9",
  162. "pypy3.10",
  163. ]
  164. [tool.ruff]
  165. line-length = 120
  166. [tool.ruff.lint]
  167. ignore = [
  168. "E402", # module-import-not-at-top-of-file
  169. "E501", # line-too-long
  170. "E731", # lambda-assignment
  171. "E741", # ambiguous-variable-name
  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. "yt_dlp/jsinterp.py" = [
  244. "UP031", # printf-string-formatting
  245. ]
  246. [tool.ruff.lint.isort]
  247. known-first-party = [
  248. "bundle",
  249. "devscripts",
  250. "test",
  251. ]
  252. relative-imports-order = "closest-to-furthest"
  253. [tool.ruff.lint.flake8-quotes]
  254. docstring-quotes = "double"
  255. multiline-quotes = "single"
  256. inline-quotes = "single"
  257. avoid-escape = false
  258. [tool.ruff.lint.pep8-naming]
  259. classmethod-decorators = [
  260. "yt_dlp.utils.classproperty",
  261. ]
  262. [tool.ruff.lint.flake8-import-conventions]
  263. banned-from = [
  264. "base64",
  265. "datetime",
  266. "functools",
  267. "glob",
  268. "hashlib",
  269. "itertools",
  270. "json",
  271. "math",
  272. "os",
  273. "pathlib",
  274. "random",
  275. "re",
  276. "string",
  277. "sys",
  278. "time",
  279. "urllib",
  280. "uuid",
  281. "xml",
  282. ]
  283. [tool.ruff.lint.flake8-tidy-imports.banned-api]
  284. "yt_dlp.compat.compat_str".msg = "Use `str` instead."
  285. "yt_dlp.compat.compat_b64decode".msg = "Use `base64.b64decode` instead."
  286. "yt_dlp.compat.compat_urlparse".msg = "Use `urllib.parse` instead."
  287. "yt_dlp.compat.compat_parse_qs".msg = "Use `urllib.parse.parse_qs` instead."
  288. "yt_dlp.compat.compat_urllib_parse_unquote".msg = "Use `urllib.parse.unquote` instead."
  289. "yt_dlp.compat.compat_urllib_parse_urlencode".msg = "Use `urllib.parse.urlencode` instead."
  290. "yt_dlp.compat.compat_urllib_parse_urlparse".msg = "Use `urllib.parse.urlparse` instead."
  291. "yt_dlp.compat.compat_shlex_quote".msg = "Use `yt_dlp.utils.shell_quote` instead."
  292. "yt_dlp.utils.error_to_compat_str".msg = "Use `str` instead."
  293. [tool.autopep8]
  294. max_line_length = 120
  295. recursive = true
  296. exit-code = true
  297. jobs = 0
  298. select = [
  299. "E101",
  300. "E112",
  301. "E113",
  302. "E115",
  303. "E116",
  304. "E117",
  305. "E121",
  306. "E122",
  307. "E123",
  308. "E124",
  309. "E125",
  310. "E126",
  311. "E127",
  312. "E128",
  313. "E129",
  314. "E131",
  315. "E201",
  316. "E202",
  317. "E203",
  318. "E211",
  319. "E221",
  320. "E222",
  321. "E223",
  322. "E224",
  323. "E225",
  324. "E226",
  325. "E227",
  326. "E228",
  327. "E231",
  328. "E241",
  329. "E242",
  330. "E251",
  331. "E252",
  332. "E261",
  333. "E262",
  334. "E265",
  335. "E266",
  336. "E271",
  337. "E272",
  338. "E273",
  339. "E274",
  340. "E275",
  341. "E301",
  342. "E302",
  343. "E303",
  344. "E304",
  345. "E305",
  346. "E306",
  347. "E502",
  348. "E701",
  349. "E702",
  350. "E704",
  351. "W391",
  352. "W504",
  353. ]
  354. [tool.pytest.ini_options]
  355. addopts = "-ra -v --strict-markers"
  356. markers = [
  357. "download",
  358. ]