diff --git a/changelog.d/1191.misc.rst b/changelog.d/1191.misc.rst new file mode 100644 index 00000000..d865e3f8 --- /dev/null +++ b/changelog.d/1191.misc.rst @@ -0,0 +1 @@ +Move source to src diff --git a/pyproject.toml b/pyproject.toml index 2599fff6..41e14a4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,11 +79,6 @@ types = [ ] dev = [ "pre-commit>=2.9.3", - "doc8", - "mypy", - "ruff", - "typos", - "validate-pyproject", "tox", ] @@ -133,7 +128,7 @@ subliminal = [ [tool.setuptools.packages.find] namespaces = false -where = ["."] +where = ["src"] [tool.setuptools.dynamic] version = {attr = "subliminal.__version__"} @@ -166,17 +161,17 @@ 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 @@ -184,7 +179,7 @@ relative_files = true # https://docs.astral.sh/ruff/ [tool.ruff] line-length = 120 -src = ["subliminal", "tests"] +src = ["src", "tests"] exclude = [ "_version.py", ] @@ -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/ @@ -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 diff --git a/subliminal/__init__.py b/src/subliminal/__init__.py similarity index 100% rename from subliminal/__init__.py rename to src/subliminal/__init__.py diff --git a/subliminal/cache.py b/src/subliminal/cache.py similarity index 100% rename from subliminal/cache.py rename to src/subliminal/cache.py diff --git a/subliminal/cli.py b/src/subliminal/cli.py similarity index 100% rename from subliminal/cli.py rename to src/subliminal/cli.py diff --git a/subliminal/converters/__init__.py b/src/subliminal/converters/__init__.py similarity index 100% rename from subliminal/converters/__init__.py rename to src/subliminal/converters/__init__.py diff --git a/subliminal/converters/addic7ed.py b/src/subliminal/converters/addic7ed.py similarity index 100% rename from subliminal/converters/addic7ed.py rename to src/subliminal/converters/addic7ed.py diff --git a/subliminal/converters/opensubtitles.py b/src/subliminal/converters/opensubtitles.py similarity index 100% rename from subliminal/converters/opensubtitles.py rename to src/subliminal/converters/opensubtitles.py diff --git a/subliminal/converters/opensubtitlescom.py b/src/subliminal/converters/opensubtitlescom.py similarity index 100% rename from subliminal/converters/opensubtitlescom.py rename to src/subliminal/converters/opensubtitlescom.py diff --git a/subliminal/converters/subtitulamos.py b/src/subliminal/converters/subtitulamos.py similarity index 100% rename from subliminal/converters/subtitulamos.py rename to src/subliminal/converters/subtitulamos.py diff --git a/subliminal/converters/tvsubtitles.py b/src/subliminal/converters/tvsubtitles.py similarity index 100% rename from subliminal/converters/tvsubtitles.py rename to src/subliminal/converters/tvsubtitles.py diff --git a/subliminal/core.py b/src/subliminal/core.py similarity index 100% rename from subliminal/core.py rename to src/subliminal/core.py diff --git a/subliminal/exceptions.py b/src/subliminal/exceptions.py similarity index 100% rename from subliminal/exceptions.py rename to src/subliminal/exceptions.py diff --git a/subliminal/extensions.py b/src/subliminal/extensions.py similarity index 100% rename from subliminal/extensions.py rename to src/subliminal/extensions.py diff --git a/subliminal/matches.py b/src/subliminal/matches.py similarity index 100% rename from subliminal/matches.py rename to src/subliminal/matches.py diff --git a/subliminal/providers/__init__.py b/src/subliminal/providers/__init__.py similarity index 100% rename from subliminal/providers/__init__.py rename to src/subliminal/providers/__init__.py diff --git a/subliminal/providers/addic7ed.py b/src/subliminal/providers/addic7ed.py similarity index 100% rename from subliminal/providers/addic7ed.py rename to src/subliminal/providers/addic7ed.py diff --git a/subliminal/providers/bsplayer.py b/src/subliminal/providers/bsplayer.py similarity index 100% rename from subliminal/providers/bsplayer.py rename to src/subliminal/providers/bsplayer.py diff --git a/subliminal/providers/gestdown.py b/src/subliminal/providers/gestdown.py similarity index 100% rename from subliminal/providers/gestdown.py rename to src/subliminal/providers/gestdown.py diff --git a/subliminal/providers/napiprojekt.py b/src/subliminal/providers/napiprojekt.py similarity index 100% rename from subliminal/providers/napiprojekt.py rename to src/subliminal/providers/napiprojekt.py diff --git a/subliminal/providers/opensubtitles.py b/src/subliminal/providers/opensubtitles.py similarity index 100% rename from subliminal/providers/opensubtitles.py rename to src/subliminal/providers/opensubtitles.py diff --git a/subliminal/providers/opensubtitlescom.py b/src/subliminal/providers/opensubtitlescom.py similarity index 100% rename from subliminal/providers/opensubtitlescom.py rename to src/subliminal/providers/opensubtitlescom.py diff --git a/subliminal/providers/podnapisi.py b/src/subliminal/providers/podnapisi.py similarity index 100% rename from subliminal/providers/podnapisi.py rename to src/subliminal/providers/podnapisi.py diff --git a/subliminal/providers/subtitulamos.py b/src/subliminal/providers/subtitulamos.py similarity index 100% rename from subliminal/providers/subtitulamos.py rename to src/subliminal/providers/subtitulamos.py diff --git a/subliminal/providers/tvsubtitles.py b/src/subliminal/providers/tvsubtitles.py similarity index 100% rename from subliminal/providers/tvsubtitles.py rename to src/subliminal/providers/tvsubtitles.py diff --git a/subliminal/py.typed b/src/subliminal/py.typed similarity index 100% rename from subliminal/py.typed rename to src/subliminal/py.typed diff --git a/subliminal/refiners/__init__.py b/src/subliminal/refiners/__init__.py similarity index 100% rename from subliminal/refiners/__init__.py rename to src/subliminal/refiners/__init__.py diff --git a/subliminal/refiners/hash.py b/src/subliminal/refiners/hash.py similarity index 100% rename from subliminal/refiners/hash.py rename to src/subliminal/refiners/hash.py diff --git a/subliminal/refiners/metadata.py b/src/subliminal/refiners/metadata.py similarity index 100% rename from subliminal/refiners/metadata.py rename to src/subliminal/refiners/metadata.py diff --git a/subliminal/refiners/omdb.py b/src/subliminal/refiners/omdb.py similarity index 100% rename from subliminal/refiners/omdb.py rename to src/subliminal/refiners/omdb.py diff --git a/subliminal/refiners/tmdb.py b/src/subliminal/refiners/tmdb.py similarity index 100% rename from subliminal/refiners/tmdb.py rename to src/subliminal/refiners/tmdb.py diff --git a/subliminal/refiners/tvdb.py b/src/subliminal/refiners/tvdb.py similarity index 100% rename from subliminal/refiners/tvdb.py rename to src/subliminal/refiners/tvdb.py diff --git a/subliminal/score.py b/src/subliminal/score.py similarity index 100% rename from subliminal/score.py rename to src/subliminal/score.py diff --git a/subliminal/subtitle.py b/src/subliminal/subtitle.py similarity index 100% rename from subliminal/subtitle.py rename to src/subliminal/subtitle.py diff --git a/subliminal/utils.py b/src/subliminal/utils.py similarity index 100% rename from subliminal/utils.py rename to src/subliminal/utils.py diff --git a/subliminal/video.py b/src/subliminal/video.py similarity index 100% rename from subliminal/video.py rename to src/subliminal/video.py diff --git a/tests/conftest.py b/tests/conftest.py index ac35cf47..5181d9ce 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/providers/test_addic7ed.py b/tests/providers/test_addic7ed.py index 77ac3431..69a56bc9 100644 --- a/tests/providers/test_addic7ed.py +++ b/tests/providers/test_addic7ed.py @@ -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', diff --git a/tests/providers/test_bsplayer.py b/tests/providers/test_bsplayer.py index 295bfec3..83d16b31 100644 --- a/tests/providers/test_bsplayer.py +++ b/tests/providers/test_bsplayer.py @@ -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'), diff --git a/tests/providers/test_gestdown.py b/tests/providers/test_gestdown.py index 1d0a575b..f25aa1c8 100644 --- a/tests/providers/test_gestdown.py +++ b/tests/providers/test_gestdown.py @@ -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'), diff --git a/tests/providers/test_napiprojekt.py b/tests/providers/test_napiprojekt.py index 74aa9e0d..e5220867 100644 --- a/tests/providers/test_napiprojekt.py +++ b/tests/providers/test_napiprojekt.py @@ -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'), diff --git a/tests/providers/test_opensubtitles.py b/tests/providers/test_opensubtitles.py index 872c97f1..379cb892 100644 --- a/tests/providers/test_opensubtitles.py +++ b/tests/providers/test_opensubtitles.py @@ -2,6 +2,8 @@ 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, @@ -9,7 +11,6 @@ OpenSubtitlesVipProvider, Unauthorized, ) -from vcr import VCR # type: ignore[import-untyped] USERNAME = 'python-subliminal' PASSWORD = 'subliminal' diff --git a/tests/providers/test_opensubtitlescom.py b/tests/providers/test_opensubtitlescom.py index 30076b07..77e85c4a 100644 --- a/tests/providers/test_opensubtitlescom.py +++ b/tests/providers/test_opensubtitlescom.py @@ -2,6 +2,8 @@ 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, @@ -9,7 +11,6 @@ OpenSubtitlesComSubtitle, Unauthorized, ) -from vcr import VCR # type: ignore[import-untyped] USERNAME = 'python-subliminal-test' PASSWORD = 'subliminal' diff --git a/tests/providers/test_podnapisi.py b/tests/providers/test_podnapisi.py index cae26ddb..2a993a41 100644 --- a/tests/providers/test_podnapisi.py +++ b/tests/providers/test_podnapisi.py @@ -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'), diff --git a/tests/providers/test_providers.py b/tests/providers/test_providers.py index a72adc78..5e31fec2 100644 --- a/tests/providers/test_providers.py +++ b/tests/providers/test_providers.py @@ -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, @@ -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', diff --git a/tests/providers/test_subtitulamos.py b/tests/providers/test_subtitulamos.py index 12e0c13d..2976605e 100644 --- a/tests/providers/test_subtitulamos.py +++ b/tests/providers/test_subtitulamos.py @@ -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', diff --git a/tests/providers/test_tvsubtitles.py b/tests/providers/test_tvsubtitles.py index 3a9436c8..e6d33a74 100644 --- a/tests/providers/test_tvsubtitles.py +++ b/tests/providers/test_tvsubtitles.py @@ -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'), diff --git a/tests/refiners/test_metadata.py b/tests/refiners/test_metadata.py index ab2ceac0..f1cbbb13 100644 --- a/tests/refiners/test_metadata.py +++ b/tests/refiners/test_metadata.py @@ -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, diff --git a/tests/refiners/test_omdb.py b/tests/refiners/test_omdb.py index d245203e..db35fe7c 100644 --- a/tests/refiners/test_omdb.py +++ b/tests/refiners/test_omdb.py @@ -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', diff --git a/tests/refiners/test_tmdb.py b/tests/refiners/test_tmdb.py index b494c3f3..0eac768f 100644 --- a/tests/refiners/test_tmdb.py +++ b/tests/refiners/test_tmdb.py @@ -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', diff --git a/tests/refiners/test_tvdb.py b/tests/refiners/test_tvdb.py index 065471e0..df58136f 100644 --- a/tests/refiners/test_tvdb.py +++ b/tests/refiners/test_tvdb.py @@ -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', diff --git a/tests/test_core.py b/tests/test_core.py index 15d24cda..489f670b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -9,6 +9,7 @@ import pytest from babelfish import Language # type: ignore[import-untyped] + from subliminal.core import ( check_video, save_subtitles, diff --git a/tests/test_extensions.py b/tests/test_extensions.py index a2d8d194..7ff0bd59 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -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, diff --git a/tests/test_matches.py b/tests/test_matches.py index 9adebb98..e1fd7f2b 100644 --- a/tests/test_matches.py +++ b/tests/test_matches.py @@ -1,4 +1,5 @@ import pytest + from subliminal.matches import guess_matches # Core test diff --git a/tests/test_provider.py b/tests/test_provider.py index 838b18bb..9ec1b7a0 100644 --- a/tests/test_provider.py +++ b/tests/test_provider.py @@ -2,6 +2,7 @@ from __future__ import annotations import pytest + from subliminal.providers import FeatureNotFound, ParserBeautifulSoup, Provider from subliminal.video import Episode, Movie diff --git a/tests/test_score.py b/tests/test_score.py index 25276541..115dc1c7 100644 --- a/tests/test_score.py +++ b/tests/test_score.py @@ -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 diff --git a/tests/test_subtitle.py b/tests/test_subtitle.py index 123c63fa..551a7fd2 100644 --- a/tests/test_subtitle.py +++ b/tests/test_subtitle.py @@ -4,6 +4,7 @@ import pytest from babelfish import Language # type: ignore[import-untyped] + from subliminal.subtitle import ( EmbeddedSubtitle, LanguageType, diff --git a/tests/test_utils.py b/tests/test_utils.py index daed756e..f9c71f70 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,6 +6,7 @@ import pytest import requests + from subliminal.exceptions import ServiceUnavailable from subliminal.utils import ( clip, diff --git a/tests/test_video.py b/tests/test_video.py index 61a213a0..78ac5801 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -5,6 +5,7 @@ from unittest.mock import Mock import pytest + from subliminal.utils import sanitize, timestamp from subliminal.video import Episode, Movie, Video diff --git a/tox.ini b/tox.ini index 6cd362cd..4a23c9a4 100644 --- a/tox.ini +++ b/tox.ini @@ -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]