Skip to content

Commit

Permalink
Merge branch 'master' into ttqureshi/depr_pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ttqureshi authored Oct 31, 2024
2 parents ad7695b + 42e754e commit c30291e
Show file tree
Hide file tree
Showing 76 changed files with 11,472 additions and 10,433 deletions.
1 change: 0 additions & 1 deletion .github/workflows/add-remove-label-on-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ on:
jobs:
add_remove_labels:
uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master

75 changes: 37 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [master]
pull_request:
branches:
- '**'
- "**"

jobs:
run_tests:
Expand All @@ -15,43 +15,42 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.11', '3.12']
node-version: [16]
python-version: ["3.11", "3.12"]
toxenv: [quality, js, django42]

steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Set env variable
run: export AWS_CONFIG_FILE=/dev/null

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Install GNU gettext
run: sudo apt-get install gettext

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv=='django42'
uses: codecov/codecov-action@v4
with:
flags: unittests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Set env variable
run: export AWS_CONFIG_FILE=/dev/null

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Install GNU gettext
run: sudo apt-get install gettext

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run Coverage
if: matrix.python-version == '3.12' && matrix.toxenv=='django42'
uses: codecov/codecov-action@v4
with:
flags: unittests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name: Publish package to PyPi
on:
push:
tags:
- '*'
- "*"

jobs:

push:
runs-on: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branch:
description: "Target branch against which to create requirements PR"
required: true
default: 'master'
default: "master"

jobs:
call-upgrade-python-requirements-workflow:
Expand All @@ -24,4 +24,4 @@ jobs:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sphinx:

# Set the version of python needed to build these docs.
build:
os: "ubuntu-22.04"
os: "ubuntu-lts-latest"
tools:
python: "3.12"

