Skip to content
Draft
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: 3 additions & 4 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ MSS can be used simply as::
# ...

For compatibility with existing code, :py:func:`mss.mss` is still available in
10.2, but deprecated::
11.0, but deprecated::

import mss

with mss.mss() as sct: # Deprecated in 10.2
# ...

For compatibility with existing code, platform-specific class names are also
still available in 10.2::
still available in 11.0, but are also deprecated::

# GNU/Linux
from mss.linux import MSS
Expand Down Expand Up @@ -91,8 +91,7 @@ If you want to choose a particular backend, you can pass the ``backend`` keyword
with MSS(backend="xgetimage") as sct:
...

GNU/Linux has multiple backend implementations. Windows also exposes the named ``gdi`` backend, which is currently the
same as ``default``. The GNU/Linux backends are described in their own section below.
GNU/Linux has multiple backend implementations. Windows also exposes the named ``gdi`` backend, which is currently the same as ``default``. The GNU/Linux backends are described in their own section below.


GNU/Linux
Expand Down
4 changes: 0 additions & 4 deletions src/mss/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,3 @@ def with_cursor(self) -> bool:
.. versionadded:: 8.0.0
"""
return self._impl.with_cursor


# TODO(jholveck): #493 Remove compatibility alias after 10.x transition period.
MSSBase = MSS
4 changes: 2 additions & 2 deletions src/mss/darwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class MSS(_MSS):
"""

