Skip to content

Commit

Permalink
perf: add compatibility with palm release (#50)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: add compatibility with palm release

* ci: update workflow dependencies

* docs: update README

* build: update plugin requirements

* fix: message_control enabled weren't being used

* refactor: allow 120 characters per line when pylint is executed

* feat: override get_dirs method

* chore: increase eox-tenant version

* fix: gh-action-pypi-publish version

---------

Co-authored-by: andrey-canon <andrey.canon@edunext.co>
bra-i-am and andrey-canon authored Nov 20, 2023
1 parent 4b1b2d2 commit 0f21bb2
Showing 14 changed files with 102 additions and 168 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
default_prerelease_bump: false
dry_run: true
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Create bumpversion
@@ -40,7 +40,7 @@ jobs:
- name: Commit bumpversion
id: bumpversion
if: steps.tag_version.outputs.new_version
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.ref }}
commit_message: "docs(bumpversion): ${{ steps.tag_version.outputs.previous_tag }} → ${{ steps.tag_version.outputs.new_version }}"
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4.1.12
- uses: wagoid/commitlint-github-action@v5.4.4
2 changes: 1 addition & 1 deletion .github/workflows/pr_issue_assignment.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Auto-assign PR-Issue'
uses: pozil/auto-assign-issue@v1.5.0
uses: pozil/auto-assign-issue@v1.13.0
with:
repo-token: ${{ secrets.DEDALO_PAT }}
teams: theming
6 changes: 3 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -21,9 +21,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
@@ -34,7 +34,7 @@ jobs:
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache dependency
uses: actions/cache@v3
@@ -26,7 +26,7 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ Compatibility Notes
+------------------+---------------------+
| Olive | >= 5.0 |
+------------------+---------------------+
| Palm | >= 6.0 |
+------------------+---------------------+

**NOTE**: From Lilac version Django 2.2 is not supported, you should use Django 3.2 and eox-tenant >=4.0.

