Skip to content

Commit 0dfc549

Browse files
authored
chore: Python 3.10 (#14360)
* Python 3.10 Performance gains go brrr * Add missing SAML deps * Add missing dep to dockerfile * Update mypy to 0.981 for 3.10.7 compatibility Needed this bug to be fixed: python/mypy#13627 This also incidentally fixed the mypy bug in csv_exporter.py * bump to 3.10.10
1 parent 7ae7ef6 commit 0dfc549

File tree

8 files changed

+23
-24
lines changed

8 files changed

+23
-24
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Set up Python
5555
uses: actions/setup-python@v4
5656
with:
57-
python-version: 3.9.16
57+
python-version: 3.10.10
5858
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
5959

6060
- uses: syphar/restore-virtualenv@v1

.github/workflows/ci-backend.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
- name: Set up Python
9999
uses: actions/setup-python@v4
100100
with:
101-
python-version: 3.9.16
101+
python-version: 3.10.10
102102
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
103103

104104
- uses: syphar/restore-virtualenv@v1
@@ -183,7 +183,7 @@ jobs:
183183
- name: Set up Python
184184
uses: actions/setup-python@v4
185185
with:
186-
python-version: 3.9.16
186+
python-version: 3.10.10
187187
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
188188

189189
- uses: syphar/restore-virtualenv@v1
@@ -235,7 +235,7 @@ jobs:
235235
strategy:
236236
fail-fast: false
237237
matrix:
238-
python-version: ['3.9.16']
238+
python-version: ['3.10.10']
239239
clickhouse-server-image: ['clickhouse/clickhouse-server:22.8']
240240
segment: ['FOSS', 'EE']
241241
person-on-events: [false, true]
@@ -329,7 +329,7 @@ jobs:
329329
- name: Set up Python
330330
uses: actions/setup-python@v4
331331
with:
332-
python-version: 3.9.16
332+
python-version: 3.10.10
333333
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
334334

335335
- uses: syphar/restore-virtualenv@v1
@@ -419,7 +419,7 @@ jobs:
419419
- name: Set up Python
420420
uses: actions/setup-python@v4
421421
with:
422-
python-version: 3.9.16
422+
python-version: 3.10.10
423423
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
424424

425425
- name: Install SAML (python3-saml) dependencies

.github/workflows/ci-plugin-server.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- name: Set up Python
100100
uses: actions/setup-python@v4
101101
with:
102-
python-version: 3.9.16
102+
python-version: 3.10.10
103103
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
104104

105105
- uses: syphar/restore-virtualenv@v1
@@ -186,7 +186,7 @@ jobs:
186186
- name: Set up Python
187187
uses: actions/setup-python@v4
188188
with:
189-
python-version: 3.9.16
189+
python-version: 3.10.10
190190
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
191191

192192
- uses: syphar/restore-virtualenv@v1
@@ -197,6 +197,12 @@ jobs:
197197
- uses: syphar/restore-pip-download-cache@v1
198198
if: steps.cache-backend-tests.outputs.cache-hit != 'true'
199199

200+
- name: Install SAML (python3-saml) dependencies
201+
run: |
202+
sudo apt-get update
203+
sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
204+
if: steps.cache-backend-tests.outputs.cache-hit != 'true'
205+
200206
- name: Install python dependencies
201207
if: steps.cache-backend-tests.outputs.cache-hit != 'true'
202208
run: |

posthog/tasks/exports/csv_exporter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def add_query_params(url: str, params: Dict[str, str]) -> str:
5959
for key, value in params.items():
6060
update_params.append((key, value))
6161

62-
# mypy bug ? https://github.com/python/typeshed/issues/4234
63-
encodedQueryParams = urlencode(update_params, quote_via=quote) # type: ignore
62+
encodedQueryParams = urlencode(update_params, quote_via=quote)
6463
parsed = parsed._replace(query=encodedQueryParams)
6564
return urlunparse(parsed)
6665

production.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ RUN corepack enable && \
7575
#
7676
# ---------------------------------------------------------
7777
#
78-
FROM python:3.9.16-slim-bullseye AS posthog-build
78+
FROM python:3.10.10-slim-bullseye AS posthog-build
7979
WORKDIR /code
8080
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
8181

@@ -90,6 +90,7 @@ RUN apt-get update && \
9090
"libpq-dev" \
9191
"libxmlsec1" \
9292
"libxmlsec1-dev" \
93+
"libffi-dev" \
9394
"pkg-config" \
9495
&& \
9596
rm -rf /var/lib/apt/lists/* && \
@@ -129,7 +130,7 @@ RUN apt-get update && \
129130
#
130131
# ---------------------------------------------------------
131132
#
132-
FROM python:3.9.16-slim-bullseye
133+
FROM python:3.10.10-slim-bullseye
133134
WORKDIR /code
134135
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
135136
ENV PYTHONUNBUFFERED 1

requirements-dev.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ flake8-import-order==0.18.1
1919
flake8-logging-format==0.7.5
2020
flake8-print==5.0.0
2121
pip-tools==6.6.2
22-
mypy==0.931
22+
mypy==0.981
2323
mypy-extensions==0.4.3
2424
datamodel-code-generator==0.16.1
2525
djangorestframework-stubs==1.4.0

requirements-dev.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.9
2+
# This file is autogenerated by pip-compile with python 3.10
33
# To update, run:
44
#
55
# pip-compile requirements-dev.in
@@ -123,9 +123,7 @@ idna==2.8
123123
# requests
124124
# urllib3
125125
importlib-resources==5.10.2
126-
# via
127-
# -c requirements.txt
128-
# openapi-spec-validator
126+
# via openapi-spec-validator
129127
inflect==5.6.2
130128
# via datamodel-code-generator
131129
iniconfig==1.1.1
@@ -154,7 +152,7 @@ markupsafe==1.1.1
154152
# via jinja2
155153
mccabe==0.7.0
156154
# via flake8
157-
mypy==0.931
155+
mypy==0.981
158156
# via
159157
# -r requirements-dev.in
160158
# django-stubs
@@ -327,7 +325,6 @@ types-requests==2.26.1
327325
typing-extensions==4.4.0
328326
# via
329327
# -c requirements.txt
330-
# black
331328
# django-stubs
332329
# djangorestframework-stubs
333330
# jsonschema-spec
@@ -353,10 +350,6 @@ wrapt==1.14.1
353350
# via
354351
# -c requirements.txt
355352
# deprecated
356-
zipp==3.1.0
357-
# via
358-
# -c requirements.txt
359-
# importlib-resources
360353

361354
# The following packages are considered to be unsafe in a requirements file:
362355
# pip

runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.9.16
1+
python-3.10.10

0 commit comments

Comments
 (0)