def __init__(self, /, **kwargs: Any) -> None:
# TODO(jholveck): #493 Remove compatibility constructor after 10.x transition period.
# TODO(jholveck): #517 Remove compatibility path once 10.x transition period ends.
warnings.warn(
"mss.darwin.MSS is deprecated and will be removed in 11.0; use mss.MSS instead",
"mss.darwin.MSS is deprecated and will be removed in a future release; use mss.MSS instead",
DeprecationWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion src/mss/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def mss(**kwargs: Any) -> MSS:
.. deprecated:: 10.2.0
Use :class:`mss.MSS` directly.
"""
# TODO(jholveck): #493 Remove compatibility deprecation path once 10.x transition period ends.
# TODO(jholveck): #517 Remove compatibility path once 10.x transition period ends.
warnings.warn(
"mss.mss is deprecated and will be removed in a future release; use mss.MSS instead",
DeprecationWarning,
Expand Down
19 changes: 2 additions & 17 deletions src/mss/linux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@
from mss.base import MSSImplementation
from mss.exception import ScreenShotError

# TODO(jholveck): #493 Remove these legacy symbol re-exports after 10.x transition period.
from mss.linux.xlib import ( # noqa: F401
CFUNCTIONS,
PLAINMASK,
ZPIXMAP,
Display,
XErrorEvent,
XFixesCursorImage,
XImage,
XRRCrtcInfo,
XRRModeInfo,
XRRScreenResources,
XWindowAttributes,
)

__all__ = ["MSS"]

BACKENDS = ["default", "xlib", "xgetimage", "xshmgetimage"]
Expand All @@ -34,9 +19,9 @@ class MSS(_MSS):
"""

def __init__(self, /, **kwargs: Any) -> None:
# TODO(jholveck): #493 Remove compatibility constructor after 10.x transition period.
# TODO(jholveck): #517 Remove compatibility path once 10.x transition period ends.
warnings.warn(
"mss.linux.MSS is deprecated and will be removed in 11.0; use mss.MSS instead",
"mss.linux.MSS is deprecated and will be removed in a future release; use mss.MSS instead",
DeprecationWarning,
stacklevel=2,
)
Expand Down
4 changes: 2 additions & 2 deletions src/mss/windows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class MSS(_MSS):
"""

def __init__(self, /, **kwargs: Any) -> None:
# TODO(jholveck): #493 Remove compatibility constructor after 10.x transition period.
# TODO(jholveck): #517 Remove compatibility path once 10.x transition period ends.
warnings.warn(
"mss.windows.MSS is deprecated and will be removed in 11.0; use mss.MSS instead",
"mss.windows.MSS is deprecated and will be removed in a future release; use mss.MSS instead",
DeprecationWarning,
stacklevel=2,
)
Expand Down
23 changes: 2 additions & 21 deletions src/tests/test_compat_10_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import mss
from mss import MSS
from mss.base import MSSBase


class PlatformModule(Protocol):
Expand Down Expand Up @@ -81,27 +80,16 @@ def _platform_factory_from_import_style() -> type[MSS]:
_factory_from_module_style,
],
)
def test_mss_factory_documented_styles_return_mssbase(factory_getter: MSSFactoryGetter) -> None:
def test_mss_factory_documented_styles_return_mss(factory_getter: MSSFactoryGetter) -> None:
factory = factory_getter()

with pytest.warns(DeprecationWarning, match=r"^mss\.mss is deprecated"):
context = factory()

with context as sct:
assert isinstance(sct, MSSBase)
assert isinstance(sct, MSS)


def test_documented_style_platform_import_mss() -> None:
mss_factory = _platform_factory_from_import_style()

with pytest.warns(DeprecationWarning, match=r"^mss\..*\.MSS is deprecated"):
context = mss_factory()

with context as sct:
assert isinstance(sct, MSSBase)


def test_direct_mss_constructor_has_no_deprecation_warning() -> None:
with warnings.catch_warnings(record=True) as captured:
warnings.simplefilter("always", DeprecationWarning)
Expand All @@ -110,11 +98,6 @@ def test_direct_mss_constructor_has_no_deprecation_warning() -> None:
assert not [warning for warning in captured if issubclass(warning.category, DeprecationWarning)]


def test_mssbase_alias_stays_compatible() -> None:
# 10.1-compatible typing/import path.
assert MSSBase is MSS


def test_platform_mss_constructor_works_on_current_platform() -> None:
mss_platform = _platform_module()

Expand All @@ -123,7 +106,6 @@ def test_platform_mss_constructor_works_on_current_platform() -> None:

with sct_context as sct:
assert isinstance(sct, mss_platform.MSS)
assert isinstance(sct, MSSBase)
assert isinstance(sct, MSS)


Expand All @@ -140,7 +122,6 @@ def test_factory_and_platform_constructor_are_compatible_types() -> None:
assert type(from_factory) is MSS
assert type(from_platform) is mss_platform.MSS
assert isinstance(from_platform, MSS)
assert isinstance(from_platform, MSSBase)


def test_deprecated_factory_accepts_documented_kwargs() -> None:
Expand All @@ -164,4 +145,4 @@ def test_deprecated_factory_accepts_documented_kwargs() -> None:
context = mss.mss(**kwargs)

with context as sct:
assert isinstance(sct, MSSBase)
assert isinstance(sct, MSS)
8 changes: 1 addition & 7 deletions src/tests/test_compat_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@


def test_top_level_export_surface_exists() -> None:
# TODO(jholveck): #493 Remove compatibility-only export checks after 10.x transition period.
assert hasattr(mss, "mss")
assert hasattr(mss, "mss") # TODO(jholveck): #517 Remove compatibility path once 10.x transition period ends.
assert hasattr(mss, "MSS")
assert hasattr(mss, "ScreenShotError")
assert hasattr(mss, "__version__")


def test_mssbase_compat_symbol_exists() -> None:
# TODO(jholveck): #493 Remove compatibility-only export checks after 10.x transition period.
assert hasattr(mss.base, "MSSBase")
30 changes: 0 additions & 30 deletions src/tests/test_compat_linux_api.py

This file was deleted.

1 change: 0 additions & 1 deletion src/tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def test_sdist() -> None:
f"mss-{__version__}/src/tests/test_cls_image.py",
f"mss-{__version__}/src/tests/test_compat_10_1.py",
f"mss-{__version__}/src/tests/test_compat_exports.py",
f"mss-{__version__}/src/tests/test_compat_linux_api.py",
f"mss-{__version__}/src/tests/test_find_monitors.py",
f"mss-{__version__}/src/tests/test_get_pixels.py",
f"mss-{__version__}/src/tests/test_gnu_linux.py",
Expand Down