Compare commits

..

16 Commits

Author SHA1 Message Date
Florian du Garage Num
1a9977e454 remove hard-coded uid 1000
Some checks failed
Sync with private repo / sync (push) Has been cancelled
Run tests / tests (3.12) (push) Has been cancelled
Run tests / tests (3.9) (push) Has been cancelled
2025-09-30 21:41:58 +02:00
Eemaan Amir
10701f4e64
chore: update maintainer email (#70) 2025-09-19 11:51:14 +05:00
Danyal Faheem
8f4a0b1d91
feat: migrate from pylint/black to ruff (#69)
Linked Epic: https://github.com/overhangio/tutor/issues/1251

Some new rules that have been added are:

I: sort imports
N: check for pep8-naming standards
W292: check for missing extra line at EOF

Some of our lines, particularly in config, break the 88 character line length limit. For that, we add a # noqa: E501 to let ruff know to ignore the rule for that line
2025-08-05 15:42:29 +05:00
Ahmed Khalid
65802e8741
Merge pull request #68 from overhangio/teak 2025-06-27 17:21:06 +05:00
Syed Muhammad Dawoud Sheraz Ali
4647d8a01a chore: update changelog for v20 2025-06-26 22:23:09 +05:00
Danyal-Faheem
3bc0733e6e chore: create update changelog date 2025-06-26 22:21:32 +05:00
Danyal-Faheem
26d00745c8 v20.0.0 2025-06-26 22:21:32 +05:00
Edly
065397496c Merge remote-tracking branch 'origin/release' 2025-05-20 12:30:16 +00:00
Danyal Faheem
5d30333587
test: verify python package distribution build when running make test (#65)
* test: python package distribution build when running make test
Pushing to pypi would occasionally fail because of breaking distribution build.
We verify the build in the github CI now so that we can mitigate those errors later on.
2025-05-20 17:29:13 +05:00
Overhang.IO
a18d74c5b6 Merge remote-tracking branch 'origin/release' 2025-04-10 06:23:38 +00:00
Overhang.IO
863babcecf Merge remote-tracking branch 'origin/release' 2025-04-10 06:10:55 +00:00
Overhang.IO
0e0b7e5103 Merge remote-tracking branch 'origin/release' 2025-04-08 14:21:17 +00:00
Overhang.IO
41a4b119d1 Merge remote-tracking branch 'origin/release' 2025-04-08 07:03:08 +00:00
Overhang.IO
ce8fd488aa Merge remote-tracking branch 'origin/release' 2025-04-03 07:45:35 +00:00
Overhang.IO
50277142c7 Merge remote-tracking branch 'origin/release' 2025-04-03 07:42:01 +00:00
Danyal Faheem
acd14969de
fix: lms.startup -> django.setup in import courses script (#60)
lms.startup has been removed as of https://github.com/openedx/edx-platform/pull/36302
Therefore, we move to the original django.setup now
2025-03-26 17:00:37 +05:00
15 changed files with 68 additions and 37 deletions

View File

@ -18,5 +18,5 @@ def load_about() -> dict[str, str]:
with open(
os.path.join(HERE, "tutorcairn", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about) # pylint: disable=exec-used
exec(f.read(), about)
return about

View File

@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes:
<!-- scriv-insert-here -->
<a id='changelog-20.0.0'></a>
## v20.0.0 (2025-06-05)
- [Improvement] Test python package distribution build when running make test. (by @Danyal-Faheem)
- 💥[Feature] Upgrade to teak. (by @Danyal-Faheem)
<a id='changelog-19.0.4'></a>
## v19.0.4 (2025-04-10)

View File

@ -1,25 +1,30 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutorcairn
BLACK_OPTS = --exclude templates ${SRC_DIRS}
# Warning: These checks are not necessarily run on every PR.
test: test-lint test-types test-format # Run some static checks.
test: test-lint test-format test-types test-pythonpackage # Run some static checks.
test-format: ## Run code formatting tests
black --check --diff $(BLACK_OPTS)
ruff format --check --diff ${SRC_DIRS}
test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
ruff check ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
format: ## Format code automatically
black $(BLACK_OPTS)
build-pythonpackage: ## Build the "tutor-cairn" python package for upload to pypi
python -m build --sdist
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_cairn-$(shell make version).tar.gz
format: ## Format code
ruff format ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry.
scriv create
@ -27,6 +32,9 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-cairn version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorcairn", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -262,7 +262,7 @@ Then apply changes with::
Troubleshooting
---------------
This Tutor plugin is maintained by Danyal Faheem from `Edly <https://edly.io>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ section from the Tutor documentation.
This Tutor plugin is maintained by Eemaan Amir from `Edly <https://edly.io>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ section from the Tutor documentation.
License
-------

View File

@ -0,0 +1 @@
- [Improvement] Migrate from pylint and black to ruff. (by @Danyal-Faheem)

View File

@ -8,7 +8,7 @@ authors = [
{name = "Edly"}, {email = "hello@edly.io"},
]
maintainers = [
{name = "Danyal Faheem"}, {email = "danyal.faheem@arbisoft.com"}
{name = "Eemaan Amir"}, {email = "eemaan.amir@arbisoft.com"}
]
description = "Scalable, real-time analytics for Open edX"
readme = {file = "README.rst", content-type = "text/x-rst"}
@ -25,16 +25,15 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tutor>=19.0.0,<20.0.0",
"tutor>=20.0.0,<21.0.0",
]
# these fields will be set by hatch_build.py
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=19.0.0,<20.0.0",
"pylint",
"black"
"tutor[dev]>=20.0.0,<21.0.0",
"ruff",
]
[project.entry-points."tutor.plugin.v1"]
@ -65,3 +64,19 @@ exclude = ["tests*"]
[tool.hatch.build.targets.wheel]
packages = ["tutorcairn"]
[tool.ruff]
exclude = ["templates", "docs/_ext"]
[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]
# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]
[tool.ruff.format]

View File

@ -1 +1 @@
__version__ = "19.0.4"
__version__ = "20.0.0"

View File

@ -130,9 +130,9 @@ spec:
app.kubernetes.io/name: cairn-clickhouse
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
fsGroup: {{ APP_USER_ID }}
fsGroupChangePolicy: "OnRootMismatch"
containers:
- name: cairn-clickhouse
@ -183,8 +183,8 @@ spec:
app.kubernetes.io/name: cairn-superset
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: cairn-superset
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
@ -227,8 +227,8 @@ spec:
app.kubernetes.io/name: cairn-superset-worker
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: cairn-superset-worker
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
@ -261,8 +261,8 @@ spec:
app.kubernetes.io/name: cairn-superset-worker-beat
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: cairn-superset-worker-beat
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}

View File

@ -10,8 +10,8 @@ spec:
spec:
restartPolicy: Never
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: cairn-clickhouse
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}

View File

@ -1,6 +1,6 @@
cairn-clickhouse-job:
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}
user: "1000:1000"
user: "{{ APP_USER_ID }}:{{ APP_USER_ID }}"
depends_on: {{ [("cairn-clickhouse", CAIRN_RUN_CLICKHOUSE)]|list_if }}
volumes:
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro

