Skip to content

Commit

Permalink
Move source to src (#1191)
Browse files Browse the repository at this point in the history
* move source to src

* run pre-commit

* add news
  • Loading branch information
getzze authored Nov 23, 2024
1 parent 7fb1410 commit 282d9aa
Show file tree
Hide file tree
Showing 60 changed files with 45 additions and 26 deletions.
1 change: 1 addition & 0 deletions changelog.d/1191.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move source to src
19 changes: 7 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ types = [
]
dev = [
"pre-commit>=2.9.3",
"doc8",
"mypy",
"ruff",
"typos",
"validate-pyproject",
"tox",
]

Expand Down Expand Up @@ -133,7 +128,7 @@ subliminal = [

[tool.setuptools.packages.find]
namespaces = false
where = ["."]
where = ["src"]

[tool.setuptools.dynamic]
version = {attr = "subliminal.__version__"}
Expand Down Expand Up @@ -166,25 +161,25 @@ show_missing = true
skip_covered = true
fail_under = 80
omit = [
"subliminal/cli.py",
"src/subliminal/cli.py",
]

[tool.coverage.paths]
source = [
"subliminal",
"src/subliminal",
"**/site-packages/subliminal",
]

[tool.coverage.run]
source = ["subliminal"]
source = ["src"]
branch = true
relative_files = true


# https://docs.astral.sh/ruff/
[tool.ruff]
line-length = 120
src = ["subliminal", "tests"]
src = ["src", "tests"]
exclude = [
"_version.py",
]
Expand Down Expand Up @@ -228,7 +223,7 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
"docs/conf*.py" = ["ALL"]
"subliminal/__init__.py" = ["E402"]
"src/subliminal/__init__.py" = ["E402"]
"tests/*.py" = ["D", "S", "RUF012", "ANN", "FBT"]

# https://docs.astral.sh/ruff/formatter/
Expand Down Expand Up @@ -285,7 +280,7 @@ showcontent = false

# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
files = "subliminal/**/*.py"
files = "src/**/*.py"
exclude = ['build', 'dist', 'docs']
# global-only flags
pretty = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest
import requests
from babelfish import Country # type: ignore[import-untyped]

from subliminal import Episode, Movie
from subliminal.cache import region

Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_addic7ed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language, language_converters # type: ignore[import-untyped]
from vcr import VCR # type: ignore[import-untyped]

from subliminal.exceptions import AuthenticationError, ConfigurationError
from subliminal.providers.addic7ed import Addic7edProvider, Addic7edSubtitle, addic7ed_sanitize, series_year_re
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_bsplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from subliminal.providers.bsplayer import BSPlayerProvider, BSPlayerSubtitle
from vcr import VCR # type: ignore[import-untyped]

from subliminal.providers.bsplayer import BSPlayerProvider, BSPlayerSubtitle

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_gestdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language, language_converters # type: ignore[import-untyped]
from subliminal.providers.gestdown import GestdownProvider, GestdownSubtitle
from vcr import VCR # type: ignore[import-untyped]

from subliminal.providers.gestdown import GestdownProvider, GestdownSubtitle

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_napiprojekt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from subliminal.providers.napiprojekt import NapiProjektProvider, NapiProjektSubtitle
from vcr import VCR # type: ignore[import-untyped]

from subliminal.providers.napiprojekt import NapiProjektProvider, NapiProjektSubtitle

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_opensubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from vcr import VCR # type: ignore[import-untyped]

from subliminal.exceptions import ConfigurationError
from subliminal.providers.opensubtitles import (
OpenSubtitlesProvider,
OpenSubtitlesSubtitle,
OpenSubtitlesVipProvider,
Unauthorized,
)
from vcr import VCR # type: ignore[import-untyped]

USERNAME = 'python-subliminal'
PASSWORD = 'subliminal'
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_opensubtitlescom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from vcr import VCR # type: ignore[import-untyped]

from subliminal.exceptions import ConfigurationError
from subliminal.providers.opensubtitlescom import (
OpenSubtitlesComError,
OpenSubtitlesComProvider,
OpenSubtitlesComSubtitle,
Unauthorized,
)
from vcr import VCR # type: ignore[import-untyped]

USERNAME = 'python-subliminal-test'
PASSWORD = 'subliminal'
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_podnapisi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from subliminal.providers.podnapisi import PodnapisiProvider, PodnapisiSubtitle
from vcr import VCR # type: ignore[import-untyped]

from subliminal.providers.podnapisi import PodnapisiProvider, PodnapisiSubtitle

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]
from vcr import VCR # type: ignore[import-untyped]

from subliminal.core import (
AsyncProviderPool,
ProviderPool,
Expand All @@ -14,7 +16,6 @@
from subliminal.providers.tvsubtitles import TVsubtitlesSubtitle
from subliminal.score import episode_scores
from subliminal.subtitle import Subtitle
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_subtitulamos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import pytest
from babelfish import Language, language_converters # type: ignore[import-untyped]
from vcr import VCR # type: ignore[import-untyped]

from subliminal.exceptions import NotInitializedProviderError
from subliminal.providers.subtitulamos import SubtitulamosProvider, SubtitulamosSubtitle
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
3 changes: 2 additions & 1 deletion tests/providers/test_tvsubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
from babelfish import Language, language_converters # type: ignore[import-untyped]
from subliminal.providers.tvsubtitles import TVsubtitlesProvider, TVsubtitlesSubtitle
from vcr import VCR # type: ignore[import-untyped]

from subliminal.providers.tvsubtitles import TVsubtitlesProvider, TVsubtitlesSubtitle

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
Expand Down
1 change: 1 addition & 0 deletions tests/refiners/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
from babelfish import Language # type: ignore[import-untyped]
from knowit.units import units # type: ignore[import-untyped]

from subliminal.core import scan_video
from subliminal.refiners.metadata import (
get_float,
Expand Down
3 changes: 2 additions & 1 deletion tests/refiners/test_omdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
import requests
from vcr import VCR # type: ignore[import-untyped]

from subliminal.refiners.omdb import OMDBClient, refine
from subliminal.video import Episode, Movie
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
3 changes: 2 additions & 1 deletion tests/refiners/test_tmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import pytest
import requests
from vcr import VCR # type: ignore[import-untyped]

from subliminal.refiners.tmdb import TMDBClient, refine
from subliminal.video import Episode, Movie
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
3 changes: 2 additions & 1 deletion tests/refiners/test_tvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import pytest
import requests
from vcr import VCR # type: ignore[import-untyped]

from subliminal.refiners.tvdb import TVDBClient, refine, series_re
from subliminal.video import Episode
from vcr import VCR # type: ignore[import-untyped]

vcr = VCR(
path_transformer=lambda path: path + '.yaml',
Expand Down
1 change: 1 addition & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]

from subliminal.core import (
check_video,
save_subtitles,
Expand Down
1 change: 1 addition & 0 deletions tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from importlib_metadata import entry_points # type: ignore[assignment,no-redef,import-not-found]

import pytest

from subliminal.extensions import (
EntryPoint,
RegistrableExtensionManager,
Expand Down
1 change: 1 addition & 0 deletions tests/test_matches.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from subliminal.matches import guess_matches

# Core test
Expand Down
1 change: 1 addition & 0 deletions tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import pytest

from subliminal.providers import FeatureNotFound, ParserBeautifulSoup, Provider
from subliminal.video import Episode, Movie

Expand Down
1 change: 1 addition & 0 deletions tests/test_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]

from subliminal.providers.addic7ed import Addic7edSubtitle
from subliminal.providers.opensubtitles import OpenSubtitlesSubtitle
from subliminal.providers.podnapisi import PodnapisiSubtitle
Expand Down
1 change: 1 addition & 0 deletions tests/test_subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest
from babelfish import Language # type: ignore[import-untyped]

from subliminal.subtitle import (
EmbeddedSubtitle,
LanguageType,
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import pytest
import requests

from subliminal.exceptions import ServiceUnavailable
from subliminal.utils import (
clip,
Expand Down
1 change: 1 addition & 0 deletions tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from unittest.mock import Mock

import pytest

from subliminal.utils import sanitize, timestamp
from subliminal.video import Episode, Movie, Video

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ commands = {[testenv:tests]commands}
extras =
types
tests
commands = mypy --install-types --non-interactive {posargs:subliminal tests}
commands = mypy --install-types --non-interactive {posargs:src tests}


[testenv:coverage]
Expand Down

0 comments on commit 282d9aa

Please sign in to comment.