Skip to content

Commit fa5d184

Browse files
authored
Merge pull request #135 from ChannelFinder/set-default-python-version-lower
Set default python version 3.9 and fix strenum problem
2 parents 4ce38ae + 7536646 commit fa5d184

14 files changed

Lines changed: 55 additions & 52 deletions

.github/workflows/server.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,21 @@ jobs:
4747
runs-on: ubuntu-latest
4848
strategy:
4949
fail-fast: false
50-
matrix:
51-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] # testcontainers is not supported on <3.9
5250
needs: build-server
5351
defaults:
5452
run:
5553
working-directory: server
5654
steps:
5755
- uses: actions/checkout@v4
58-
- name: Set up Python ${{ matrix.python-version }}
56+
- name: Set up Python
5957
uses: actions/setup-python@v5
6058
with:
61-
python-version: ${{ matrix.python-version }}
59+
python-version: 3.9
6260
- name: Install dependencies
6361
run: |
6462
python -m pip install --upgrade pip
6563
python -m pip install '.[test]'
6664
python -m pip install .
6765
- name: Test with pytest
6866
run: |
69-
pytest
67+
pytest --log-cli-level=DEBUG

.pre-commit-config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ repos:
66
- id: trailing-whitespace
77
- repo: https://github.com/astral-sh/ruff-pre-commit
88
# Ruff version.
9-
rev: v0.9.0
9+
rev: v0.15.0
1010
hooks:
1111
# Run the linter.
12-
- id: ruff
12+
- id: ruff-check
1313
args: [ --fix ]
1414
# Run the formatter.
1515
- id: ruff-format
16+
- repo: https://github.com/tox-dev/pyproject-fmt
17+
rev: "v2.12.1"
18+
hooks:
19+
- id: pyproject-fmt
20+
1621
#- repo: https://github.com/pre-commit/mirrors-clang-format
1722
# rev: v15.0.7
1823
# hooks:

server/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11 AS build
1+
FROM python:3.9 AS build
22

33
WORKDIR /home/recceiver
44

@@ -8,7 +8,7 @@ RUN python -m venv venv
88

99
RUN venv/bin/python -m pip install ./server
1010

11-
FROM python:3.11-alpine
11+
FROM python:3.9-alpine
1212

1313
WORKDIR /home/recceiver
1414

server/docker/cf-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
networks:
77
- net-2-cf
88
ports:
9-
- "8080:8080"
9+
- "8080"
1010
depends_on:
1111
elasticsearch:
1212
condition: service_healthy

server/pyproject.toml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,50 @@
11
[build-system]
2-
requires = ["setuptools"]
32
build-backend = "setuptools.build_meta"
3+
requires = [ "setuptools" ]
44

55
[project]
6-
name="recceiver"
6+
name = "recceiver"
7+
version = "1.8dev"
8+
description = "recCeiver is a server component of the recsync protocol. It receives record updates from recsync clients (e.g., recCasters) and forwards them to a configurable backend such as ChannelFinder."
9+
readme = "README.md"
710
authors = [
8-
{name = "Michael Davidsaver", email = "mdavidsaver@gmail.com"},
11+
{ name = "Michael Davidsaver", email = "mdavidsaver@gmail.com" },
912
]
10-
description="resync server"
11-
version="1.5"
12-
readme = "README.md"
1313
requires-python = ">=3.6"
14+
classifiers = [
15+
"Programming Language :: Python :: 3 :: Only",
16+
"Programming Language :: Python :: 3.6",
17+
"Programming Language :: Python :: 3.7",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
25+
]
1426
dependencies = [
15-
"dataclasses; python_version < '3.7'",
16-
"requests",
17-
"twisted",
18-
"channelfinder @ https://github.com/ChannelFinder/pyCFClient/archive/refs/tags/v3.0.0.zip"
27+
"channelfinder @ https://github.com/ChannelFinder/pyCFClient/archive/refs/tags/v3.0.0.zip",
28+
"dataclasses; python_version<'3.7'",
29+
"requests",
30+
"twisted",
1931
]
2032

21-
[project.optional-dependencies]
22-
test = ["pytest", "testcontainers>=4"]
23-
24-
[project.urls]
25-
Repository="https://github.com/mdavidsaver/recsync"
33+
optional-dependencies.test = [ "pytest", "testcontainers>=4" ]
34+
urls.Repository = "https://github.com/ChannelFinder/recsync"
2635

2736
[tool.setuptools]
28-
packages = ["recceiver", "twisted.plugins"]
37+
packages = [ "recceiver", "twisted.plugins" ]
2938
include-package-data = true
3039

3140
[tool.setuptools.package-data]
32-
twisted = ["plugins/recceiver_plugin.py"]
33-
34-
[tool.pytest.ini_options]
35-
log_cli = true
36-
log_cli_level = "DEBUG"
41+
twisted = [ "plugins/recceiver_plugin.py" ]
3742

3843
[tool.ruff]
39-
line-length = 120
44+
target-version = "py39"
4045

41-
[tool.ruff.lint]
46+
line-length = 120
4247
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
4348
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
4449
# McCabe complexity (`C901`) by default.
45-
select = ["E", "F", "I"]
50+
lint.select = [ "E", "F", "I" ]

server/recceiver/application.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import logging
44
import random
55

6-
from zope.interface import implementer
7-
8-
from twisted import plugin
96
from twisted.application import service
107
from twisted.internet import defer, pollreactor
118
from twisted.internet.error import CannotListenError
129
from twisted.python import log, usage
10+
from zope.interface import implementer
11+
12+
from twisted import plugin
1313

1414
from .announce import Announcer
1515
from .processors import ProcessorController

server/recceiver/cfstore.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
from channelfinder import ChannelFinderClient
1313
from requests import ConnectionError, RequestException
14-
from zope.interface import implementer
15-
1614
from twisted.application import service
1715
from twisted.internet import defer
1816
from twisted.internet.defer import DeferredLock
1917
from twisted.internet.threads import deferToThread
18+
from zope.interface import implementer
2019

2120
from . import interfaces
2221
from .interfaces import CommitTransaction
@@ -31,7 +30,7 @@
3130
DEFAULT_QUERY_LIMIT = 10_000
3231

3332

34-
class PVStatus(enum.StrEnum):
33+
class PVStatus(str, enum.Enum):
3534
"""PV Status values."""
3635

3736
ACTIVE = "Active"
@@ -170,7 +169,7 @@ class RecordInfo:
170169
aliases: List[str] = field(default_factory=list)
171170

172171

173-
class CFPropertyName(enum.StrEnum):
172+
class CFPropertyName(str, enum.Enum):
174173
"""Standard property names used in Channelfinder."""
175174

176175
HOSTNAME = "hostName"

server/recceiver/dbstore.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
import itertools
44
import logging
55

6-
from zope.interface import implementer
7-
86
from twisted.application import service
97
from twisted.enterprise import adbapi as db
108
from twisted.internet import defer
9+
from zope.interface import implementer
1110

1211
from . import interfaces
1312

server/recceiver/interfaces.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
from dataclasses import dataclass
44
from typing import Dict, List, Set, Tuple
55

6-
from zope.interface import Attribute, Interface
7-
86
from twisted.application import service
7+
from zope.interface import Attribute, Interface
98

109

1110
class ITransaction(Interface):

server/recceiver/mock_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from requests import HTTPError
2-
32
from twisted.internet.address import IPv4Address
43

54

0 commit comments

Comments
 (0)