Skip to content

Commit

Permalink
fix(dev): psycopg2-binary 2.9.1 does not work with Django 2.2
Browse files Browse the repository at this point in the history
For the incompatibility issue with Django visit [this issue][incompatible],

In this PR, we're going to downgrade to the compatible 2.8.6 version (thus, matching
the Python 3.6 version), removing the need to install `postgresql` (this means partially
reverting #28607) and instead installing a wheel I built on my machine that I have stored
in GC storage.

Fixes #28958

[incompatible]: psycopg/psycopg2#1293
  • Loading branch information
armenzg committed Oct 6, 2021
1 parent 40e5102 commit d6b4c44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/development-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
# Xcode CLI & brew are already installed, thus, no need to call xcode-select install
continue-on-error: true
run: |
make prerequisites
brew bundle -q
- name: Setup Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ install-py-dev :
build-platform-assets \
direnv-help \
upgrade-pip \
prerequisites \
setup-git-config :
@SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@

Expand Down
4 changes: 1 addition & 3 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ Pillow==8.2.0; python_version == '3.6'
Pillow==8.3.1; python_version > '3.6'
progressbar2==3.32.0
python-rapidjson==1.4
psycopg2-binary==2.8.6; python_version == '3.6'
# For development only: This version removes needing to setting flags for Apple's M1 chipset
psycopg2-binary==2.9.1; python_version > '3.6'
psycopg2-binary==2.8.6
PyJWT==2.1.0
python-dateutil==2.8.1
python-memcached==1.59
Expand Down
16 changes: 6 additions & 10 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ install-py-dev() {
# This helps when getsentry calls into this script
cd "${HERE}/.." || exit
echo "--> Installing Sentry (for development)"
if query-apple-m1; then
# This installs pyscopg-binary2 since there's no arm64 wheel
# This saves having to install postgresql on the Developer's machine + using flags
# https://github.com/psycopg/psycopg2/issues/1286
pip install "https://storage.googleapis.com/python-arm64-wheels/psycopg2_binary-2.8.6-cp38-cp38-macosx_11_0_arm64.whl"
fi
# SENTRY_LIGHT_BUILD=1 disables webpacking during setup.py.
# Webpacked assets are only necessary for devserver (which does it lazily anyways)
# and acceptance tests, which webpack automatically if run.
Expand Down Expand Up @@ -256,16 +262,6 @@ reset-db() {
apply-migrations
}

prerequisites() {
brew update -q && brew bundle -q
if query-apple-m1; then
# psycopg2-binary does not have an arm64 wheel, thus, we need to build it locally
# by installing postgresql
# See details: https://github.com/psycopg/psycopg2/issues/1286
brew install postgresql
fi
}

direnv-help() {
cat >&2 <<EOF
If you're a Sentry employee and you're stuck or have questions, ask in #discuss-dev-tooling.
Expand Down

0 comments on commit d6b4c44

Please sign in to comment.