From 5012db2e07d789f4b3c7b516862a1d31eb07b853 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Thu, 12 Sep 2024 18:53:25 +0500 Subject: [PATCH] chore: workflow cleanup --- .ci/docker-compose-ci.yml | 57 ---- .ci/docker.mk | 20 -- .ci/run_check_keywords.sh | 7 - .ci/run_pii_checker.sh | 8 - .ci/run_tests.sh | 7 - .dockerignore | 1 - .github/workflows/ci.yml | 84 +++--- .github/workflows/migrations-mysql8-check.yml | 113 +++----- .github/workflows/push-docker-image.yml | 57 ---- .github/workflows/trivy-code-scanning.yml | 18 +- Dockerfile | 91 ------ Makefile | 24 +- README.rst | 6 +- catalog-info.yaml | 1 - pylintrc | 7 +- requirements/base.txt | 41 ++- requirements/common_constraints.txt | 36 --- requirements/constraints.txt | 15 +- requirements/production.txt | 0 requirements/quality.in | 3 + requirements/quality.txt | 265 ++++++++++++++++++ requirements/test.txt | 86 +++--- tox.ini | 37 ++- 23 files changed, 479 insertions(+), 505 deletions(-) delete mode 100644 .ci/docker-compose-ci.yml delete mode 100644 .ci/docker.mk delete mode 100755 .ci/run_check_keywords.sh delete mode 100755 .ci/run_pii_checker.sh delete mode 100755 .ci/run_tests.sh delete mode 100644 .dockerignore delete mode 100644 .github/workflows/push-docker-image.yml delete mode 100644 Dockerfile delete mode 100644 requirements/common_constraints.txt delete mode 100644 requirements/production.txt create mode 100644 requirements/quality.txt diff --git a/.ci/docker-compose-ci.yml b/.ci/docker-compose-ci.yml deleted file mode 100644 index 2a043599..00000000 --- a/.ci/docker-compose-ci.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: "2" - -services: - mysql80: - image: mysql:8.0 - container_name: mysql80 - command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci - environment: - MYSQL_ROOT_PASSWORD: "" - MYSQL_ALLOW_EMPTY_PASSWORD: "yes" - MYSQL_USER: "notes001" - MYSQL_PASSWORD: "secret" - MYSQL_DATABASE: "edx_notes_api" - es: - image: elasticsearch:7.8.0 - container_name: es - environment: - - discovery.type=single-node - - bootstrap.memory_lock=true - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - - http.port=9200 - ulimits: - memlock: - soft: -1 - hard: -1 - volumes: - - elasticsearch_data:/usr/share/elasticsearch/data - ports: - - "9200:9200" - notes: - # Uncomment this line to use the official course-discovery base image - image: openedx/edx-notes-api:latest - - # Uncomment the next two lines to build from a local configuration repo - # build: ../configuration/docker/build/discovery/ - - container_name: edx_notes_api - volumes: - - ..:/edx/app/edx_notes_api/edx_notes_api - command: tail -f /dev/null - depends_on: - - "mysql80" - - "es" - environment: - CONN_MAX_AGE: 60 - DB_ENGINE: "django.db.backends.mysql" - DB_HOST: "db" - DB_NAME: "edx_notes_api" - DB_PASSWORD: "" - DB_PORT: "3306" - DB_USER: "root" - ENABLE_DJANGO_TOOLBAR: 1 - ELASTICSEARCH_URL: "http://es:9200" - -volumes: - elasticsearch_data: - driver: local diff --git a/.ci/docker.mk b/.ci/docker.mk deleted file mode 100644 index 79ab4a3f..00000000 --- a/.ci/docker.mk +++ /dev/null @@ -1,20 +0,0 @@ -.PHONY: ci_down ci_start ci_stop ci_test ci_up - -ci_up: ## Create containers used to run tests on ci CI - docker compose -f .ci/docker-compose-ci.yml up -d - -ci_start: ## Start containers stopped by `ci_stop` - docker compose -f .ci/docker-compose-ci.yml start - -ci_test: ## Run tests on Docker containers, as on ci CI - docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -u root -it edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_tests.sh - -ci_pii_check: ## Run pii annotations checker on Docker containers, as on ci CI - docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -u root -it edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_pii_checker.sh - -ci_stop: ## Stop running containers created by `ci_up` without removing them - docker compose -f .ci/docker-compose-ci.yml stop - -ci_down: ## Stop and remove containers and other resources created by `ci_up` - docker compose -f .ci/docker-compose-ci.yml down - diff --git a/.ci/run_check_keywords.sh b/.ci/run_check_keywords.sh deleted file mode 100755 index 37045bd2..00000000 --- a/.ci/run_check_keywords.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -xe - -export DJANGO_SETTINGS_MODULE=notesserver.settings.test - -cd /edx/app/edx_notes_api/edx_notes_api - -make check_keywords diff --git a/.ci/run_pii_checker.sh b/.ci/run_pii_checker.sh deleted file mode 100755 index a9262879..00000000 --- a/.ci/run_pii_checker.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -xe - -export DJANGO_SETTINGS_MODULE=notesserver.settings.test - -cd /edx/app/edx_notes_api/edx_notes_api - -make pii_check - diff --git a/.ci/run_tests.sh b/.ci/run_tests.sh deleted file mode 100755 index b112c68c..00000000 --- a/.ci/run_tests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -xe - -export DJANGO_SETTINGS_MODULE=notesserver.settings.test - -cd /edx/app/edx_notes_api/edx_notes_api - -make validate diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 94143827..00000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f58c737d..82673224 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,47 +2,61 @@ name: Django CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: + - "**" jobs: - build: - + run_tests: runs-on: ubuntu-latest strategy: fail-fast: false - max-parallel: 4 matrix: - python-version: ['py311', 'py312'] - django-version: ['django42'] - db-version: ['mysql80'] + python-version: ["3.11", "3.12"] + toxenv: ["django42"] # "quality", "pii_check", "check_keywords" steps: - - uses: actions/checkout@v4 - - name: Start container - run: | - docker compose -f .ci/docker-compose-ci.yml up -d - - name: Install Dependencies - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ - /bin/bash -c "apt-get update && apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config" - - name: setup python 311 - if: ${{ matrix.python-version == 'py311' }} - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ - /bin/bash -c "add-apt-repository ppa:deadsnakes/ppa -y && apt install python3.11 python3.11-dev python3.11-distutils -y" - - name: setup python 312 - if: ${{ matrix.python-version == 'py312' }} - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api \ - /bin/bash -c "add-apt-repository ppa:deadsnakes/ppa -y && apt install python3.12 python3.12-dev python3.12-distutils -y" - - name: Run Tests - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} --env DB_HOST=${{ matrix.db-version }} -u root edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_tests.sh - - name: Run PII Check - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} -u root edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_pii_checker.sh - - name: Run Reserved Keywords Check - run: | - docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} -u root edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.ci/run_check_keywords.sh + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} with cache + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + default-libmysqlclient-dev build-essential \ + libssl-dev openjdk-11-jdk curl + + - name: Install MySQL + run: | + sudo apt-get install -y gnupg + curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb + sudo dpkg -i mysql-apt-config_0.8.32-1_all.deb + sudo apt-get update + sudo apt-get install -y mysql-server + sudo service mysql start + mysql -e 'CREATE DATABASE edx_notes_api;' + mysql -e "CREATE USER 'notes001'@'localhost' IDENTIFIED BY 'secret';" + mysql -e "GRANT ALL PRIVILEGES ON edx_notes_api.* TO 'notes001'@'localhost';" + + - name: Install Elasticsearch + run: | + curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | \ + sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] \ + https://artifacts.elastic.co/packages/7.x/apt stable main" | \ + sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list + sudo apt-get update && sudo apt-get install -y elasticsearch=7.13.4 + sudo service elasticsearch start + + - name: Install pip and Tox + run: | + pip install --upgrade pip tox + + - name: Run Tox tests + run: tox -e ${{ matrix.toxenv }} diff --git a/.github/workflows/migrations-mysql8-check.yml b/.github/workflows/migrations-mysql8-check.yml index 7c4c8ab6..8acbe813 100644 --- a/.github/workflows/migrations-mysql8-check.yml +++ b/.github/workflows/migrations-mysql8-check.yml @@ -1,4 +1,4 @@ -name: Migrations check on mysql8 +name: Migrations check on MySQL 8 on: workflow_dispatch: @@ -9,74 +9,53 @@ on: jobs: check_migrations: - name: check migrations - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ ubuntu-latest ] - python-version: [ '3.11', '3.12' ] + python-version: ["3.11", "3.12"] steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install system Packages - run: | - sudo apt-get update - sudo apt-get install -y libxmlsec1-dev - - name: Get pip cache dir - id: pip-cache-dir - run: | - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - - name: Cache pip dependencies - id: cache-dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/pip-tools.txt') }} - restore-keys: ${{ runner.os }}-pip- - - - name: Ubuntu and sql Versions - run: | - lsb_release -a - mysql -V - - # pinning xmlsec to version 1.3.13 to avoid the CI error, migration checks are failing due to an issue in the latest release of python-xmlsec - # https://github.com/xmlsec/python-xmlsec/issues/314 - - name: Install Python dependencies - run: | - pip install -r requirements/pip-tools.txt - pip install -r requirements/test.txt - pip install -r requirements/base.txt - pip uninstall -y mysqlclient - pip install --no-binary mysqlclient mysqlclient - pip uninstall -y xmlsec - pip install --no-binary xmlsec xmlsec==1.3.13 - - - name: Initiate Services - run: | - sudo /etc/init.d/mysql start - - name: Reset mysql password - run: | - cat < temp && mv temp $(@) - upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade -upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in +upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in # Make sure to compile files after any other files they include! - sed -i.'' 's/Django<4.0//g' requirements/common_constraints.txt pip-compile --upgrade --rebuild --allow-unsafe -o requirements/pip.txt requirements/pip.in pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in pip install -qr requirements/pip.txt @@ -85,8 +69,8 @@ upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt fil pip-compile --upgrade -o requirements/base.txt requirements/base.in pip-compile --upgrade -o requirements/test.txt requirements/test.in pip-compile --upgrade -o requirements/ci.txt requirements/ci.in + pip-compile --upgrade -o requirements/quality.txt requirements/quality.in # Let tox control the Django version for tests grep -e "^django==" requirements/base.txt > requirements/django.txt sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp mv requirements/test.tmp requirements/test.txt - diff --git a/README.rst b/README.rst index 98634436..fbaaec7e 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ The edX Notes API is designed to be compatible with the `Annotator `__. +1. Install `ElasticSearch 7.13.4 `__. 2. Install the requirements: @@ -71,7 +71,7 @@ How To Contribute Contributions are very welcome. -Please read `How To Contribute `_ for details. +Please read `How To Contribute `_ for details. Reporting Security Issues ************************* @@ -84,7 +84,7 @@ Mailing List and IRC Channel You can discuss this code on the `edx-code Google Group`__ or in the ``edx-code`` IRC channel on Freenode. -__ https://groups.google.com/forum/#!forum/edx-code +__ https://groups.google.com/g/edx-code .. |build-status| image:: https://github.com/openedx/edx-notes-api/actions/workflows/ci.yml/badge.svg :target: https://github.com/openedx/edx-notes-api/actions/workflows/ci.yml diff --git a/catalog-info.yaml b/catalog-info.yaml index 88dcb9d4..ead93163 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -16,4 +16,3 @@ spec: # (Required) Acceptable Lifecycle Values: experimental, production, deprecated lifecycle: 'production' - \ No newline at end of file diff --git a/pylintrc b/pylintrc index a12ac82f..e9f59d67 100644 --- a/pylintrc +++ b/pylintrc @@ -64,7 +64,7 @@ # SERIOUSLY. # # ------------------------------ -# Generated by edx-lint version: 5.3.0 +# Generated by edx-lint version: 5.4.0 # ------------------------------ [MASTER] ignore = @@ -259,6 +259,7 @@ enable = useless-suppression, disable = bad-indentation, + broad-exception-raised, consider-using-f-string, duplicate-code, file-ignored, @@ -380,6 +381,6 @@ ext-import-graph = int-import-graph = [EXCEPTIONS] -overgeneral-exceptions = Exception +overgeneral-exceptions = builtins.Exception -# cbdfd50557cf2747f24a700b1caba610ff09bc6b +# 821f7cf64aaeddd33ba92fc983426e975d2eac72 diff --git a/requirements/base.txt b/requirements/base.txt index 42e74787..9f29143b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,7 +5,9 @@ # make upgrade # asgiref==3.8.1 - # via django + # via + # django + # django-cors-headers certifi==2024.8.30 # via # elasticsearch @@ -14,7 +16,7 @@ cffi==1.17.1 # via # cryptography # pynacl -chardet==3.0.4 +charset-normalizer==3.3.2 # via requests click==8.1.7 # via edx-django-utils @@ -22,7 +24,7 @@ cryptography==43.0.1 # via pyjwt django==4.2.16 # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.in # django-cors-headers # django-crum @@ -34,15 +36,12 @@ django==4.2.16 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==3.14.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.in +django-cors-headers==4.4.0 + # via -r requirements/base.in django-crum==0.7.9 # via edx-django-utils django-elasticsearch-dsl==7.4 # via - # -c requirements/constraints.txt # -r requirements/base.in # django-elasticsearch-dsl-drf django-elasticsearch-dsl-drf==0.22.5 @@ -78,20 +77,18 @@ edx-opaque-keys==2.11.0 # via edx-drf-extensions elasticsearch==7.13.4 # via - # -c requirements/common_constraints.txt - # -c requirements/constraints.txt + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.in # django-elasticsearch-dsl-drf # elasticsearch-dsl elasticsearch-dsl==7.4.1 # via - # -c requirements/constraints.txt # -r requirements/base.in # django-elasticsearch-dsl # django-elasticsearch-dsl-drf gunicorn==23.0.0 # via -r requirements/base.in -idna==2.10 +idna==3.8 # via requests inflection==0.5.1 # via drf-yasg @@ -106,10 +103,10 @@ packaging==24.1 # django-nine # drf-yasg # gunicorn -path-py==9.1 - # via - # -c requirements/constraints.txt - # -r requirements/base.in +path==17.0.0 + # via path-py +path-py==12.5.0 + # via -r requirements/base.in pbr==6.1.0 # via stevedore psutil==6.0.0 @@ -125,20 +122,18 @@ pymongo==4.8.0 # via edx-opaque-keys pynacl==1.5.0 # via edx-django-utils -python-dateutil==2.4.0 +python-dateutil==2.9.0.post0 # via - # -c requirements/constraints.txt # -r requirements/base.in # elasticsearch-dsl -pytz==2024.1 +pytz==2024.2 # via drf-yasg pyyaml==6.0.2 # via # drf-yasg # edx-django-release-util -requests==2.25.0 +requests==2.32.3 # via - # -c requirements/constraints.txt # -r requirements/base.in # edx-drf-extensions semantic-version==2.10.0 @@ -157,7 +152,9 @@ stevedore==5.3.0 # edx-django-utils # edx-opaque-keys typing-extensions==4.12.2 - # via edx-opaque-keys + # via + # edx-opaque-keys + # elasticsearch-dsl uritemplate==4.1.1 # via drf-yasg urllib3==1.26.20 diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt deleted file mode 100644 index 5ba91047..00000000 --- a/requirements/common_constraints.txt +++ /dev/null @@ -1,36 +0,0 @@ -# This is a temporary solution to override the real common_constraints.txt -# In edx-lint, until the pyjwt constraint in edx-lint has been removed. -# See BOM-2721 for more details. -# Below is the copied and edited version of common_constraints - -# A central location for most common version constraints -# (across edx repos) for pip-installation. -# -# Similar to other constraint files this file doesn't install any packages. -# It specifies version constraints that will be applied if a package is needed. -# When pinning something here, please provide an explanation of why it is a good -# idea to pin this package across all edx repos, Ideally, link to other information -# that will help people in the future to remove the pin when possible. -# Writing an issue against the offending project and linking to it here is good. -# -# Note: Changes to this file will automatically be used by other repos, referencing -# this file from Github directly. It does not require packaging in edx-lint. - - -# using LTS django version -Django<5.0 - -# elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process. -# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html -# See https://github.com/openedx/edx-platform/issues/35126 for more info -elasticsearch<7.14.0 - -# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected -django-simple-history==3.0.0 - -# Cause: https://github.com/openedx/event-tracking/pull/290 -# event-tracking 2.4.1 upgrades to pymongo 4.4.0 which is not supported on edx-platform. -# We will pin event-tracking to do not break existing installations -# This can be unpinned once https://github.com/openedx/edx-platform/issues/34586 -# has been resolved and edx-platform is running with pymongo>=4.4.0 -event-tracking<2.4.1 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index c26de26f..f27b3f35 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -8,16 +8,5 @@ # pin when possible. Writing an issue against the offending project and # linking to it here is good. -# This file contains all common constraints for edx-repos --c common_constraints.txt - -astroid==1.6.6 -requests==2.25.0 -elasticsearch>=7.8,<8.0 -elasticsearch-dsl>=7.2,<8.0 -django-elasticsearch-dsl>=7.1,<8.0 -path.py==9.1 -python-dateutil==2.4.0 -more-itertools==5.0.0 -pylint==1.5.0 -django-cors-headers==3.14.0 +# Common constraints for edx repos +-c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt diff --git a/requirements/production.txt b/requirements/production.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/requirements/quality.in b/requirements/quality.in index 499f5e6f..44745233 100644 --- a/requirements/quality.in +++ b/requirements/quality.in @@ -3,3 +3,6 @@ -r base.txt code-annotations +pycodestyle +pylint +edx_lint diff --git a/requirements/quality.txt b/requirements/quality.txt new file mode 100644 index 00000000..b858103a --- /dev/null +++ b/requirements/quality.txt @@ -0,0 +1,265 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# make upgrade +# +asgiref==3.8.1 + # via + # -r requirements/base.txt + # django + # django-cors-headers +astroid==3.2.4 + # via + # pylint + # pylint-celery +certifi==2024.8.30 + # via + # -r requirements/base.txt + # elasticsearch + # requests +cffi==1.17.1 + # via + # -r requirements/base.txt + # cryptography + # pynacl +charset-normalizer==3.3.2 + # via + # -r requirements/base.txt + # requests +click==8.1.7 + # via + # -r requirements/base.txt + # click-log + # code-annotations + # edx-django-utils + # edx-lint +click-log==0.4.0 + # via edx-lint +code-annotations==1.8.0 + # via + # -r requirements/quality.in + # edx-lint +cryptography==43.0.1 + # via + # -r requirements/base.txt + # pyjwt +dill==0.3.8 + # via pylint +django==4.2.16 + # via + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt + # -r requirements/base.txt + # django-cors-headers + # django-crum + # django-nine + # django-waffle + # djangorestframework + # drf-jwt + # drf-yasg + # edx-django-release-util + # edx-django-utils + # edx-drf-extensions +django-cors-headers==4.4.0 + # via -r requirements/base.txt +django-crum==0.7.9 + # via + # -r requirements/base.txt + # edx-django-utils +django-elasticsearch-dsl==7.4 + # via + # -r requirements/base.txt + # django-elasticsearch-dsl-drf +django-elasticsearch-dsl-drf==0.22.5 + # via -r requirements/base.txt +django-nine==0.2.7 + # via + # -r requirements/base.txt + # django-elasticsearch-dsl-drf +django-waffle==4.1.0 + # via + # -r requirements/base.txt + # edx-django-utils + # edx-drf-extensions +djangorestframework==3.15.2 + # via + # -r requirements/base.txt + # django-elasticsearch-dsl-drf + # drf-jwt + # drf-yasg + # edx-drf-extensions +dnspython==2.6.1 + # via + # -r requirements/base.txt + # pymongo +drf-jwt==1.19.2 + # via + # -r requirements/base.txt + # edx-drf-extensions +drf-yasg==1.21.7 + # via -r requirements/base.txt +edx-django-release-util==1.4.0 + # via -r requirements/base.txt +edx-django-utils==5.15.0 + # via + # -r requirements/base.txt + # edx-drf-extensions +edx-drf-extensions==10.4.0 + # via -r requirements/base.txt +edx-lint==5.4.0 + # via -r requirements/quality.in +edx-opaque-keys==2.11.0 + # via + # -r requirements/base.txt + # edx-drf-extensions +elasticsearch==7.13.4 + # via + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt + # -r requirements/base.txt + # django-elasticsearch-dsl-drf + # elasticsearch-dsl +elasticsearch-dsl==7.4.1 + # via + # -r requirements/base.txt + # django-elasticsearch-dsl + # django-elasticsearch-dsl-drf +gunicorn==23.0.0 + # via -r requirements/base.txt +idna==3.8 + # via + # -r requirements/base.txt + # requests +inflection==0.5.1 + # via + # -r requirements/base.txt + # drf-yasg +isort==5.13.2 + # via pylint +jinja2==3.1.4 + # via code-annotations +markupsafe==2.1.5 + # via jinja2 +mccabe==0.7.0 + # via pylint +mysqlclient==2.2.4 + # via -r requirements/base.txt +newrelic==9.13.0 + # via + # -r requirements/base.txt + # edx-django-utils +packaging==24.1 + # via + # -r requirements/base.txt + # django-nine + # drf-yasg + # gunicorn +path==17.0.0 + # via + # -r requirements/base.txt + # path-py +path-py==12.5.0 + # via -r requirements/base.txt +pbr==6.1.0 + # via + # -r requirements/base.txt + # stevedore +platformdirs==4.3.2 + # via pylint +psutil==6.0.0 + # via + # -r requirements/base.txt + # edx-django-utils +pycodestyle==2.12.1 + # via -r requirements/quality.in +pycparser==2.22 + # via + # -r requirements/base.txt + # cffi +pyjwt[crypto]==2.9.0 + # via + # -r requirements/base.txt + # drf-jwt + # edx-drf-extensions +pylint==3.2.7 + # via + # -r requirements/quality.in + # edx-lint + # pylint-celery + # pylint-django + # pylint-plugin-utils +pylint-celery==0.3 + # via edx-lint +pylint-django==2.5.5 + # via edx-lint +pylint-plugin-utils==0.8.2 + # via + # pylint-celery + # pylint-django +pymongo==4.8.0 + # via + # -r requirements/base.txt + # edx-opaque-keys +pynacl==1.5.0 + # via + # -r requirements/base.txt + # edx-django-utils +python-dateutil==2.9.0.post0 + # via + # -r requirements/base.txt + # elasticsearch-dsl +python-slugify==8.0.4 + # via code-annotations +pytz==2024.2 + # via + # -r requirements/base.txt + # drf-yasg +pyyaml==6.0.2 + # via + # -r requirements/base.txt + # code-annotations + # drf-yasg + # edx-django-release-util +requests==2.32.3 + # via + # -r requirements/base.txt + # edx-drf-extensions +semantic-version==2.10.0 + # via + # -r requirements/base.txt + # edx-drf-extensions +six==1.16.0 + # via + # -r requirements/base.txt + # django-elasticsearch-dsl + # django-elasticsearch-dsl-drf + # edx-django-release-util + # edx-lint + # elasticsearch-dsl + # python-dateutil +sqlparse==0.5.1 + # via + # -r requirements/base.txt + # django +stevedore==5.3.0 + # via + # -r requirements/base.txt + # code-annotations + # edx-django-utils + # edx-opaque-keys +text-unidecode==1.3 + # via python-slugify +tomlkit==0.13.2 + # via pylint +typing-extensions==4.12.2 + # via + # -r requirements/base.txt + # edx-opaque-keys +uritemplate==4.1.1 + # via + # -r requirements/base.txt + # drf-yasg +urllib3==1.26.20 + # via + # -r requirements/base.txt + # elasticsearch + # requests diff --git a/requirements/test.txt b/requirements/test.txt index cbb8e490..292db8df 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -8,11 +8,13 @@ asgiref==3.8.1 # via # -r requirements/base.txt # django -astroid==1.6.6 + # django-cors-headers +astroid==3.2.4 # via - # -c requirements/constraints.txt # -r requirements/test.in # pylint +cachetools==5.5.0 + # via tox certifi==2024.8.30 # via # -r requirements/base.txt @@ -23,10 +25,13 @@ cffi==1.17.1 # -r requirements/base.txt # cryptography # pynacl -chardet==3.0.4 +chardet==5.2.0 # via - # -r requirements/base.txt # diff-cover + # tox +charset-normalizer==3.3.2 + # via + # -r requirements/base.txt # requests click==8.1.7 # via @@ -36,7 +41,7 @@ click==8.1.7 code-annotations==1.8.0 # via -r requirements/test.in colorama==0.4.6 - # via pylint + # via tox coverage[toml]==7.6.1 # via # -r requirements/test.in @@ -49,10 +54,12 @@ ddt==1.7.2 # via -r requirements/test.in diff-cover==9.2.0 # via -r requirements/test.in +dill==0.3.8 + # via pylint distlib==0.3.8 # via virtualenv # via - # -c requirements/common_constraints.txt + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.txt # django-cors-headers # django-crum @@ -64,17 +71,14 @@ distlib==0.3.8 # edx-django-release-util # edx-django-utils # edx-drf-extensions -django-cors-headers==3.14.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.txt +django-cors-headers==4.4.0 + # via -r requirements/base.txt django-crum==0.7.9 # via # -r requirements/base.txt # edx-django-utils django-elasticsearch-dsl==7.4 # via - # -c requirements/constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl-drf django-elasticsearch-dsl-drf==0.22.5 @@ -119,14 +123,12 @@ edx-opaque-keys==2.11.0 # edx-drf-extensions elasticsearch==7.13.4 # via - # -c requirements/common_constraints.txt - # -c requirements/constraints.txt + # -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl-drf # elasticsearch-dsl elasticsearch-dsl==7.4.1 # via - # -c requirements/constraints.txt # -r requirements/base.txt # django-elasticsearch-dsl # django-elasticsearch-dsl-drf @@ -140,7 +142,7 @@ filelock==3.16.0 # virtualenv gunicorn==23.0.0 # via -r requirements/base.txt -idna==2.10 +idna==3.8 # via # -r requirements/base.txt # requests @@ -150,18 +152,18 @@ inflection==0.5.1 # drf-yasg iniconfig==2.0.0 # via pytest +isort==5.13.2 + # via pylint jinja2==3.1.4 # via # code-annotations # diff-cover -lazy-object-proxy==1.10.0 - # via astroid markupsafe==2.1.5 # via jinja2 -more-itertools==5.0.0 - # via - # -c requirements/constraints.txt - # -r requirements/test.in +mccabe==0.7.0 + # via pylint +more-itertools==10.5.0 + # via -r requirements/test.in mysqlclient==2.2.4 # via -r requirements/base.txt newrelic==9.13.0 @@ -174,12 +176,15 @@ packaging==24.1 # django-nine # drf-yasg # gunicorn + # pyproject-api # pytest # tox -path-py==9.1 +path==17.0.0 # via - # -c requirements/constraints.txt # -r requirements/base.txt + # path-py +path-py==12.5.0 + # via -r requirements/base.txt pbr==6.1.0 # via # -r requirements/base.txt @@ -187,7 +192,10 @@ pbr==6.1.0 pep8==1.7.1 # via -r requirements/test.in platformdirs==4.3.2 - # via virtualenv + # via + # pylint + # tox + # virtualenv pluggy==1.5.0 # via # diff-cover @@ -197,8 +205,6 @@ psutil==6.0.0 # via # -r requirements/base.txt # edx-django-utils -py==1.11.0 - # via tox pycparser==2.22 # via # -r requirements/base.txt @@ -210,10 +216,8 @@ pyjwt[crypto]==2.9.0 # -r requirements/base.txt # drf-jwt # edx-drf-extensions -pylint==1.5.0 - # via - # -c requirements/constraints.txt - # -r requirements/test.in +pylint==3.2.7 + # via -r requirements/test.in pymongo==4.8.0 # via # -r requirements/base.txt @@ -222,7 +226,9 @@ pynacl==1.5.0 # via # -r requirements/base.txt # edx-django-utils -pytest==8.3.2 +pyproject-api==1.7.1 + # via tox +pytest==8.3.3 # via # -r requirements/test.in # pytest-cov @@ -231,15 +237,14 @@ pytest-cov==5.0.0 # via -r requirements/test.in pytest-django==4.9.0 # via -r requirements/test.in -python-dateutil==2.4.0 +python-dateutil==2.9.0.post0 # via - # -c requirements/constraints.txt # -r requirements/base.txt # elasticsearch-dsl # faker python-slugify==8.0.4 # via code-annotations -pytz==2024.1 +pytz==2024.2 # via # -r requirements/base.txt # drf-yasg @@ -249,9 +254,8 @@ pyyaml==6.0.2 # code-annotations # drf-yasg # edx-django-release-util -requests==2.25.0 +requests==2.32.3 # via - # -c requirements/constraints.txt # -r requirements/base.txt # edx-drf-extensions semantic-version==2.10.0 @@ -261,15 +265,11 @@ semantic-version==2.10.0 six==1.16.0 # via # -r requirements/base.txt - # astroid # django-elasticsearch-dsl # django-elasticsearch-dsl-drf # edx-django-release-util # elasticsearch-dsl - # more-itertools - # pylint # python-dateutil - # tox sqlparse==0.5.1 # via # -r requirements/base.txt @@ -282,7 +282,9 @@ stevedore==5.3.0 # edx-opaque-keys text-unidecode==1.3 # via python-slugify -tox==3.28.0 +tomlkit==0.13.2 + # via pylint +tox==4.18.1 # via -r requirements/test.in typing-extensions==4.12.2 # via @@ -299,5 +301,3 @@ urllib3==1.26.20 # requests virtualenv==20.26.4 # via tox -wrapt==1.16.0 - # via astroid diff --git a/tox.ini b/tox.ini index 5b64eb6b..838605e8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,12 @@ [tox] -envlist = py{311,312}-django{42} +envlist = py{311,312}-django{42} #, quality, pii_check, check_keywords skipsdist = true +isolated_build = true # Enable isolated build environments [testenv] +envdir = {toxworkdir}/{envname} deps = - setuptools django42: Django>=4.2,<5.0 - -r {toxinidir}/requirements/test.txt passenv = CONN_MAX_AGE DB_ENGINE @@ -21,3 +21,34 @@ allowlist_externals = make commands = make validate + +[testenv:quality] +envdir = {toxworkdir}/{envname} +allowlist_externals = + make +deps = + -r{toxinidir}/requirements/quality.txt +commands = + make quality + +[testenv:pii_check] +envdir = {toxworkdir}/{envname} +setenv = + DJANGO_SETTINGS_MODULE = notesserver.settings.test +allowlist_externals = + make +deps = + Django>=4.2,<5.0 +commands = + make pii_check + +[testenv:check_keywords] +envdir = {toxworkdir}/{envname} +setenv = + DJANGO_SETTINGS_MODULE = notesserver.settings.test +allowlist_externals = + make +deps = + -r{toxinidir}/requirements/test.txt +commands = + make check_keywords