Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #3017

Merged
merged 11 commits into from
Oct 16, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENV PYTHONUNBUFFERED=1
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

RUN pipx install poetry==1.1.13 \
RUN pipx install poetry==1.6.1 \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
libjpeg-dev \
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
DJANGO_SETTINGS_MODULE=onlineweb4.settings
LOG_LEVEL=INFO

# make `npm run build:test && py.test` work
OW4_WEBPACK_LOADER_STATS_FILE = webpack-stats-test.json
# make `npm run build && py.test` work
OW4_WEBPACK_LOADER_STATS_FILE = webpack-stats.json

# To run stripe tests locally: copy these to .env in project root and fill them in.
# OW4_DJANGO_STRIPE_PUBLIC_KEY_ARRKOM
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ services:
# Update 'VARIANT' to pick a version of Python: 3, 3.10, 3.9, 3.8, 3.7, 3.6
# Append -bullseye or -buster to pin to an OS version.
# Use -bullseye variants on local arm64/Apple Silicon.
VARIANT: 3.9
VARIANT: 3.11
# Optional Node.js version to install
NODE_VERSION: "16"
NODE_VERSION: "18"
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.no-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ services:
# Update 'VARIANT' to pick a version of Python: 3, 3.10, 3.9, 3.8, 3.7, 3.6
# Append -bullseye or -buster to pin to an OS version.
# Use -bullseye variants on local arm64/Apple Silicon.
VARIANT: 3.9
VARIANT: 3.11
# Optional Node.js version to install
NODE_VERSION: "16"
NODE_VERSION: "18"
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ onlineweb4.egg-info
.pre-commit-config.yaml
webpack.test.config.js
.devcontainer
meta.json
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python
if: matrix.language == 'python'
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
if: matrix.language == 'python'
env:
POETRY_VIRTUALENVS_CREATE: false
run: |
pipx install poetry==1.1.13
pipx install poetry==1.6.1
poetry install
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.11

- name: Install Zappa
run: pip install zappa==0.54
run: pip install zappa==0.58

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devcontainer-with-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '.devcontainer/**/*'
- 'pyproject.toml'
- 'poetry.lock'
- 'yarn.lock'
- 'package-lock.json'
- 'package.json'

permissions:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
pull_request:

env:
POETRY_VERSION: "1.1.13"
NODE_VERSION: "16"
PYTHON_VERSION: "3.9"
POETRY_VERSION: "1.6.1"
NODE_VERSION: "18"
PYTHON_VERSION: "3.11"

jobs:
test-python:
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache: 'npm'

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v3
Expand All @@ -52,10 +52,10 @@ jobs:
run: poetry install --no-interaction --no-ansi

- name: Install node dependencies
run: yarn install --pure-lockfile
run: npm ci

- name: npm build
run: npm run build:prod
run: npm run build

- name: Python tests
env:
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache: 'npm'

- name: Install node dependencies
run: yarn install --pure-lockfile
run: npm ci

- name: JS linting
run: npm run lint-js
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ zappa_settings.py
requirements.txt
.env
.venv
meta.json
4 changes: 2 additions & 2 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM gitpod/workspace-full

RUN pyenv install 3.9.11
RUN pyenv install 3.11.5

RUN pyenv global 3.9.11
RUN pyenv global 3.11.5

RUN pip install poetry

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
default_language_version:
python: python3.9
python: python3.11
repos:
- repo: https://github.com/psf/black
rev: "22.3.0"
rev: "23.9.1"
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: "5.10.1"
rev: "5.12.0"
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: "4.0.1"
rev: "6.1.0"
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.11
3.11.5
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# This is only intended to build the application for deployment on AWS Lambda with Zappa
# it has limited usage locally

FROM node:16-alpine AS js-static
FROM node:18-alpine AS js-static

ENV APP_DIR=/srv/app
ENV NODE_ENV=production

WORKDIR $APP_DIR

COPY package.json yarn.lock $APP_DIR
COPY package.json package-lock.json $APP_DIR

RUN yarn install --frozen-lockfile
RUN npm ci

COPY assets ./assets
COPY *.config.js \
webpack.*.js ./
COPY esbuild.mjs ./

RUN npm run build:prod
RUN npm run build

FROM python:3.9 AS static-files
FROM python:3.11 AS static-files

ENV APP_DIR=/srv/app \
POETRY_VIRTUALENVS_CREATE=false \
Expand All @@ -26,7 +26,7 @@ ENV APP_DIR=/srv/app \

WORKDIR $APP_DIR

RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.13 python3 -
RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.6.1 python3 -

COPY pyproject.toml poetry.lock $APP_DIR

Expand All @@ -41,7 +41,7 @@ COPY --from=js-static $APP_DIR/bundles ./bundles

RUN ./manage.py collectstatic

FROM amazon/aws-lambda-python:3.9
FROM amazon/aws-lambda-python:3.11

LABEL maintainer="Dotkom <[email protected]>"
ENV POETRY_VIRTUALENVS_CREATE=false \
Expand All @@ -52,7 +52,7 @@ COPY pyproject.toml poetry.lock $FUNCTION_DIR

# Setup Python environment
RUN yum install -y git unzip \
&& curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.13 python3 - \
&& curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.6.1 python3 - \
# silent, show errors and location (aka follow redirect)
&& curl -sSL --output vault-lambda-extension.zip \
https://releases.hashicorp.com/vault-lambda-extension/0.6.0/vault-lambda-extension_0.6.0_linux_amd64.zip \
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You can build this image locally by adding `"docker-compose.build.yml"` to the e
#### Pre-built image without included dependencies

Useful if your development often involves changing dependencies in `poetry`, but requires that you manually run
`yarn install` and `poetry install`.
`npm ci` and `poetry install`.
You can use this method by adding `"docker-compose.no-deps.yml"` to the end of the
`dockerComposeFile`-array in [`devcontainer.json`](/.devcontainer/devcontainer.json).

Expand All @@ -80,7 +80,7 @@ You can also build the image locally instead of using our pre-built version by u

```shell
# in one terminal
yarn start
npm run build

# in another terminal
# only required first time
Expand All @@ -101,16 +101,16 @@ The following commands _should_ make `py.test` work out of the box, if they do n

```shell
# static files are required for tests to pass
# we use Node 16 and Yarn v1, see e.g. https://github.com/nvm-sh/nvm
# we use Node 18 and npm, see e.g. https://github.com/nvm-sh/nvm
# for help with managing multiple Node versions on your system
yarn install --frozen-lockfile
yarn build:test
npm ci
npm run build

# recommended for easier debugging
# saves the virtual environment and all packages to `.venv`
poetry config virtualenvs.in-project true

# if you do not have Python 3.9 installed, or Python3.10, you can use e.g. pyenv to manage them.
# if you do not have Python 3.11 installed, you can use e.g. pyenv to manage them.
poetry install

# use the virtual environment
Expand Down Expand Up @@ -147,9 +147,8 @@ pre-commit run --all-files
To run the tests you can call

```shell
# first run either this or build:prod
# most tests using Django templates require the `webpack-stats*.json` to exists
npm run build:test
# most tests using Django templates require the `webpack-stats.json` to exists
npm run build

py.test
```
Expand All @@ -161,7 +160,6 @@ up with `pre-commit`:

```shell
npm run lint
npm run test
```

#### Code Test Coverage
Expand Down
1 change: 0 additions & 1 deletion apps/approval/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def to_internal_value(self, data):


class MembershipApprovalSerializer(serializers.ModelSerializer):

field_of_study = ChoiceField(choices=FieldOfStudyType.choices)

class Meta:
Expand Down
1 change: 0 additions & 1 deletion apps/approval/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def perform_create(self, serializer):


class MembershipApprovalViewSet(ModelViewSet):

permission_classes = (IsAuthenticated,)
schema = AutoSchema(tags=["Membership Applications"])
serializer_class = MembershipApprovalSerializer
Expand Down
1 change: 0 additions & 1 deletion apps/approval/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
@login_required
@permission_required("approval.view_membershipapproval", return_403=True)
def index(request):

# Generic check to see if user has access to dashboard. (Is staff or superuser)
if not has_access(request):
raise PermissionDenied
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0002_auto_20150218_2217.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("approval", "0001_initial"),
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0003_auto_20151015_0016.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0002_auto_20150218_2217")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0004_auto_20160309_2133.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0003_auto_20151015_0016")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0005_auto_20160906_1703.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0004_auto_20160309_2133")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0006_auto_20170814_0402.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0008_alter_user_username_max_length"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0007_auto_20180404_1923.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0006_auto_20170814_0402")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0008_auto_20190506_1719.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0007_auto_20180404_1923")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0009_auto_20200229_1046.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("approval", "0008_auto_20190506_1719")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion apps/approval/migrations/0010_auto_20200321_1924.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [
("authentication", "0045_auto_20200222_1436"),
("approval", "0009_auto_20200229_1046"),
Expand Down
Loading
Loading