Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Bump aiohttp from 3.7.4.post0 to 3.8.1 #221

Merged
merged 5 commits into from
Jan 3, 2022
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
6 changes: 3 additions & 3 deletions .github/workflows/s2i-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:

- name: Install requirements
run: |
wget https://github.com/openshift/source-to-image/releases/download/v1.2.0/source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz
tar -xvf source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz
wget https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz
tar -xvf source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz
sudo cp s2i /usr/local/bin
- name: Build image
run: |
s2i build . centos/python-36-centos7 cscfi/beacon-python
s2i build . centos/python-38-centos7 cscfi/beacon-python
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
FROM python:3.8-alpine3.13 as BUILD
FROM python:3.8-alpine3.15 as BUILD

RUN apk add --update \
&& apk add --no-cache build-base curl-dev linux-headers bash git musl-dev\
&& apk add --no-cache libressl-dev libffi-dev autoconf bzip2-dev xz-dev\
&& apk add --no-cache openssl-dev libffi-dev autoconf bzip2-dev xz-dev\
&& apk add --no-cache python3-dev rust cargo \
&& rm -rf /var/cache/apk/*

COPY requirements.txt /root/beacon/requirements.txt
COPY setup.py /root/beacon/setup.py
COPY beacon_api /root/beacon/beacon_api

ENV CYTHONIZE=1

RUN pip install --upgrade pip && \
pip install -r /root/beacon/requirements.txt && \
pip install /root/beacon
pip install Cython==0.29.26 && \
pip install -r /root/beacon/requirements.txt

COPY setup.py /root/beacon/setup.py
COPY beacon_api /root/beacon/beacon_api
RUN pip install /root/beacon

FROM python:3.8-alpine3.13
FROM python:3.8-alpine3.15

RUN apk add --no-cache --update bash

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Documentation: https://beacon-python.readthedocs.io
### Quick start

`beacon-python` Web Server requires:
* Python 3.6+;
* running DB [PostgreSQL Server](https://www.postgresql.org/) 9.6+ (recommended 11.6).
* Python 3.8+;
* running DB [PostgreSQL Server](https://www.postgresql.org/) 9.6+ (recommended 13).

```shell
git clone https://github.com/CSCfi/beacon-python
Expand All @@ -30,7 +30,7 @@ docker run -e POSTGRES_USER=beacon \
-e POSTGRES_PASSWORD=beacon \
-v "$PWD/data":/docker-entrypoint-initdb.d \
-e POSTGRES_DB=beacondb \
-p 5432:5432 postgres:11.6
-p 5432:5432 postgres:13
```

#### Run beacon-python
Expand Down
18 changes: 12 additions & 6 deletions beacon_api/api/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ def process_exception_data(request: Dict, host: str, error_code: int, error: str
# include datasetIds only if they are specified
# as per specification if they don't exist all datatsets will be queried
# Only one of `alternateBases` or `variantType` is required, validated by schema
oneof_fields = ["alternateBases", "variantType", "start", "end", "startMin", "startMax", "endMin", "endMax", "datasetIds"]
oneof_fields = [
"alternateBases",
"variantType",
"start",
"end",
"startMin",
"startMax",
"endMin",
"endMax",
"datasetIds",
]
data["alleleRequest"].update({k: request.get(k) for k in oneof_fields if k in request})

return data
Expand Down Expand Up @@ -65,11 +75,7 @@ class BeaconUnauthorised(web.HTTPUnauthorized):
def __init__(self, request: Dict, host: str, error: str, error_message: str) -> None:
"""Return custom unauthorized exception."""
data = process_exception_data(request, host, 401, error)
headers_401 = {
"WWW-Authenticate": f'Bearer realm="{CONFIG_INFO.url}"\n\
error="{error}"\n\
error_description="{error_message}"'
}
headers_401 = {"WWW-Authenticate": f"""Bearer realm=\"{CONFIG_INFO.url}\",error=\"{error},\" error_description=\"{error_message}\""""}
super().__init__(
content_type="application/json",
text=ujson.dumps(data, escape_forward_slashes=False),
Expand Down
12 changes: 9 additions & 3 deletions beacon_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,17 @@ def main():
# sslcontext.load_cert_chain(ssl_certfile, ssl_keyfile)
# sslcontext = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
# sslcontext.check_hostname = False
web.run_app(init(), host=os.environ.get("HOST", "0.0.0.0"), port=os.environ.get("PORT", "5050"), shutdown_timeout=0, ssl_context=None) # nosec # nosec
web.run_app(
init(),
host=os.environ.get("HOST", "0.0.0.0"), # nosec
port=os.environ.get("PORT", "5050"),
shutdown_timeout=0,
ssl_context=None,
)


if __name__ == "__main__":
if sys.version_info < (3, 6):
LOG.error("beacon-python requires python 3.6")
if sys.version_info < (3, 8):
LOG.error("beacon-python requires python 3.8")
sys.exit(1)
main()
4 changes: 2 additions & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.2'
services:
postgres:
hostname: postgres
image: postgres:11.6
image: postgres:13
environment:
POSTGRES_USER: beacon
POSTGRES_DB: beacondb
Expand All @@ -20,7 +20,7 @@ services:
environment:
DATABASE_URL: postgres
links:
- postgres:postgres
- postgres:postgres
ports:
- 5050:5050
restart: on-failure
4 changes: 2 additions & 2 deletions deploy/test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.2'
services:
postgres:
hostname: postgres
image: postgres:11.6
image: postgres:13
environment:
POSTGRES_USER: beacon
POSTGRES_DB: beacondb
Expand Down Expand Up @@ -42,4 +42,4 @@ services:
- 8000:8000
volumes:
- ./mock_auth.py:/mock_auth.py
entrypoint: ["python", "/mock_auth.py", "0.0.0.0", "8000"]
entrypoint: [ "python", "/mock_auth.py", "0.0.0.0", "8000" ]
2 changes: 1 addition & 1 deletion docs/db.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Database
========

We use a PostgreSQL database (recommended version 11.6) for working with beacon data.
We use a PostgreSQL database (recommended version 13) for working with beacon data.
For more information on setting up the database consult :ref:`database-setup`.

.. attention:: We recommend https://pgtune.leopard.in.ua/ for establishing PostgreSQL
Expand Down
6 changes: 3 additions & 3 deletions docs/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Instructions

.. note:: In order to run ``beacon-python`` Web Server requirements are as specified below:

* Python 3.6+;
* running DB `PostgreSQL Server <https://www.postgresql.org/>`_ 9.6+ (recommended 11.6).
* Python 3.8+;
* running DB `PostgreSQL Server <https://www.postgresql.org/>`_ 9.6+ (recommended 13).

.. _env-setup:

Expand Down Expand Up @@ -165,7 +165,7 @@ Starting PostgreSQL using Docker:
-e POSTGRES_PASSWORD=beacon \
-e POSTGRES_DB=beacondb \
-v "$PWD/data":/docker-entrypoint-initdb.d \
-p 5432:5432 postgres:11.6
-p 5432:5432 postgres:13

.. hint:: If one has their own database the ``beacon_init`` utility can be skipped,
and make use of their own database by:
Expand Down
15 changes: 5 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
aiohttp==3.7.4.post0
aiohttp==3.8.1
aiohttp-cors==0.7.0
asyncpg==0.25.0
jsonschema==3.2.0; python_version < '3.7'
jsonschema==4.3.2; python_version >= '3.7'
jsonschema==4.3.2
Cython==0.29.26
cyvcf2==0.10.1; python_version < '3.7'
cyvcf2; python_version >= '3.7'
uvloop==0.14.0; python_version < '3.7'
uvloop==0.16.0; python_version >= '3.7'
cyvcf2==0.30.14
uvloop==0.16.0
aiocache==0.11.1
ujson==4.3.0; python_version < '3.7'
ujson==5.1.0; python_version >= '3.7'
aiomcache==0.6.0
ujson==5.1.0
Authlib==0.15.5
gunicorn==20.1.0
21 changes: 7 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,25 @@
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
install_requires=[
"asyncpg==0.25.0",
"aiohttp==3.7.4.post0",
"aiohttp==3.8.1",
"Authlib==0.15.5",
"aiohttp-cors==0.7.0",
"jsonschema==3.2.0; python_version < '3.7'",
"jsonschema==4.3.2; python_version >= '3.7'",
"jsonschema==4.3.2",
"gunicorn==20.1.0",
"uvloop==0.14.0; python_version < '3.7'",
"uvloop==0.16.0; python_version >= '3.7'",
"cyvcf2==0.10.1; python_version < '3.7'",
"cyvcf2; python_version >= '3.7'",
"uvloop==0.16.0",
"cyvcf2==0.30.14",
"aiocache==0.11.1",
"aiomcache==0.6.0",
"ujson==4.3.0; python_version < '3.7'",
"ujson==5.1.0; python_version >= '3.7'",
"ujson==5.1.0",
],
extras_require={
"vcf": [
"cyvcf2==0.10.1; python_version < '3.7'",
"numpy==1.21.5",
"cyvcf2; python_version >= '3.7'",
"cyvcf2==0.30.14",
"Cython==0.29.26",
],
"test": [
Expand All @@ -68,7 +62,6 @@
"tox==3.24.4",
"flake8==4.0.1",
"flake8-docstrings==1.6.0",
"asynctest==0.13.0",
"aioresponses==0.7.2",
"black==21.12b0",
],
Expand Down
Loading