Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/scripts/prep_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,16 @@
(pytest's script I stole a lot from)
"""

from __future__ import annotations

import argparse
import datetime as dt
import pathlib
import re
import shutil
import subprocess
from textwrap import indent
from typing import TYPE_CHECKING

import github3

if TYPE_CHECKING:
from github3.repos import Repository
from github3.repos import Repository

SLUG = "MoeMusic/Moe"
PR_BODY = """
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
18 changes: 6 additions & 12 deletions moe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,29 @@
and database connection via the session.
"""

from __future__ import annotations

import importlib
import importlib.metadata
import logging
import os
import re
import sys
from itertools import chain
from pathlib import Path
from typing import TYPE_CHECKING, Any, NamedTuple, cast
from types import ModuleType
from typing import Any, NamedTuple, cast

import alembic.command
import alembic.config
import dynaconf
import dynaconf.base
import dynaconf.validator
import importlib_metadata
import pluggy
import sqlalchemy
import sqlalchemy.event
import sqlalchemy.orm
from sqlalchemy.engine.base import Connection

import moe

if TYPE_CHECKING:
from types import ModuleType

from sqlalchemy.engine.base import Connection

moe_sessionmaker = sqlalchemy.orm.sessionmaker(autoflush=False)

__all__ = ["CONFIG", "Config", "ConfigValidationError", "ExtraPlugin"]
Expand Down Expand Up @@ -192,7 +186,7 @@ def register_sa_event_listeners() -> None:
def _my_func(
session: sqlalchemy.orm.Session,
flush_context: sqlalchemy.orm.UOWTransaction,
instances: Optional[Any],
instances: Any | None,
):
print("we made it")

Expand Down Expand Up @@ -425,7 +419,7 @@ def _register_enabled_plugins(self) -> None:
)

# register third-party installed plugins
plugins = importlib_metadata.entry_points().select(group="moe.plugins")
plugins = importlib.metadata.entry_points().select(group="moe.plugins")
if plugins:
for plugin in plugins:
if plugin.name in self.enabled_plugins:
Expand Down
8 changes: 2 additions & 6 deletions moe/duplicate/dup_cli.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
"""Adds a duplicate resolution prompt to the CLI."""

from __future__ import annotations

import logging
from typing import TYPE_CHECKING, cast
from typing import cast

from rich.columns import Columns
from rich.console import Group, RenderableType
from rich.padding import Padding
from rich.panel import Panel
from rich.table import Table
from rich.text import Text
from sqlalchemy.orm.session import Session

import moe
from moe.cli import console
from moe.library import Album, Extra, LibItem, MergeStrategy, Track
from moe.remove import remove_item
from moe.util.cli import PromptChoice, choice_prompt

if TYPE_CHECKING:
from sqlalchemy.orm.session import Session

log = logging.getLogger("moe.cli.dup")


Expand Down
8 changes: 5 additions & 3 deletions moe/move/move_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import shutil
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

import dynaconf
import dynaconf.base
Expand All @@ -18,6 +18,8 @@
from moe.library import Album, Extra, LibItem, Track

if TYPE_CHECKING:
from collections.abc import Callable

import pluggy

__all__ = ["copy_item", "fmt_item_path", "move_item"]
Expand Down Expand Up @@ -61,7 +63,7 @@ def override_album_path_config(album: Album) -> str | None:
.. code:: python

@moe.hookimpl
def override_album_path_config(album: Album) -> Optional[str]:
def override_album_path_config(album: Album) -> str | None:
if "Classical" in album.title:
return "Classical/{album.artist}/{album.title} ({album.year})"
elif "Soundtrack" in album.title:
Expand All @@ -88,7 +90,7 @@ def override_extra_path_config(extra: Extra) -> str | None:
.. code:: python

@moe.hookimpl
def override_extra_path_config(extra: Extra) -> Optional[str]:
def override_extra_path_config(extra: Extra) -> str | None:
if extra.path.name.lower().endswith(('.jpg', '.png')):
if 'cover' in extra.path.name.lower():
return f"{extra.album.title}.jpg"
Expand Down
12 changes: 4 additions & 8 deletions moe/plugins/musicbrainz/mb_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,24 @@
* https://python-musicbrainzngs.readthedocs.io/en/latest/api/
"""

from __future__ import annotations

import datetime
import importlib.metadata
import logging
from typing import TYPE_CHECKING, Any, Callable, cast
from collections.abc import Callable
from pathlib import Path
from typing import Any, cast

import dynaconf.base
import mediafile
import musicbrainzngs
from sqlalchemy.orm.session import Session

import moe
from moe import config
from moe.library import Album, LibItem, MergeStrategy, MetaAlbum, MetaTrack, Track
from moe.moe_import import CandidateAlbum
from moe.util.core import match

if TYPE_CHECKING:
from pathlib import Path

from sqlalchemy.orm.session import Session

__all__ = [
"MBAuthError",
"add_releases_to_collection",
Expand Down
2 changes: 0 additions & 2 deletions moe/plugins/transcode/transcode_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Transcode music."""

from __future__ import annotations

import logging
import multiprocessing
import shlex
Expand Down
2 changes: 1 addition & 1 deletion moe/util/cli/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import logging
import operator
from collections.abc import Callable
from dataclasses import dataclass
from typing import Callable

import questionary

Expand Down
11 changes: 3 additions & 8 deletions moe/util/cli/query.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"""CLI-specific query help functionality."""

from __future__ import annotations

import argparse
import logging
from typing import TYPE_CHECKING

from moe.query import QueryError, QueryType, query

if TYPE_CHECKING:
from sqlalchemy.orm.session import Session
from sqlalchemy.orm.session import Session

from moe.library import Album, Extra, Track
from moe.library import Album, Extra, Track
from moe.query import QueryError, QueryType, query

__all__ = ["cli_query", "query_parser"]

Expand Down
4 changes: 2 additions & 2 deletions moe/util/core/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import difflib
import logging
from enum import Enum
from typing import Any, Optional
from typing import Any

from moe.library import MetaAlbum, MetaTrack

Expand All @@ -19,7 +19,7 @@
]

# Custom type declarations used for abbreviated annotations.
TrackMatch = tuple[Optional[MetaTrack], Optional[MetaTrack]]
TrackMatch = tuple[MetaTrack | None, MetaTrack | None]
TrackCoord = tuple[
tuple[int, int], tuple[int, int]
] # ((a.disc, a.track_num), (b.disc, b.track_num))
Expand Down
23 changes: 11 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ classifiers = [
]
readme = "README.rst"
license = { text = "MIT" }
requires-python = ">=3.9, <3.14"
requires-python = ">=3.10, <3.15"
dependencies = [
"alembic (>=1.4.2,<2.0.0)",
"dynaconf (>=3.1.4,<4.0.0)",
"importlib-metadata (>=7.0.1,<8.0.0)",
"mediafile (>=0.13.0,<1.0.0)",
"pluggy (>=1.3.0,<2.0.0)",
"rich (>=13.0.0,<14.0.0)",
"rich (>=14.0.0,<15.0.0)",
"SQLAlchemy (>=2.0,<2.1)",
"Unidecode (>=1.2.0,<2.0.0)",
"typing_extensions (>=4.0.0,<5.0.0) ; python_version < '3.11'",
Expand All @@ -41,21 +40,21 @@ documentation = "https://mrmoe.readthedocs.io/en/latest/index.html"
[dependency-groups]
test = [
"debugpy (>=1.4.1,<2.0.0)",
"pytest (>=8.0.0,<9.0.0)",
"pytest-cov (>=6.0.0,<7.0.0)",
"pytest (>=9.0.0,<10.0.0)",
"pytest-cov (>=7.0.0,<8.0.0)",
"tox (>=4.0.0,<5.0.0)",
]
lint = [
"commitizen (>=3.0.0,<4.0.0)",
"commitizen (>=4.0.0,<5.0.0)",
"github3.py (>=4.0.0,<5.0.0)",
"pre-commit (>=4.0.0,<5.0.0)",
"pyright==1.1.402",
"ruff==0.12.1",
"pyright==1.1.407",
"ruff==0.14.5",
]
docs = [
"furo",
"pypandoc (>=1.9,<2.0)",
"Sphinx (>=7.0.0,<8.0.0)",
"Sphinx (>=8.0.0,<9.0.0)",
]

[tool.commitizen]
Expand All @@ -71,9 +70,9 @@ bump_pattern = '^(build|deprecate|feat|fix|perf)'
bump_map = { feat = "MINOR", build = "PATCH", deprecate = "PATCH", fix = "PATCH", perf = "PATCH" }
schema_pattern = '(build|ci|deprecate|docs|feat|fix|perf|refactor|release|style|test)(\(\w+\))?!?:\s\S.*'

[tool.pytest.ini_options]
log_cli_level = 10
addopts = "--color=yes"
[tool.pytest]
log_cli_level = "10"
addopts = ["--color=yes"]
markers = [
"darwin: tests that should only run on apple",
"linux: tests that should only run on linux",
Expand Down
7 changes: 1 addition & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""Shared pytest configuration."""

from __future__ import annotations

import datetime
import random
import shutil
import sys
import textwrap
from collections.abc import Callable, Iterator
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Callable
from unittest.mock import MagicMock

import pytest
Expand All @@ -22,9 +20,6 @@
from moe.config import Config, ExtraPlugin, moe_sessionmaker
from moe.library import Album, Extra, Track

if TYPE_CHECKING:
from collections.abc import Iterator

__all__ = ["album_factory", "extra_factory", "track_factory"]

RESOURCE_DIR = Path(__file__).parent / "resources"
Expand Down
2 changes: 0 additions & 2 deletions tests/move/test_move_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Tests the core api for moving items."""

from __future__ import annotations

from pathlib import Path
from unittest.mock import MagicMock, patch

Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist= true
envlist = py{39,310,311,312,313}-test, docs, lint
envlist = py{310,311,312,313,314}-test, docs, lint

[testenv]
description = unit tests
Expand All @@ -12,7 +12,7 @@ commands = poetry run pytest {posargs}

[testenv:lint]
description = lint tests
basepython = 3.13
basepython = 3.14
commands_pre =
poetry install --all-extras
commands =
Expand All @@ -21,9 +21,9 @@ commands =

[testenv:docs]
description = docs tests
basepython = 3.13
basepython = 3.14
skip_install = true
allowlist_externals = poetry
commands_pre =
poetry install --without lint,test
poetry install --without lint,test --all-extras
commands = poetry run sphinx-build -W -b html docs {envtmpdir}/html {posargs}