diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 951a9af..a3d214d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,26 +8,26 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run tests with pytest - run: docker-compose run --rm tester + run: docker compose run --rm tester - name: Stop containers if: always() - run: docker-compose stop + run: docker compose stop lint: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.11 - name: Install requirements run: | diff --git a/.travis.yml b/.travis.yml index 4625095..fa143ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,14 @@ sudo: false language: python python: - - "3.5" - - "3.6" + # support debian 9, 10, 11 - "3.7" + - "3.9" + - "3.11" cache: pip: true install: - - docker-compose up + - docker compose up - pip install -Ur tests/requirements.txt script: - cd tests && pytest diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile index f2f338a..c85e266 100644 --- a/docker/backend/Dockerfile +++ b/docker/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:10 +FROM debian:bookworm # install dependencies RUN apt-get update -qq && \ @@ -10,7 +10,8 @@ RUN mkdir code WORKDIR /code COPY requirements.txt ./ -RUN pip3 install -Ur requirements.txt +# --break-system-packages to allow pip to install inside of the docker container +RUN pip3 install -Ur requirements.txt --break-system-packages # run app EXPOSE 5000 diff --git a/docker/tester/Dockerfile b/docker/tester/Dockerfile index 319e5fe..907c624 100644 --- a/docker/tester/Dockerfile +++ b/docker/tester/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-20210408-slim +FROM debian:bookworm # install dependencies RUN apt-get update -qq && \ @@ -16,11 +16,12 @@ RUN apt-get update -qq && \ # build app RUN mkdir code WORKDIR /code - COPY requirements.txt /requirements.txt COPY tests/requirements.txt /requirements.tests.txt -RUN pip3 -q install -Ur /requirements.txt -RUN pip3 -q install -Ur /requirements.tests.txt + +# --break-system-packages to allow pip to install inside of the docker container +RUN pip3 -q install -Ur /requirements.txt --break-system-packages +RUN pip3 -q install -Ur /requirements.tests.txt --break-system-packages # run app ENTRYPOINT ["pytest"] diff --git a/high_templar/authentication.py b/high_templar/authentication.py index de7bf98..4c2b42e 100644 --- a/high_templar/authentication.py +++ b/high_templar/authentication.py @@ -14,13 +14,9 @@ class Permission(frozendict): Make a comparable object from permission """ - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.key_set = set(self.keys()) - def __lt__(self, other: 'Permission'): # If the keys are not the same, we can not compare then - if self.key_set != other.key_set: + if set(self.keys()) != set(other.keys()): return False has_diff = False diff --git a/high_templar/backend_adapter/binder.py b/high_templar/backend_adapter/binder.py index c03e9ac..f0b0b42 100644 --- a/high_templar/backend_adapter/binder.py +++ b/high_templar/backend_adapter/binder.py @@ -25,7 +25,6 @@ def __init__(self, app): self.base_url = app.config['API_URL'] self.forward_ip = app.config.get('FORWARD_IP') self.header_definition = {**DEFAULT_HEADERS, **app.config.get('CONNECTION_HEADERS', {})} - self.headers = {} async def get_authentication(self, websocket) -> Authentication: diff --git a/requirements.txt b/requirements.txt index 37c137c..160f5eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ -python-dotenv>= 0.6.3 -aio-pika==6.4.1 -hypercorn== 0.9.0 +python-dotenv==0.21.1 +aio-pika==9.3.1 +hypercorn==0.14.3 quart== 0.11.2 -aiohttp_requests==0.1.2 -frozendict==1.2 +frozendict==2.4.6 +aiohttp==3.11.10 +Jinja2==3.0.3 +werkzeug==2.1.2 diff --git a/run b/run index 3f44ddb..9e8e14d 100755 --- a/run +++ b/run @@ -6,7 +6,7 @@ if [ "$1" = "--no-build" ] then echo "Skipping build" else - docker-compose build --parallel $SERVICES + docker compose build --parallel $SERVICES fi -docker-compose up "$@" $SERVICES +docker compose up "$@" $SERVICES diff --git a/setup.py b/setup.py index 14fb780..3ccda2a 100755 --- a/setup.py +++ b/setup.py @@ -27,22 +27,21 @@ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.11', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules' ], install_requires=[ - 'python-dotenv >= 0.6.3', - 'aio-pika==6.4.1', - 'hypercorn >= 0.9.0', + 'python-dotenv == 0.21.1', + 'aio-pika == 9.3.1', + 'hypercorn == 0.14.3', 'quart == 0.11.2', - 'aiohttp >= 3.6.2', - 'aiohttp_requests>=0.1.2', - 'frozendict==1.2', + 'frozendict == 2.4.6', + 'aiohttp == 3.11.10', + 'Jinja2 == 3.0.3', + 'werkzeug == 2.1.2', ], test_suite='tests' ) diff --git a/test b/test index a1151af..740e45e 100755 --- a/test +++ b/test @@ -1,4 +1,4 @@ #!/bin/sh set -e -docker-compose run tester "$@" +docker compose run tester "$@" diff --git a/tests/requirements.txt b/tests/requirements.txt index 7ad10ae..71757bc 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,6 +1,6 @@ -websockets==9.1 -requests2==2.16.0 +websockets==13.1 +requests==2.32.2 wiremock==1.2.0 -pytest==6.1.1 -frozendict==1.2.0 -pika==1.2.0 +pytest==7.4.4 +frozendict==2.4.6 +pika==1.3.2