Skip to content

Commit

Permalink
Merge pull request #8 from edx/jmbowman/ci_fixes
Browse files Browse the repository at this point in the history
fix: Fix CI builds
  • Loading branch information
ashultz0 authored Oct 25, 2023
2 parents ff780b2 + 0f00d25 commit 83937e6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
9 changes: 6 additions & 3 deletions flashcards/apps/api/v1/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""
Django views for the flashcards IDA API
"""
from django.views.decorators.http import require_http_methods
from rest_framework.decorators import api_view, authentication_classes, permission_classes
from rest_framework.decorators import api_view # , authentication_classes, permission_classes
from rest_framework.response import Response

from flashcards.apps.cards.anki import anki_from_block_id
Expand All @@ -8,5 +11,5 @@
@api_view(['GET']) # TODO get is completely wrong here but convenient for testing
@require_http_methods(['GET'])
def cards(request, course_id, block_id):
cards = anki_from_block_id(course_id, block_id)
return Response(cards)
generated_cards = anki_from_block_id(course_id, block_id)
return Response(generated_cards)
4 changes: 2 additions & 2 deletions flashcards/apps/cards/anki.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Implementation of AnkiConnect to create cards
"""
from flashcards.apps.cards.cardgen import cards_from_block_id
import genanki

from flashcards.apps.cards.cardgen import cards_from_block_id


def create_anki_cards(openai_data):
"""
Expand Down Expand Up @@ -46,4 +47,3 @@ def anki_from_block_id(course_id, block_id):
result = csv_maybe.replace('\t', '')
create_anki_cards(result)
return csv_maybe # return the CSV text so we can see it in testing

3 changes: 1 addition & 2 deletions flashcards/apps/cards/cardgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from edx_rest_api_client import client as rest_client

from flashcards.apps.cards.prompt import anki_prompt
from flashcards.settings.private import OPENAI_API_KEY # pylint: disable=import-error,no-name-in-module

openai.api_key = OPENAI_API_KEY
openai.api_key = settings.OPENAI_API_KEY


def get_client(oauth_base_url=settings.LMS_ROOT_URL):
Expand Down
4 changes: 4 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

# Common constraints for edx repos
-c common_constraints.txt

# A new deprecation warning inadvertently broke all builds, waiting for a fix
# https://github.com/pydata/pydata-sphinx-theme/issues/1539
pydata-sphinx-theme<0.14.2
6 changes: 4 additions & 2 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,10 @@ pycparser==2.21
# via
# -r requirements/test.txt
# cffi
pydata-sphinx-theme==0.14.2
# via sphinx-book-theme
pydata-sphinx-theme==0.14.1
# via
# -c requirements/constraints.txt
# sphinx-book-theme
pygments==2.16.1
# via
# accessible-pygments
Expand Down

0 comments on commit 83937e6

Please sign in to comment.