View File

@ -1,2 +1,2 @@
{% if CAIRN_RUN_CLICKHOUSE %}setowner 1000 /data/cairn-clickhouse{% endif %}
{% if CAIRN_RUN_CLICKHOUSE %}setowner {{ APP_USER_ID }} /data/cairn-clickhouse{% endif %}
{% if CAIRN_RUN_POSTGRESQL %}setowner 70 /data/cairn-postgresql{% endif %}

View File

@ -19,7 +19,7 @@ cairn-clickhouse:
- ../../data/cairn/clickhouse:/var/lib/clickhouse
- ../plugins/cairn/apps/clickhouse/users.d/cairn.xml:/etc/clickhouse-server/users.d/cairn.xml:ro
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro
user: "1000:1000"
user: "{{ APP_USER_ID }}:{{ APP_USER_ID }}"
environment:
CLICKHOUSE_DO_NOT_CHOWN: "1"
ulimits:

View File

@ -25,7 +25,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
"HOST": "data.{{ LMS_HOST }}",
# Clickhouse
"RUN_CLICKHOUSE": True,
"CLICKHOUSE_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/cairn-clickhouse:{{ CAIRN_VERSION }}",
"CLICKHOUSE_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/cairn-clickhouse:{{ CAIRN_VERSION }}", # noqa: E501
"CLICKHOUSE_HOST": "cairn-clickhouse",
"CLICKHOUSE_HTTP_PORT": 8123,
"CLICKHOUSE_HTTP_SCHEME": "http",
@ -38,7 +38,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
"POSTGRESQL_PORT": "5432",
"POSTGRESQL_DATABASE": "superset",
"POSTGRESQL_USERNAME": "superset",
"SUPERSET_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/cairn-superset:{{ CAIRN_VERSION }}",
"SUPERSET_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/cairn-superset:{{ CAIRN_VERSION }}", # noqa: E501
"SUPERSET_LANGUAGE_CODE": "{{ LANGUAGE_CODE[:2] }}",
# SSO
"ENABLE_SSO": True,
@ -142,7 +142,7 @@ def _print_superset_host(
@click.option(
"-p",
"--password",
help="Specify password from the command line. If undefined, no password will be set. (Ignored with SSO)",
help="Specify password from the command line. If undefined, no password will be set. (Ignored with SSO)", # noqa: E501
hide_input=True,
)
@click.option(
@ -181,7 +181,7 @@ def create_user_command(
if bootstrap_dashboards:
yield (
"cairn-superset",
f"python ./superset/cairn/ctl.py bootstrap-dashboards {username} /app/bootstrap/courseoverview.json",
f"python ./superset/cairn/ctl.py bootstrap-dashboards {username} /app/bootstrap/courseoverview.json", # noqa: E501
)

View File

@ -8,9 +8,9 @@ import requests
# https://mysqlclient.readthedocs.io/user_guide.html#mysql-c-api-function-mapping
from MySQLdb._mysql import escape_string as sql_escape_string
import lms.startup
import django
lms.startup.run()
django.setup()
from lms.djangoapps.courseware.courses import get_course
from xmodule.modulestore.django import modulestore

View File

@ -126,7 +126,7 @@ AUTH_ROLES_SYNC_AT_LOGIN = {{ CAIRN_AUTH_ROLES_SYNC_AT_LOGIN }}
AUTH_USER_REGISTRATION = True
{% endif %}
class CeleryConfig: # pylint: disable=too-few-public-methods
class CeleryConfig:
BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks","superset.tasks.thumbnails",)
CELERYD_LOG_LEVEL = "DEBUG"