Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…survey into jenkins/zshkoor/setup-py-updated-01931be
  • Loading branch information
BilalQamar95 committed Dec 10, 2024
2 parents bf75e71 + 242fc62 commit 4ebc4bb
Show file tree
Hide file tree
Showing 18 changed files with 206 additions and 290 deletions.
33 changes: 33 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": [
"config:base",
"schedule:weekly",
":automergeLinters",
":automergeMinor",
":automergeTesters",
":enableVulnerabilityAlerts",
":rebaseStalePrs",
":semanticCommits",
":updateNotScheduled"
],
"packageRules": [
{
"matchDepTypes": [
"devDependencies"
],
"matchUpdateTypes": [
"lockFileMaintenance",
"minor",
"patch",
"pin"
],
"automerge": true
},
{
"matchPackagePatterns": ["@edx", "@openedx"],
"matchUpdateTypes": ["minor", "patch"],
"automerge": true
}
],
"timezone": "America/New_York"
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
python-version: ['3.11', '3.12']
toxenv: [django32, django42, quality, csslint, eslint]

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: setup python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.11

- name: Install pip
run: pip install -r requirements/pip.txt
Expand All @@ -24,7 +24,7 @@ jobs:
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
3 changes: 2 additions & 1 deletion qualtricssurvey/mixins/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django.template.context import Context
from xblock.core import XBlock
from xblock.fragment import Fragment
from web_fragments.fragment import Fragment


class XBlockFragmentBuilderMixin:
Expand Down Expand Up @@ -55,6 +55,7 @@ def student_view(self, context=None):

def build_fragment(
self,
*,
template='',
context=None,
css=None,
Expand Down
58 changes: 6 additions & 52 deletions qualtricssurvey/mixins/scenario.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,14 @@
"""
Mixin workbench behavior into XBlocks
"""
from glob import glob
import pkg_resources


def _read_file(file_path):
"""
Read in a file's contents
"""
with open(file_path, encoding='utf-8') as file_input:
file_contents = file_input.read()
return file_contents


def _parse_title(file_path):
"""
Parse a title from a file name
"""
title = file_path
title = title.split('/')[-1]
title = '.'.join(title.split('.')[:-1])
title = ' '.join(title.split('-'))
title = ' '.join([
word.capitalize()
for word in title.split(' ')
])
return title
try:
from xblock.utils.resources import ResourceLoader
except ModuleNotFoundError:
from xblockutils.resources import ResourceLoader


def _read_files(files):
"""
Read the contents of a list of files
"""
file_contents = [
(
_parse_title(file_path),
_read_file(file_path),
)
for file_path in files
]
return file_contents


def _find_files(directory):
"""
Find XML files in the directory
"""
pattern = f"{directory}/*.xml"
files = glob(pattern)
return files
loader = ResourceLoader(__name__)


class XBlockWorkbenchMixin:
Expand All @@ -62,9 +21,4 @@ def workbench_scenarios(cls):
"""
Gather scenarios to be displayed in the workbench
"""
module = cls.__module__
module = module.split('.', maxsplit=1)[0]
directory = pkg_resources.resource_filename(module, 'scenarios')
files = _find_files(directory)
scenarios = _read_files(files)
return scenarios
return loader.load_scenarios_from_path("../scenarios")
1 change: 0 additions & 1 deletion qualtricssurvey/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class QualtricsSurveyModelMixin:
help=_('This is the name of your university.'),
)

# pylint: disable=no-member
def get_anon_id(self):
"""
Return an anonymous user id
Expand Down
9 changes: 7 additions & 2 deletions qualtricssurvey/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""
Handle view logic for the XBlock
"""
from xblockutils.resources import ResourceLoader
from xblockutils.studio_editable import StudioEditableXBlockMixin
try:
from xblock.utils.resources import ResourceLoader
from xblock.utils.studio_editable import StudioEditableXBlockMixin
except ModuleNotFoundError:
# For backward compatibility with releases older than Quince.
from xblockutils.resources import ResourceLoader
from xblockutils.studio_editable import StudioEditableXBlockMixin

from .mixins.fragment import XBlockFragmentBuilderMixin

Expand Down
1 change: 0 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

