diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index b7e1289e..85cadf69 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -44,10 +44,27 @@ jobs: minor=$(python3 --version | cut -d. -f2) if [ "$minor" -ge 7 ]; then python -m pip install --upgrade "pip==24.0" --only-binary=:all: + python -m pip install . else + # Python 3.6 runs from a checkout (see README), not a pip install. + # Just install the runtime deps, pinned per pyproject.toml. python -m pip install --upgrade "pip==21.3.1" --only-binary=:all: + python -m pip install \ + "channelfinder @ https://github.com/ChannelFinder/pyCFClient/archive/refs/tags/v3.2.0.zip#sha256=ec89537f336c4cb8db18909c4b02176dd5fbd03f5872a6527129879cbf3f7c85" \ + "dataclasses==0.8" \ + "requests==2.27.1" \ + "twisted==21.7.0" + fi + - name: Import smoke test + run: | + minor=$(python3 --version | cut -d. -f2) + if [ "$minor" -lt 7 ]; then + # Intentional for 3.6: run from the checkout, as documented. + PYTHONPATH=. python -c "from twisted.plugins import recceiver_plugin" + else + # Run outside the checkout so this fails if pip didn't install it. + cd /tmp && python -c "from twisted.plugins import recceiver_plugin" fi - python -m pip install --no-deps . test-unit: runs-on: ubuntu-latest needs: build-server diff --git a/server/pyproject.toml b/server/pyproject.toml index f13f8168..6d19a201 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -30,10 +30,10 @@ dependencies = [ "channelfinder @ https://github.com/ChannelFinder/pyCFClient/archive/refs/tags/v3.2.0.zip", "dataclasses; python_version<'3.7'", "requests>=2.27.1,<2.28; python_version<'3.7'", - "requests>=2.31,<2.32; python_version<'3.8'", + "requests>=2.31,<2.32; python_version>='3.7' and python_version<'3.8'", "requests>=2.32.3,<2.33; python_version>='3.8'", "twisted>=21.7,<22; python_version<'3.7'", - "twisted>=22.10,<23; python_version<'3.8'", + "twisted>=22.10,<23; python_version>='3.7' and python_version<'3.8'", "twisted>=24.11,<24.12; python_version>='3.8'", ] optional-dependencies.metrics = [ "prometheus-client" ] diff --git a/server/recceiver/processors.py b/server/recceiver/processors.py index d1c32a3e..0dd06794 100644 --- a/server/recceiver/processors.py +++ b/server/recceiver/processors.py @@ -5,6 +5,7 @@ import os from configparser import ConfigParser as Parser from os.path import expanduser +from typing import Dict from twisted.application import service from twisted.internet import defer, task @@ -22,9 +23,9 @@ ] -def _env_vars(section: str) -> dict[str, str]: +def _env_vars(section: str) -> Dict[str, str]: prefix = "RECCEIVER_" + section.upper() + "_" - return {k.removeprefix(prefix).lower(): v for k, v in os.environ.items() if k.startswith(prefix)} + return {k[len(prefix) :].lower(): v for k, v in os.environ.items() if k.startswith(prefix)} class ConfigAdapter(object): diff --git a/server/recceiver/recast.py b/server/recceiver/recast.py index be4af974..ef39fd81 100644 --- a/server/recceiver/recast.py +++ b/server/recceiver/recast.py @@ -4,6 +4,7 @@ import logging import random import time +from typing import DefaultDict, Dict, List, Set, Tuple from twisted.internet import defer, protocol from twisted.internet.interfaces import IAddress @@ -212,11 +213,11 @@ class Transaction: connected: bool initial: bool srcid: int - records_to_add: dict[int, tuple[str, str]] - client_infos: dict[str, str] - record_infos_to_add: dict[int, dict[str, str]] - aliases: collections.defaultdict[int, list[str]] - records_to_delete: set[int] + records_to_add: Dict[int, Tuple[str, str]] + client_infos: Dict[str, str] + record_infos_to_add: Dict[int, Dict[str, str]] + aliases: DefaultDict[int, List[str]] + records_to_delete: Set[int] def __init__(self, ep: IAddress, id: int) -> None: self.connected = True