From 1ea1c4d25c1925114df86652f3aa68b6ae731a26 Mon Sep 17 00:00:00 2001
From: Christian Paul <christian@chrpaul.de>
Date: Tue, 16 Nov 2021 15:29:48 +0100
Subject: [PATCH 1/6] use mautrix-python@master

---
 Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 54ce8840..5822a472 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -60,7 +60,7 @@ RUN apk add --virtual .build-deps \
 
 COPY . /opt/mautrix-telegram
 RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
-  && pip3 install 'git+https://github.com/vector-im/mautrix-python@bump-conn-pool-limit#egg=mautrix' \
+  && pip3 install 'git+https://github.com/vector-im/mautrix-python@master#egg=mautrix' \
   && apk del git \
   && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram
 

From 3852f96ac33e4798a3f031bc72d2f2392f53bcf5 Mon Sep 17 00:00:00 2001
From: Christian Paul <christian@chrpaul.de>
Date: Wed, 17 Nov 2021 15:38:41 +0100
Subject: [PATCH 2/6] Pin a specific tag

---
 Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 5822a472..85d9e335 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -60,7 +60,7 @@ RUN apk add --virtual .build-deps \
 
 COPY . /opt/mautrix-telegram
 RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
-  && pip3 install 'git+https://github.com/vector-im/mautrix-python@master#egg=mautrix' \
+  && pip3 install 'git+https://github.com/vector-im/mautrix-python@v0.11.4-mod1#egg=mautrix' \
   && apk del git \
   && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram
 

From ee5a238d1d52451bbe52edad7012b51b82b06819 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= <tadeusz@sosnierz.com>
Date: Wed, 17 Nov 2021 16:03:15 +0100
Subject: [PATCH 3/6] Fix docker build

---
 Dockerfile |  8 +++-----
 setup.py   | 14 --------------
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 85d9e335..54d08255 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -47,22 +47,20 @@ RUN apk add --no-cache \
       yq
 
 COPY requirements.txt /opt/mautrix-telegram/requirements.txt
-COPY optional-requirements.txt /opt/mautrix-telegram/optional-requirements.txt
 WORKDIR /opt/mautrix-telegram
 RUN apk add --virtual .build-deps \
       python3-dev \
       libffi-dev \
       build-base \
- && sed -Ei 's/psycopg2-binary.+//' optional-requirements.txt \
  # TODO: unpin Pillow here after it's updated in Alpine
- && pip3 install -r requirements.txt -r optional-requirements.txt 'pillow==8.2' \
- && apk del .build-deps
+ && pip3 install -r requirements.txt 'pillow==8.2'
 
 COPY . /opt/mautrix-telegram
 RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
   && pip3 install 'git+https://github.com/vector-im/mautrix-python@v0.11.4-mod1#egg=mautrix' \
   && apk del git \
-  && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram
+  && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram \
+  && apk del .build-deps
 
 VOLUME /data
 ENV UID=1337 GID=1337 \
diff --git a/setup.py b/setup.py
index 8e7ad527..6ae7a345 100644
--- a/setup.py
+++ b/setup.py
@@ -6,19 +6,6 @@
 with open("requirements.txt") as reqs:
     install_requires = reqs.read().splitlines()
 
-with open("optional-requirements.txt") as reqs:
-    extras_require = {}
-    current = []
-    for line in reqs.read().splitlines():
-        if line.startswith("#/"):
-            extras_require[line[2:]] = current = []
-        elif not line or line.startswith("#"):
-            continue
-        else:
-            current.append(line)
-
-extras_require["all"] = list({dep for deps in extras_require.values() for dep in deps})
-
 try:
     long_desc = open("README.md").read()
 except IOError:
@@ -48,7 +35,6 @@
     packages=setuptools.find_packages(),
 
     install_requires=install_requires + ['psycopg2', 'uvloop'],
-    extras_require=extras_require,
     python_requires="~=3.7",
 
     setup_requires=["pytest-runner"],

From 3ad4f5b14825e17460b57f40ddbf24942724b253 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= <tadeusz@sosnierz.com>
Date: Wed, 17 Nov 2021 16:20:19 +0100
Subject: [PATCH 4/6] Make the image small(er) again

---
 Dockerfile | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 54d08255..d7dd7ffd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -48,19 +48,17 @@ RUN apk add --no-cache \
 
 COPY requirements.txt /opt/mautrix-telegram/requirements.txt
 WORKDIR /opt/mautrix-telegram
-RUN apk add --virtual .build-deps \
-      python3-dev \
-      libffi-dev \
-      build-base \
- # TODO: unpin Pillow here after it's updated in Alpine
- && pip3 install -r requirements.txt 'pillow==8.2'
 
 COPY . /opt/mautrix-telegram
-RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
+RUN apk add git \
+  && apk add --virtual .build-deps python3-dev libffi-dev build-base \
+  && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
+  # TODO: unpin Pillow here after it's updated in Alpine
+  && pip3 install -r requirements.txt 'pillow==8.2' \
   && pip3 install 'git+https://github.com/vector-im/mautrix-python@v0.11.4-mod1#egg=mautrix' \
   && apk del git \
-  && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram \
-  && apk del .build-deps
+  && apk del .build-deps \
+  && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram
 
 VOLUME /data
 ENV UID=1337 GID=1337 \

From 9cdb15c2d818d61a0c1413012b77992168e45752 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= <tadeusz@sosnierz.com>
Date: Wed, 17 Nov 2021 18:02:29 +0100
Subject: [PATCH 5/6] Switch to -mod-2

---
 Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index d7dd7ffd..bdf6f24c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -55,7 +55,7 @@ RUN apk add git \
   && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
   # TODO: unpin Pillow here after it's updated in Alpine
   && pip3 install -r requirements.txt 'pillow==8.2' \
-  && pip3 install 'git+https://github.com/vector-im/mautrix-python@v0.11.4-mod1#egg=mautrix' \
+  && pip3 install 'git+https://github.com/vector-im/mautrix-python@v0.11.4-mod-2#egg=mautrix' \
   && apk del git \
   && apk del .build-deps \
   && cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram

From fffa42882c7c4b6d3947b80390c86ed6d85b5bdd Mon Sep 17 00:00:00 2001
From: Christian Paul <christian@chrpaul.de>
Date: Thu, 18 Nov 2021 14:26:25 +0100
Subject: [PATCH 6/6] Update README.md

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 9ac48273..3e774317 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@ The Element fork includes the following changes:
  - Make max_initial_member_sync work for Chats as well as Channels https://github.com/mautrix/telegram/pull/680
  - Allow disabling user status updates from Telegram side https://github.com/vector-im/mautrix-telegram/pull/9
  - Add `psycopg2`, `uvloop` to requirements.txt, install_requires https://github.com/vector-im/mautrix-telegram/pull/10/files
+ - Add metrics about Matrix API calls https://github.com/mautrix/python/pull/68
 
 Some changes that appear here may get upstreamed to https://github.com/mautrix/telegram, and will be removed from
 the list when they appear in both versions.