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
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false # Allows for matrix sub-jobs to fail without cancelling the rest
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.13"]
python-version: ["3.10", "3.13"]

steps:
- name: Checkout repository
Expand All @@ -35,7 +35,7 @@ jobs:

# This job is used purely to provide a workflow status, which we can mark as a
# required action in branch protection rules. This is a better option than marking
# the tox-test jobs manually, since their names cnange as the supported python
# the tox-test jobs manually, since their names change as the supported python
# versions change. This job provides an easy single action that can be marked required.
tests-done:
needs: [unit-tests]
Expand Down
7 changes: 2 additions & 5 deletions mcstatus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
import argparse
import socket
import dataclasses
from typing import TYPE_CHECKING
from typing import TypeAlias

from mcstatus import JavaServer, BedrockServer
from mcstatus.responses import JavaStatusResponse
from mcstatus.motd import Motd

if TYPE_CHECKING:
from typing_extensions import TypeAlias

SupportedServers: TypeAlias = "JavaServer | BedrockServer"
SupportedServers: TypeAlias = "JavaServer | BedrockServer"

PING_PACKET_FAIL_WARNING = (
"warning: contacting {address} failed with a 'ping' packet but succeeded with a 'status' packet,\n"
Expand Down
4 changes: 2 additions & 2 deletions mcstatus/motd/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum

if t.TYPE_CHECKING:
from typing_extensions import Self, TypeAlias
from typing_extensions import Self


class Formatting(Enum):
Expand Down Expand Up @@ -123,4 +123,4 @@ class TranslationTag:
id: str


ParsedMotdComponent: TypeAlias = "Formatting | MinecraftColor | WebColor | TranslationTag | str"
ParsedMotdComponent: t.TypeAlias = "Formatting | MinecraftColor | WebColor | TranslationTag | str"
4 changes: 2 additions & 2 deletions mcstatus/protocol/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
from ctypes import c_uint32 as unsigned_int32
from ctypes import c_uint64 as unsigned_int64
from ipaddress import ip_address
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, cast, TypeAlias

import asyncio_dgram

from mcstatus.address import Address

if TYPE_CHECKING:
from typing_extensions import Self, SupportsIndex, TypeAlias
from typing_extensions import Self, SupportsIndex

BytesConvertable: TypeAlias = "SupportsIndex | Iterable[SupportsIndex]"

Expand Down
4 changes: 2 additions & 2 deletions mcstatus/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass
from typing import Any, Literal, TYPE_CHECKING
from typing import Any, Literal, TYPE_CHECKING, TypeAlias

from mcstatus.forge_data import ForgeData, RawForgeData
from mcstatus.motd import Motd

if TYPE_CHECKING:
from typing_extensions import NotRequired, Self, TypeAlias, TypedDict
from typing_extensions import NotRequired, Self, TypedDict

class RawJavaResponsePlayer(TypedDict):
name: str
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -33,7 +32,7 @@ classifiers = [
"Typing :: Typed",
]
keywords = ["minecraft", "protocol"]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = ["asyncio-dgram>=2.1.2", "dnspython>=2.4.2"]

[project.urls]
Expand Down Expand Up @@ -117,14 +116,14 @@ asyncio_default_fixture_loop_scope = "function"

[tool.pyright]
pythonPlatform = "All"
pythonVersion = "3.9"
pythonVersion = "3.10"
typeCheckingMode = "standard"

disableBytesTypePromotions = false
extend_exclude = ["docs/conf.py"]

[tool.ruff]
target-version = "py39"
target-version = "py310"
line-length = 127

[tool.ruff.lint]
Expand Down
21 changes: 11 additions & 10 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ def patch_stdout_stderr():

@pytest.fixture
def mock_network_requests():
with \
patch("mcstatus.server.JavaServer.lookup", return_value=JavaServer("example.com", port=25565)), \
patch("mcstatus.server.JavaServer.ping", return_value=0), \
patch("mcstatus.server.JavaServer.status", return_value=JavaStatusResponse.build(JAVA_RAW_RESPONSE)), \
patch("mcstatus.server.JavaServer.query", return_value=QueryResponse.build(*QUERY_RAW_RESPONSE)), \
patch("mcstatus.server.BedrockServer.lookup", return_value=BedrockServer("example.com", port=25565)), \
patch("mcstatus.server.BedrockServer.status", return_value=(
BedrockStatusResponse.build(BEDROCK_RAW_RESPONSE, latency=123)
)
): # fmt: skip # multiline with was added in Python 3.10
with (
patch("mcstatus.server.JavaServer.lookup", return_value=JavaServer("example.com", port=25565)),
patch("mcstatus.server.JavaServer.ping", return_value=0),
patch("mcstatus.server.JavaServer.status", return_value=JavaStatusResponse.build(JAVA_RAW_RESPONSE)),
patch("mcstatus.server.JavaServer.query", return_value=QueryResponse.build(*QUERY_RAW_RESPONSE)),
patch("mcstatus.server.BedrockServer.lookup", return_value=BedrockServer("example.com", port=25565)),
patch(
"mcstatus.server.BedrockServer.status",
return_value=(BedrockStatusResponse.build(BEDROCK_RAW_RESPONSE, latency=123)),
),
):
yield


Expand Down
Loading