Skip to content

Commit

Permalink
Add ruff to dev dependencies, remove black, isort and flake8, update …
Browse files Browse the repository at this point in the history
…pre-commit hooks
  • Loading branch information
deepaerial committed Jun 23, 2023
1 parent 79fc76f commit d34dd51
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 173 deletions.
7 changes: 0 additions & 7 deletions .flake8

This file was deleted.

17 changes: 5 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@
repos:
- repo: local
hooks:
- id: isort
name: isort
stages: [commit]
language: system
entry: poetry run isort
types: [python]
- id: ruff
name: ruff
entry: ruff
language: python
types: [python]

- id: black
name: black
stages: [commit]
language: system
entry: poetry run black
types: [python]

161 changes: 28 additions & 133 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,28 @@ init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = false

[tool.isort]
profile = "black"
[tool.ruff]
exclude = [
".git",
".git-rewrite",
".mypy_cache",
".ruff_cache",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist"
]
# Same as Black.
line-length = 120
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"

[tool.ruff.per-file-ignores]
"poetry.lock" = ["E501"]

[tool.poetry]
name = "ytdl-api"
Expand All @@ -56,10 +76,7 @@ confz = "^1.6.1"
pyhumps = "^3.7.2"

[tool.poetry.group.dev.dependencies]
black = "*"
isort = "^5.10.1"
pytest = "*"
flake8 = "^3.7.9"
pdbpp = "^0.10.2"
requests = "^2.23.0"
pytest-pep8 = "^1.0.6"
Expand All @@ -72,6 +89,7 @@ pytest-mypy = "^0.9.1"
pyclean = "^2.2.0"
pytest-mock = "^3.10.0"
httpx = "^0.23.3"
ruff = "^0.0.275"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 0 additions & 2 deletions scripts/run_black.sh

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/run_flake8.sh

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/run_isort.sh

This file was deleted.

6 changes: 1 addition & 5 deletions ytdl_api/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from typing import Generator, Optional

from fastapi import Cookie, Depends, HTTPException, Response
from fastapi.exceptions import RequestValidationError
from pydantic import ValidationError
from pydantic.error_wrappers import ErrorWrapper
from starlette import status

from . import datasource, downloaders, queue, storage
Expand All @@ -19,9 +16,8 @@
on_start_converting,
)
from .config import Settings
from .constants import DownloaderType, DownloadStatus
from .constants import DownloadStatus
from .schemas.models import Download
from .schemas.requests import DownloadParams


# Ignoring get_settings dependency in coverage because it will be
Expand Down
3 changes: 1 addition & 2 deletions ytdl_api/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
from abc import ABC, abstractmethod
from functools import partial
from pathlib import Path
from typing import Dict, Literal, Optional, Callable, Coroutine, Any
from typing import Dict, Literal, Optional

import ffmpeg
from pytube import StreamQuery, YouTube

from .constants import DownloadStatus

from .callbacks import (
noop_callback,
Expand Down
2 changes: 1 addition & 1 deletion ytdl_api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Request
from fastapi.responses import FileResponse, StreamingResponse
from fastapi.responses import FileResponse
from sse_starlette.sse import EventSourceResponse
from starlette import status

Expand Down
1 change: 0 additions & 1 deletion ytdl_api/schemas/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime
from pathlib import Path
from typing import List, Optional, Union

from pydantic import AnyHttpUrl, Field
Expand Down
2 changes: 1 addition & 1 deletion ytdl_api/types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Callable, Coroutine, Optional, TypedDict
from typing import Optional, TypedDict

from pydantic import AnyHttpUrl

Expand Down

0 comments on commit d34dd51

Please sign in to comment.