Expand Down
45 changes: 24 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extract_translations compile_translations generate_dummy_translations validate_translations \
detect_changed_source_translations pull_translations push_translations check_translations_up_to_date \
quality test-python render-templates test-js test-js-debug test test-acceptance test-a11y test-sandbox \
install-osx-requirements
compile-requirements install-osx-requirements

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -43,23 +43,23 @@ $(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"
echo "$(COMMON_CONSTRAINTS_TEMP_COMMENT)" | cat - $(@) > temp && mv temp $(@)

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
compile-requirements: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
# global common_constraints has this pin.
sed 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp
mv requirements/common_constraints.tmp requirements/common_constraints.txt
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile ${COMPILE_OPTS} --allow-unsafe -o requirements/pip.txt requirements/pip.in
pip-compile ${COMPILE_OPTS} -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
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/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/test-acceptance.txt requirements/test-acceptance.in
pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --upgrade -o requirements/docs.txt requirements/docs.in
pip-compile ${COMPILE_OPTS} --allow-unsafe -o requirements/base.txt requirements/base.in
pip-compile ${COMPILE_OPTS} -o requirements/test.txt requirements/test.in
pip-compile ${COMPILE_OPTS} --allow-unsafe -o requirements/quality.txt requirements/quality.in
pip-compile ${COMPILE_OPTS} -o requirements/test-acceptance.txt requirements/test-acceptance.in
pip-compile ${COMPILE_OPTS} -o requirements/tox.txt requirements/tox.in
pip-compile ${COMPILE_OPTS} --allow-unsafe -o requirements/ci.txt requirements/ci.in
pip-compile ${COMPILE_OPTS} -o requirements/docs.txt requirements/docs.in
# Delete django pin from test requirements to avoid tox version collision
sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
Expand All @@ -70,6 +70,9 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with
# Delete temporary files
rm requirements/*.txt.tmp

upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
$(MAKE) compile-requirements COMPILE_OPTS="--upgrade"

##############################
# Generate js/css output files
##############################
Expand All @@ -85,9 +88,9 @@ update-npm-requirements: ## update NPM requrements
static: ## Webpack JavaScript and SASS source files
npm run build

################
#Translations Handling
################
#######################
# Translations Handling
#######################

extract_translations: ## creates the django-partial.po & django-partial.mo files
cd ./openassessment && django-admin makemessages -l en -v1 -d django
Expand All @@ -113,9 +116,9 @@ push_translations: ## push source translation files (.po) to Transifex

check_translations_up_to_date: extract_translations compile_translations generate_dummy_translations detect_changed_source_translations ## extract, compile, and check if translation files are up-to-date

################
#Tests and checks
################
##################
# Tests and checks
##################

quality: ## Run linting and code quality checks
npm run lint
Expand All @@ -142,9 +145,9 @@ install-osx-requirements: ## Install OSX specific requirements using Homebrew
brew install gettext
brew link gettext --force

##################
#Devstack commands
##################
###################
# Devstack commands
###################

install-local-ora: ## installs your local ORA2 code into the LMS and Studio python virtualenvs
docker exec -t edx.devstack.lms bash -c '. /edx/app/edxapp/venvs/edxapp/bin/activate && cd /edx/app/edxapp/edx-platform && pip uninstall -y ora2 && pip install -e /edx/src/edx-ora2 && pip freeze | grep ora2'
Expand Down
45 changes: 28 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,36 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
from datetime import datetime

project = 'edx-ora2'
copyright = '2023, Open edX Community'
author = 'Open edX Community'
release = 'latest'
project = "edx-ora2"
current_year = datetime.now().year
copyright = f"{current_year}, Open edX Community"
author = "Open edX Community"
release = "latest"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinxcontrib.contentui',
'sphinx_copybutton',
'sphinx.ext.graphviz',
'sphinxcontrib.mermaid',
"sphinxcontrib.contentui",
"sphinx_copybutton",
"sphinx.ext.graphviz",
"sphinxcontrib.mermaid",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

language = 'en'
language = "en"

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
html_theme = "sphinx_book_theme"
html_static_path = ["_static"]

html_theme_options = {

"repository_url": "https://github.com/openedx/edx-ora2",
"repository_branch": "master",
"path_to_docs": "docs/",
Expand All @@ -61,7 +62,7 @@
rel="license"
href="https://creativecommons.org/licenses/by-sa/4.0/"
>Creative Commons Attribution-ShareAlike 4.0 International License</a>.
"""
""",
}

# Note the logo won't show up properly yet because there is an upstream
Expand All @@ -72,5 +73,15 @@
html_favicon = "https://logos.openedx.org/open-edx-favicon.ico"

# Set the DJANGO_SETTINGS_MODULE if it's not set.
if not os.environ.get('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'
if not os.environ.get("DJANGO_SETTINGS_MODULE"):
os.environ["DJANGO_SETTINGS_MODULE"] = "settings.base"

# -- Read the Docs Specific Configuration
# Define the canonical URL if you are using a custom domain on Read the Docs
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")

# Tell Jinja2 templates the build is running on Read the Docs
if os.environ.get("READTHEDOCS", "") == "True":
if "html_context" not in globals():
html_context = {}
html_context["READTHEDOCS"] = True
4 changes: 2 additions & 2 deletions openassessment/assessment/api/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def get_score(submission_uuid, peer_requirements, course_settings):
}


def create_assessment(
def create_assessment( # pylint: disable=too-many-positional-arguments
scorer_submission_uuid,
scorer_id,
options_selected,
Expand Down Expand Up @@ -420,7 +420,7 @@ def create_assessment(


@transaction.atomic
def _complete_assessment(
def _complete_assessment( # pylint: disable=too-many-positional-arguments
rubric_dict,
scorer_id,
peer_submission_uuid,
Expand Down
4 changes: 2 additions & 2 deletions openassessment/assessment/api/self.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_score(submission_uuid, self_requirements, course_settings): # pylint: d
}


def create_assessment(
def create_assessment( # pylint: disable=too-many-positional-arguments
submission_uuid,
user_id,
options_selected,
Expand Down Expand Up @@ -179,7 +179,7 @@ def create_assessment(


@transaction.atomic
def _complete_assessment(
def _complete_assessment( # pylint: disable=too-many-positional-arguments
submission_uuid,
user_id,
options_selected,
Expand Down
4 changes: 2 additions & 2 deletions openassessment/assessment/api/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def get_staff_grading_statistics(course_id, item_id):
return StaffWorkflow.get_workflow_statistics(course_id, item_id)


def create_assessment(
def create_assessment( # pylint: disable=too-many-positional-arguments
submission_uuid,
scorer_id,
options_selected,
Expand Down Expand Up @@ -389,7 +389,7 @@ def create_assessment(


@transaction.atomic
def _complete_assessment(
def _complete_assessment( # pylint: disable=too-many-positional-arguments
submission_uuid,
scorer_id,
options_selected,
Expand Down
2 changes: 1 addition & 1 deletion openassessment/assessment/api/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def get_staff_grading_statistics(course_id, item_id):
return TeamStaffWorkflow.get_workflow_statistics(course_id, item_id)


def create_assessment(
def create_assessment( # pylint: disable=too-many-positional-arguments
team_submission_uuid,
scorer_id,
options_selected,
Expand Down
1 change: 1 addition & 0 deletions openassessment/assessment/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def __str__(self):
return f"Assessment {self.id}"

@classmethod
# pylint: disable=too-many-positional-arguments
def create(cls, rubric, scorer_id, submission_uuid, score_type, feedback=None, scored_at=None):
"""
Create a new assessment.
Expand Down
3 changes: 2 additions & 1 deletion openassessment/assessment/models/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
import random

from django.conf import settings
from django.db import DatabaseError, models
from django.utils.timezone import now

Expand Down Expand Up @@ -108,7 +109,7 @@ class PeerWorkflow(models.Model):
"""
# Amount of time before a lease on a submission expires
TIME_LIMIT = timedelta(hours=8)
TIME_LIMIT = timedelta(hours=getattr(settings, "ORA_PEER_LEASE_EXPIRATION_HOURS", 8))

student_id = models.CharField(max_length=40, db_index=True)
item_id = models.CharField(max_length=255, db_index=True)
Expand Down
Loading

0 comments on commit c30291e

Please sign in to comment.