Django
XBlock
xblock-utils
75 changes: 19 additions & 56 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,46 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# make upgrade
#
appdirs==1.4.4
# via fs
asgiref==3.7.2
asgiref==3.8.1
# via django
boto3==1.28.40
# via fs-s3fs
botocore==1.31.40
# via
# boto3
# s3transfer
django==3.2.20
django==4.2.17
# via
# -c requirements/common_constraints.txt
# -r requirements/base.in
# openedx-django-pyfs
fs==2.4.16
# via
# fs-s3fs
# openedx-django-pyfs
# xblock
fs-s3fs==1.1.1
# via openedx-django-pyfs
jmespath==1.0.1
# via
# boto3
# botocore
lazy==1.5
# via xblock
lxml==4.9.3
lxml==5.3.0
# via xblock
mako==1.2.4
# via xblock-utils
markupsafe==2.1.3
mako==1.3.8
# via xblock
markupsafe==3.0.2
# via
# mako
# xblock
openedx-django-pyfs==3.4.0
python-dateutil==2.9.0.post0
# via xblock
python-dateutil==2.8.2
# via
# botocore
# xblock
pytz==2023.3
# via
# django
# xblock
pyyaml==6.0.1
pytz==2024.2
# via xblock
pyyaml==6.0.2
# via xblock
s3transfer==0.6.2
# via boto3
simplejson==3.19.1
# via xblock-utils
six==1.16.0
simplejson==3.19.3
# via xblock
six==1.17.0
# via
# fs
# fs-s3fs
# python-dateutil
sqlparse==0.4.4
sqlparse==0.5.2
# via django
typing-extensions==4.7.1
# via asgiref
urllib3==1.26.16
# via botocore
web-fragments==2.1.0
# via
# xblock
# xblock-utils
webob==1.8.7
web-fragments==2.2.0
# via xblock
xblock[django]==1.7.0
# via
# -r requirements/base.in
# xblock-utils
xblock-utils==3.4.1
webob==1.8.9
# via xblock
xblock==5.1.0
# via -r requirements/base.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down
62 changes: 31 additions & 31 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# make upgrade
#
certifi==2023.7.22
cachetools==5.5.0
# via
# -r requirements/tox.txt
# tox
certifi==2024.8.30
# via requests
charset-normalizer==3.2.0
chardet==5.2.0
# via
# -r requirements/tox.txt
# tox
charset-normalizer==3.4.0
# via requests
coverage==6.5.0
colorama==0.4.6
# via
# -r requirements/tox.txt
# tox
coverage[toml]==7.6.9
# via coveralls
coveralls==3.3.1
coveralls==4.0.1
# via -r requirements/ci.in
distlib==0.3.7
distlib==0.3.9
# via
# -r requirements/tox.txt
# virtualenv
docopt==0.6.2
# via coveralls
filelock==3.12.3
filelock==3.16.1
# via
# -r requirements/tox.txt
# tox
# virtualenv
idna==3.4
idna==3.10
# via requests
packaging==23.1
packaging==24.2
# via
# -r requirements/tox.txt
# pyproject-api
# tox
platformdirs==3.10.0
platformdirs==4.3.6
# via
# -r requirements/tox.txt
# tox
# virtualenv
pluggy==1.3.0
pluggy==1.5.0
# via
# -r requirements/tox.txt
# tox
py==1.11.0
pyproject-api==1.8.0
# via
# -r requirements/tox.txt
# tox
requests==2.31.0
requests==2.32.3
# via coveralls
six==1.16.0
# via
# -r requirements/tox.txt
# tox
tomli==2.0.1
# via
# -r requirements/tox.txt
# tox
tox==3.28.0
# via
# -c requirements/common_constraints.txt
# -r requirements/tox.txt
typing-extensions==4.7.1
# via
# -r requirements/tox.txt
# filelock
urllib3==2.0.4
tox==4.23.2
# via -r requirements/tox.txt
urllib3==2.2.3
# via requests
virtualenv==20.24.4
virtualenv==20.28.0
# via
# -r requirements/tox.txt
# tox
Loading

0 comments on commit 4ebc4bb

Please sign in to comment.