Skip to content

Commit

Permalink
chore: Python 3.10 (#14360)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
frankh committed Feb 24, 2023
1 parent 7ae7ef6 commit 0dfc549
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9.16']
python-version: ['3.10.10']
clickhouse-server-image: ['clickhouse/clickhouse-server:22.8']
segment: ['FOSS', 'EE']
person-on-events: [false, true]
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand Down Expand Up @@ -419,7 +419,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- name: Install SAML (python3-saml) dependencies
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/ci-plugin-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

- uses: syphar/restore-virtualenv@v1
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16
python-version: 3.10.10
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

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

- name: Install SAML (python3-saml) dependencies
run: |
sudo apt-get update
sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
if: steps.cache-backend-tests.outputs.cache-hit != 'true'

- name: Install python dependencies
if: steps.cache-backend-tests.outputs.cache-hit != 'true'
run: |
Expand Down
3 changes: 1 addition & 2 deletions posthog/tasks/exports/csv_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def add_query_params(url: str, params: Dict[str, str]) -> str:
for key, value in params.items():
update_params.append((key, value))

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

Expand Down
5 changes: 3 additions & 2 deletions production.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RUN corepack enable && \
#
# ---------------------------------------------------------
#
FROM python:3.9.16-slim-bullseye AS posthog-build
FROM python:3.10.10-slim-bullseye AS posthog-build
WORKDIR /code
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand All @@ -90,6 +90,7 @@ RUN apt-get update && \
"libpq-dev" \
"libxmlsec1" \
"libxmlsec1-dev" \
"libffi-dev" \
"pkg-config" \
&& \
rm -rf /var/lib/apt/lists/* && \
Expand Down Expand Up @@ -129,7 +130,7 @@ RUN apt-get update && \
#
# ---------------------------------------------------------
#
FROM python:3.9.16-slim-bullseye
FROM python:3.10.10-slim-bullseye
WORKDIR /code
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV PYTHONUNBUFFERED 1
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ flake8-import-order==0.18.1
flake8-logging-format==0.7.5
flake8-print==5.0.0
pip-tools==6.6.2
mypy==0.931
mypy==0.981
mypy-extensions==0.4.3
datamodel-code-generator==0.16.1
djangorestframework-stubs==1.4.0
Expand Down
13 changes: 3 additions & 10 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.9
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile requirements-dev.in
Expand Down Expand Up @@ -123,9 +123,7 @@ idna==2.8
# requests
# urllib3
importlib-resources==5.10.2
# via
# -c requirements.txt
# openapi-spec-validator
# via openapi-spec-validator
inflect==5.6.2
# via datamodel-code-generator
iniconfig==1.1.1
Expand Down Expand Up @@ -154,7 +152,7 @@ markupsafe==1.1.1
# via jinja2
mccabe==0.7.0
# via flake8
mypy==0.931
mypy==0.981
# via
# -r requirements-dev.in
# django-stubs
Expand Down Expand Up @@ -327,7 +325,6 @@ types-requests==2.26.1
typing-extensions==4.4.0
# via
# -c requirements.txt
# black
# django-stubs
# djangorestframework-stubs
# jsonschema-spec
Expand All @@ -353,10 +350,6 @@ wrapt==1.14.1
# via
# -c requirements.txt
# deprecated
zipp==3.1.0
# via
# -c requirements.txt
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.9.16
python-3.10.10

0 comments on commit 0dfc549

Please sign in to comment.