Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a9977e454 | ||
|
|
10701f4e64 | ||
|
|
8f4a0b1d91 |
@ -18,5 +18,5 @@ def load_about() -> dict[str, str]:
|
|||||||
with open(
|
with open(
|
||||||
os.path.join(HERE, "tutorcairn", "__about__.py"), "rt", encoding="utf-8"
|
os.path.join(HERE, "tutorcairn", "__about__.py"), "rt", encoding="utf-8"
|
||||||
) as f:
|
) as f:
|
||||||
exec(f.read(), about) # pylint: disable=exec-used
|
exec(f.read(), about)
|
||||||
return about
|
return about
|
||||||
|
|||||||
15
Makefile
15
Makefile
@ -1,16 +1,15 @@
|
|||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
SRC_DIRS = ./tutorcairn
|
SRC_DIRS = ./tutorcairn
|
||||||
BLACK_OPTS = --exclude templates ${SRC_DIRS}
|
|
||||||
|
|
||||||
# Warning: These checks are not necessarily run on every PR.
|
# Warning: These checks are not necessarily run on every PR.
|
||||||
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
|
test: test-lint test-format test-types test-pythonpackage # Run some static checks.
|
||||||
|
|
||||||
test-format: ## Run code formatting tests
|
test-format: ## Run code formatting tests
|
||||||
black --check --diff $(BLACK_OPTS)
|
ruff format --check --diff ${SRC_DIRS}
|
||||||
|
|
||||||
test-lint: ## Run code linting tests
|
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.
|
test-types: ## Run type checks.
|
||||||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
||||||
@ -21,11 +20,11 @@ build-pythonpackage: ## Build the "tutor-cairn" python package for upload to pyp
|
|||||||
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
|
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
|
||||||
twine check dist/tutor_cairn-$(shell make version).tar.gz
|
twine check dist/tutor_cairn-$(shell make version).tar.gz
|
||||||
|
|
||||||
format: ## Format code automatically
|
format: ## Format code
|
||||||
black $(BLACK_OPTS)
|
ruff format ${SRC_DIRS}
|
||||||
|
|
||||||
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
|
fix-lint: ## Fix lint errors automatically
|
||||||
isort --skip=templates ${SRC_DIRS}
|
ruff check --fix ${SRC_DIRS}
|
||||||
|
|
||||||
changelog-entry: ## Create a new changelog entry.
|
changelog-entry: ## Create a new changelog entry.
|
||||||
scriv create
|
scriv create
|
||||||
|
|||||||
@ -262,7 +262,7 @@ Then apply changes with::
|
|||||||
Troubleshooting
|
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
|
License
|
||||||
-------
|
-------
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
- [Improvement] Migrate from pylint and black to ruff. (by @Danyal-Faheem)
|
||||||
@ -8,7 +8,7 @@ authors = [
|
|||||||
{name = "Edly"}, {email = "hello@edly.io"},
|
{name = "Edly"}, {email = "hello@edly.io"},
|
||||||
]
|
]
|
||||||
maintainers = [
|
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"
|
description = "Scalable, real-time analytics for Open edX"
|
||||||
readme = {file = "README.rst", content-type = "text/x-rst"}
|
readme = {file = "README.rst", content-type = "text/x-rst"}
|
||||||
@ -32,9 +32,8 @@ dynamic = ["version"]
|
|||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
"tutor[dev]>=20.0.0,<21.0.0",
|
"tutor[dev]>=20.0.0,<21.0.0",
|
||||||
"pylint",
|
"ruff",
|
||||||
"black"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.entry-points."tutor.plugin.v1"]
|
[project.entry-points."tutor.plugin.v1"]
|
||||||
@ -65,3 +64,19 @@ exclude = ["tests*"]
|
|||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["tutorcairn"]
|
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]
|
||||||
|
|||||||
@ -130,9 +130,9 @@ spec:
|
|||||||
app.kubernetes.io/name: cairn-clickhouse
|
app.kubernetes.io/name: cairn-clickhouse
|
||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1000
|
runAsUser: {{ APP_USER_ID }}
|
||||||
runAsGroup: 1000
|
runAsGroup: {{ APP_USER_ID }}
|
||||||
fsGroup: 1000
|
fsGroup: {{ APP_USER_ID }}
|
||||||
fsGroupChangePolicy: "OnRootMismatch"
|
fsGroupChangePolicy: "OnRootMismatch"
|
||||||
containers:
|
containers:
|
||||||
- name: cairn-clickhouse
|
- name: cairn-clickhouse
|
||||||
@ -183,8 +183,8 @@ spec:
|
|||||||
app.kubernetes.io/name: cairn-superset
|
app.kubernetes.io/name: cairn-superset
|
||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1000
|
runAsUser: {{ APP_USER_ID }}
|
||||||
runAsGroup: 1000
|
runAsGroup: {{ APP_USER_ID }}
|
||||||
containers:
|
containers:
|
||||||
- name: cairn-superset
|
- name: cairn-superset
|
||||||
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
||||||
@ -227,8 +227,8 @@ spec:
|
|||||||
app.kubernetes.io/name: cairn-superset-worker
|
app.kubernetes.io/name: cairn-superset-worker
|
||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1000
|
runAsUser: {{ APP_USER_ID }}
|
||||||
runAsGroup: 1000
|
runAsGroup: {{ APP_USER_ID }}
|
||||||
containers:
|
containers:
|
||||||
- name: cairn-superset-worker
|
- name: cairn-superset-worker
|
||||||
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
||||||
@ -261,8 +261,8 @@ spec:
|
|||||||
app.kubernetes.io/name: cairn-superset-worker-beat
|
app.kubernetes.io/name: cairn-superset-worker-beat
|
||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1000
|
runAsUser: {{ APP_USER_ID }}
|
||||||
runAsGroup: 1000
|
runAsGroup: {{ APP_USER_ID }}
|
||||||
containers:
|
containers:
|
||||||
- name: cairn-superset-worker-beat
|
- name: cairn-superset-worker-beat
|
||||||
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
image: {{ CAIRN_SUPERSET_DOCKER_IMAGE }}
|
||||||
|
|||||||
@ -10,8 +10,8 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1000
|
runAsUser: {{ APP_USER_ID }}
|
||||||
runAsGroup: 1000
|
runAsGroup: {{ APP_USER_ID }}
|
||||||
containers:
|
containers:
|
||||||
- name: cairn-clickhouse
|
- name: cairn-clickhouse
|
||||||
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}
|
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
cairn-clickhouse-job:
|
cairn-clickhouse-job:
|
||||||
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}
|
image: {{ CAIRN_CLICKHOUSE_DOCKER_IMAGE }}
|
||||||
user: "1000:1000"
|
user: "{{ APP_USER_ID }}:{{ APP_USER_ID }}"
|
||||||
depends_on: {{ [("cairn-clickhouse", CAIRN_RUN_CLICKHOUSE)]|list_if }}
|
depends_on: {{ [("cairn-clickhouse", CAIRN_RUN_CLICKHOUSE)]|list_if }}
|
||||||
volumes:
|
volumes:
|
||||||
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro
|
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro
|
||||||
|
|||||||
@ -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 %}
|
{% if CAIRN_RUN_POSTGRESQL %}setowner 70 /data/cairn-postgresql{% endif %}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ cairn-clickhouse:
|
|||||||
- ../../data/cairn/clickhouse:/var/lib/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/users.d/cairn.xml:/etc/clickhouse-server/users.d/cairn.xml:ro
|
||||||
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro
|
- ../plugins/cairn/apps/clickhouse/auth.json:/scripts/clickhouse-auth.json:ro
|
||||||
user: "1000:1000"
|
user: "{{ APP_USER_ID }}:{{ APP_USER_ID }}"
|
||||||
environment:
|
environment:
|
||||||
CLICKHOUSE_DO_NOT_CHOWN: "1"
|
CLICKHOUSE_DO_NOT_CHOWN: "1"
|
||||||
ulimits:
|
ulimits:
|
||||||
|
|||||||
@ -25,7 +25,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
|
|||||||
"HOST": "data.{{ LMS_HOST }}",
|
"HOST": "data.{{ LMS_HOST }}",
|
||||||
# Clickhouse
|
# Clickhouse
|
||||||
"RUN_CLICKHOUSE": True,
|
"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_HOST": "cairn-clickhouse",
|
||||||
"CLICKHOUSE_HTTP_PORT": 8123,
|
"CLICKHOUSE_HTTP_PORT": 8123,
|
||||||
"CLICKHOUSE_HTTP_SCHEME": "http",
|
"CLICKHOUSE_HTTP_SCHEME": "http",
|
||||||
@ -38,7 +38,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
|
|||||||
"POSTGRESQL_PORT": "5432",
|
"POSTGRESQL_PORT": "5432",
|
||||||
"POSTGRESQL_DATABASE": "superset",
|
"POSTGRESQL_DATABASE": "superset",
|
||||||
"POSTGRESQL_USERNAME": "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] }}",
|
"SUPERSET_LANGUAGE_CODE": "{{ LANGUAGE_CODE[:2] }}",
|
||||||
# SSO
|
# SSO
|
||||||
"ENABLE_SSO": True,
|
"ENABLE_SSO": True,
|
||||||
@ -142,7 +142,7 @@ def _print_superset_host(
|
|||||||
@click.option(
|
@click.option(
|
||||||
"-p",
|
"-p",
|
||||||
"--password",
|
"--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,
|
hide_input=True,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
@ -181,7 +181,7 @@ def create_user_command(
|
|||||||
if bootstrap_dashboards:
|
if bootstrap_dashboards:
|
||||||
yield (
|
yield (
|
||||||
"cairn-superset",
|
"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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ AUTH_ROLES_SYNC_AT_LOGIN = {{ CAIRN_AUTH_ROLES_SYNC_AT_LOGIN }}
|
|||||||
AUTH_USER_REGISTRATION = True
|
AUTH_USER_REGISTRATION = True
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
class CeleryConfig: # pylint: disable=too-few-public-methods
|
class CeleryConfig:
|
||||||
BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
|
BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
|
||||||
CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks","superset.tasks.thumbnails",)
|
CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks","superset.tasks.thumbnails",)
|
||||||
CELERYD_LOG_LEVEL = "DEBUG"
|
CELERYD_LOG_LEVEL = "DEBUG"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user