@@ -56,8 +58,8 @@ Koa (optional)**
EOX_THEMING_EDXMAKO_BACKEND = 'eox_theming.edxapp_wrapper.backends.l_mako'
Lilac - Maple - Nutmeg - Olive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lilac - Maple - Nutmeg - Olive - Palm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
15 changes: 15 additions & 0 deletions eox_theming/theming/template_loaders.py
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ class EoxThemeTemplateLoader(OpenedxThemeLoader):
See: openedx.core.djangoapps.theming.template_loaders.py
"""

def __init__(self, *args):
MakoLoader.__init__(self, EoxThemeFilesystemLoader(*args))

@@ -79,3 +80,17 @@ def get_grandparent_theme_template_sources():
return grandparent_theme.template_dirs

return template_paths

def get_dirs(self):
"""This overrides the default get_dirs method from django
https://github.com/django/django/blob/3.2/django/template/loaders/filesystem.py#L18
due to the django implementation depends on the initialization process that is performed by
the sub-class ThemeFilesystemLoader
https://github.com/eduNEXT/edunext-platform/blob/open-release/maple.master/openedx/core/djangoapps/theming/template_loaders.py#L30
however that implementation is cached and doesn't allow to get the right values during the execution time.
Finally this returns the result of the `get_theme_template_sources` method
https://github.com/eduNEXT/edunext-platform/blob/master/openedx/core/djangoapps/theming/template_loaders.py#L39
instead of using the cached values of self.dirs on runtime.
"""
return ThemeFilesystemLoader.get_theme_template_sources()
14 changes: 8 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
asgiref==3.6.0
asgiref==3.7.2
# via django
django==3.2.16
django==3.2.23
# via
# -c requirements/constraints.txt
# -r requirements/base.in
eox-tenant==8.0.0
eox-tenant==10.0.0
# via
# -c requirements/constraints.txt
# -r requirements/base.in
pytz==2022.2.1
pytz==2022.7.1
# via
# -c requirements/constraints.txt
# django
six==1.16.0
# via -r requirements/base.in
sqlparse==0.4.3
sqlparse==0.4.4
# via django
typing-extensions==4.8.0
# via asgiref
16 changes: 4 additions & 12 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -10,17 +10,9 @@

# Keep same platform version
Django<4.0
pylint<2.14
testfixtures==7.0.0
coverage[toml]==6.5.0
mako==1.2.3
mock==4.0.3
path-py==12.5.0
pylint<2.16.0
pycodestyle<2.9.0
pytz==2022.2.1
pytz<2023

# Version used in Olive version of edx-platform
edx-opaque-keys==2.3.0

# Version used in Olive version of eox-tenant
eox-tenant>= 8.0
# Version used in Palm version of eox-tenant
eox-tenant>= 10.0.0
2 changes: 1 addition & 1 deletion requirements/django.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Django==3.2.16
Django==3.2.23
21 changes: 14 additions & 7 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
build==0.10.0
build==1.0.3
# via pip-tools
click==8.1.3
click==8.1.7
# via pip-tools
packaging==23.0
importlib-metadata==6.8.0
# via build
pip-tools==6.12.2
packaging==23.2
# via build
pip-tools==7.3.0
# via -r requirements/pip-tools.in
pyproject-hooks==1.0.0
# via build
tomli==2.0.1
# via build
wheel==0.38.4
# via
# build
# pip-tools
# pyproject-hooks
wheel==0.41.3
# via pip-tools
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
63 changes: 28 additions & 35 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,84 +1,77 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
asgiref==3.6.0
asgiref==3.7.2
# via
# -r requirements/base.txt
# django
astroid==2.11.7
astroid==2.13.5
# via
# -r requirements/test.in
# pylint
coverage[toml]==6.5.0
# via
# -c requirements/constraints.txt
# -r requirements/test.in
dill==0.3.6
coverage==7.3.2
# via -r requirements/test.in
dill==0.3.7
# via pylint
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# -r requirements/test.in
eox-tenant==8.0.0
eox-tenant==10.0.0
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
isort==5.12.0
# via pylint
lazy-object-proxy==1.9.0
# via astroid
mako==1.2.3
# via
# -c requirements/constraints.txt
# -r requirements/test.in
markupsafe==2.1.2
mako==1.3.0
# via -r requirements/test.in
markupsafe==2.1.3
# via mako
mccabe==0.7.0
# via pylint
mock==4.0.3
# via
# -c requirements/constraints.txt
# -r requirements/test.in
path==16.6.0
mock==5.1.0
# via -r requirements/test.in
path==16.7.1
# via path-py
path-py==12.5.0
# via
# -c requirements/constraints.txt
# -r requirements/test.in
platformdirs==2.6.2
# via -r requirements/test.in
platformdirs==3.11.0
# via pylint
pycodestyle==2.8.0
# via
# -c requirements/constraints.txt
# -r requirements/test.in
pylint==2.13.9
pylint==2.15.10
# via
# -c requirements/constraints.txt
# -r requirements/test.in
pytz==2022.2.1
pytz==2022.7.1
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# django
six==1.16.0
# via -r requirements/base.txt
sqlparse==0.4.3
sqlparse==0.4.4
# via
# -r requirements/base.txt
# django
testfixtures==7.0.0
# via
# -c requirements/constraints.txt
# -r requirements/test.in
testfixtures==7.2.2
# via -r requirements/test.in
tomli==2.0.1
# via pylint
tomlkit==0.12.3
# via pylint
typing-extensions==4.8.0
# via
# coverage
# -r requirements/base.txt
# asgiref
# astroid
# pylint
wrapt==1.14.1
wrapt==1.16.0
# via astroid

# The following packages are considered to be unsafe in a requirements file:
# setuptools
22 changes: 11 additions & 11 deletions requirements/tox.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
cachetools==5.3.0
cachetools==5.3.2
# via tox
chardet==5.1.0
chardet==5.2.0
# via tox
colorama==0.4.6
# via tox
distlib==0.3.6
distlib==0.3.7
# via virtualenv
filelock==3.9.0
filelock==3.13.1
# via
# tox
# virtualenv
packaging==23.0
packaging==23.2
# via
# pyproject-api
# tox
platformdirs==2.6.2
platformdirs==3.11.0
# via
# tox
# virtualenv
pluggy==1.0.0
pluggy==1.3.0
# via tox
pyproject-api==1.5.0
pyproject-api==1.6.1
# via tox
tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.4.3
tox==4.11.3
# via -r requirements/tox.in
virtualenv==20.17.1
virtualenv==20.24.6
# via tox
91 changes: 7 additions & 84 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ tag = False

[pylint]
ignore = migrations,CVS
max-line-length = 120

[isort]
default_section = THIRDPARTY
@@ -14,7 +15,7 @@ indent = ' '
line_length = 120
multi_line_output = 3

[MESSAGES CONTROL]
[pylint.messages_control]
enable =
line-too-long,
syntax-error,
@@ -49,18 +50,15 @@ enable =
undefined-all-variable,
invalid-all-object,
no-name-in-module,
unbalance-tuple-unpacking,
unbalanced-tuple-unpacking,
unpacking-non-sequence,
bad-except-order,
raising-bad-type,
misplaced-bare-raise,
raising-non-exception,
nonimplemented-raised,
notimplemented-raised,
catching-non-exception,
slots-on-old-class,
super-on-old-class,
bad-super-call,
missing-super-argument,
no-member,
not-callable,
assignment-from-no-return,
@@ -84,19 +82,14 @@ enable =
logging-too-few-args,
bad-format-character,
truncated-format-string,
mixed-fomat-string,
mixed-format-string,
format-needs-mapping,
missing-format-string-key,
too-many-format-args,
too-few-format-args,
bad-str-strip-call,
model-unicode-not-callable,
super-method-not-called,
non-parent-method-called,
test-inherits-tests,
translation-of-non-string,
redefined-variable-type,
cyclical-import,
non-parent-init-called,
cyclic-import,
unreachable,
dangerous-default-value,
pointless-statement,
@@ -113,20 +106,15 @@ enable =
signature-differs,
abstract-method,
super-init-not-called,
relative-import,
import-self,
misplaced-future,
invalid-encoded-data,
global-variable-undefined,
redefined-outer-name,
redefined-builtin,
redefined-in-handler,
undefined-loop-variable,
cell-var-from-loop,
duplicate-except,
nonstandard-exception,
binary-op-exception,
property-on-old-class,
bad-format-string-key,
unused-format-string-key,
bad-format-string,
@@ -143,9 +131,7 @@ enable =
astroid-error,
parse-error,
method-check-failed,
django-not-available,
raw-checker-failed,
django-not-available-placeholder,
empty-docstring,
invalid-characters-in-docstring,
missing-docstring,
@@ -159,19 +145,14 @@ enable =
bad-classmethod-argument,
bad-mcs-classmethod-argument,
bad-mcs-method-argument,
bad-whitespace,
consider-iterating-dictionary,
consider-using-enumerate,
literal-used-as-attribute,
multiple-imports,
multiple-statements,
old-style-class,
simplifiable-range,
singleton-comparison,
superfluous-parens,
unidiomatic-typecheck,
unneeded-not,
wrong-assert-type,
simplifiable-if-statement,
no-classmethod-decorator,
no-staticmethod-decorator,
@@ -186,9 +167,6 @@ enable =
broad-except,
logging-not-lazy,
redundant-unittest-assert,
model-missing-unicode,
model-has-unicode,
model-no-explicit-unicode,
protected-access,
deprecated-module,
deprecated-method,
@@ -204,71 +182,22 @@ enable =
trailing-newlines,
trailing-whitespace,
unexpected-line-ending-format,
mixed-indentation,
bad-option-value,
unrecognized-inline-option,
useless-suppression,
bad-inline-option,
deprecated-pragma,
disable =
bad-continuation,
invalid-name,
misplaced-comparison-constant,
file-ignored,
bad-indentation,
lowercase-l-suffix,
unused-wildcard-import,
global-statement,
no-else-return,
apply-builtin,
backtick,
basestring-builtin,
buffer-builtin,
cmp-builtin,
cmp-method,
coerce-builtin,
coerce-method,
delslice-method,
dict-iter-method,
dict-view-method,
duplicate-code,
execfile-builtin,
file-builtin,
filter-builtin-not-iterating,
fixme,
getslice-method,
hex-method,
import-star-module-level,
indexing-exception,
input-builtin,
intern-builtin,
locally-disabled,
locally-enabled,
logging-format-interpolation,
long-builtin,
long-suffix,
map-builtin-not-iterating,
metaclass-assignment,
next-method-called,
no-absolute-import,
no-init,
no-self-use,
nonzero-method,
oct-method,
old-division,
old-ne-operator,
old-octal-literal,
old-raise-syntax,
parameter-unpacking,
print-statement,
raising-string,
range-builtin-not-iterating,
raw_input-builtin,
reduce-builtin,
reload-builtin,
round-builtin,
setslice-method,
standarderror-builtin,
suppressed-message,
too-few-public-methods,
too-many-ancestors,
@@ -279,12 +208,6 @@ disable =
too-many-locals,
too-many-public-methods,
too-many-return-statements,
unichr-builtin,
unicode-builtin,
unpacking-in-except,
using-cmp-argument,
xrange-builtin,
zip-builtin-not-iterating,

[bumpversion:file:eox_theming/__init__.py]

0 comments on commit 0f21bb2

Please sign in to comment.