mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-10-04 16:42:57 +00:00
Add hatch scripts and pre-commit
This commit is contained in:
parent
1c5d20813e
commit
f23de99414
15
.pre-commit-config.yaml
Normal file
15
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: linter
|
||||
name: linter
|
||||
entry: hatch run lint --no-fix
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: false
|
||||
- id: format
|
||||
name: format
|
||||
entry: hatch run format
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: true
|
|
@ -62,8 +62,10 @@ build = [
|
|||
"wheel",
|
||||
]
|
||||
dev = [
|
||||
"ruff==0.2.1",
|
||||
"autopep8",
|
||||
"pre-commit",
|
||||
"pytest",
|
||||
"ruff==0.2.1",
|
||||
]
|
||||
pyinstaller = ["pyinstaller>=6.3"]
|
||||
py2exe = ["py2exe>=0.12"]
|
||||
|
@ -80,6 +82,28 @@ yt-dlp = "yt_dlp:main"
|
|||
[project.entry-points.pyinstaller40]
|
||||
hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
|
||||
|
||||
[tool.hatch.envs.default]
|
||||
dependencies = ["yt-dlp[dev]"]
|
||||
|
||||
[tool.hatch.envs.default.scripts]
|
||||
install = "pre-commit install"
|
||||
lint = "ruff check {args:.}"
|
||||
format = "autopep8 {args:.}"
|
||||
tests = "python -m devscripts.run_tests {args}"
|
||||
tests-core = "pytest -We --tb=short --ignore=test/test_download.py {args}"
|
||||
|
||||
[[tool.hatch.envs.default.overrides.env.TEST_ALL.matrix.value]]
|
||||
python = [
|
||||
"3.8",
|
||||
"3.9",
|
||||
"3.10",
|
||||
"3.11",
|
||||
"3.12",
|
||||
"pypy3.8",
|
||||
"pypy3.9",
|
||||
"pypy3.10",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
include = [
|
||||
"/yt_dlp",
|
||||
|
@ -133,12 +157,28 @@ select = [
|
|||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # pyflakes
|
||||
# "I", # import order
|
||||
"I", # import order
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"devscripts/lazy_load_template.py" = ["F401"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["test"]
|
||||
known-first-party = [
|
||||
"bundle",
|
||||
"devscripts",
|
||||
"test",
|
||||
]
|
||||
relative-imports-order = "closest-to-furthest"
|
||||
|
||||
[tool.autopep8]
|
||||
max_line_length = 120
|
||||
in-place = true
|
||||
recursive = true
|
||||
jobs = 0
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-ra -v --strict-markers"
|
||||
markers = [
|
||||
"download",
|
||||
]
|
||||
|
|
18
setup.cfg
18
setup.cfg
|
@ -1,18 +0,0 @@
|
|||
[tool:pytest]
|
||||
addopts = -ra -v --strict-markers
|
||||
markers =
|
||||
download
|
||||
|
||||
|
||||
[tox:tox]
|
||||
skipsdist = true
|
||||
envlist = py{38,39,310,311,312},pypy{38,39,310}
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv] # tox
|
||||
deps =
|
||||
pytest
|
||||
commands = pytest {posargs:"-m not download"}
|
||||
passenv = HOME # For test_compat_expanduser
|
||||
setenv =
|
||||
# PYTHONWARNINGS = error # Catches PIP's warnings too
|
Loading…
Reference in a new issue