Compare commits
6 Commits
dsheraz/fi
...
release
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9867471a4 | ||
|
|
95fe3e3cc3 | ||
|
|
bc96768c69 | ||
|
|
66f81d0848 | ||
|
|
802657547d | ||
|
|
ad272f0cea |
@ -18,5 +18,5 @@ def load_about() -> dict[str, str]:
|
||||
with open(
|
||||
os.path.join(HERE, "tutorcredentials", "__about__.py"), "rt", encoding="utf-8"
|
||||
) as f:
|
||||
exec(f.read(), about) # pylint: disable=exec-used
|
||||
exec(f.read(), about)
|
||||
return about
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@ -19,6 +19,16 @@ 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] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @mlabeeb03)
|
||||
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
|
||||
|
||||
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
|
||||
|
||||
- 💥[Feature] Upgrade to Teak. (by @mlabeeb03)
|
||||
|
||||
<a id='changelog-19.0.0'></a>
|
||||
## v19.0.0 (2024-10-23)
|
||||
|
||||
|
||||
24
Makefile
24
Makefile
@ -1,25 +1,30 @@
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: docs
|
||||
SRC_DIRS = ./tutorcredentials
|
||||
BLACK_OPTS = --exclude templates ${SRC_DIRS}
|
||||
|
||||
# Warning: These checks are run on every PR.
|
||||
test: test-lint test-types test-format # Run some static checks.
|
||||
test: test-lint test-types test-format 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-credentials" 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_credentials-$(shell make version).tar.gz
|
||||
|
||||
format: ## Format code automatically.
|
||||
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-credentials version
|
||||
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorcredentials", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
|
||||
|
||||
ESCAPE =
|
||||
help: ## Print this help.
|
||||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
- [Improvement] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @mlabeeb03)
|
||||
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
|
||||
@ -0,0 +1,2 @@
|
||||
- [Improvement] Migrate from pylint and black to ruff. (by @mlabeeb03)
|
||||
- [Improvement] Test python package distribution build when running make test. (by @mlabeeb03)
|
||||
2
changelog.d/fix-mysql-concat.md
Normal file
2
changelog.d/fix-mysql-concat.md
Normal file
@ -0,0 +1,2 @@
|
||||
- [Bugfix] Fixed an issue when syncing `credentials.core_user` to `openedx.auth_user` where the `full_name` field population failed with `ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'FirstName'`.
|
||||
MySQL does not support string concatenation with `+`, so it was incorrectly treated as a numeric operation. Updated to use `CONCAT()` for proper string concatenation.
|
||||
@ -27,18 +27,17 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"tutor>=19.0.0,<20.0.0",
|
||||
"tutor-discovery>=19.0.0,<20.0.0",
|
||||
"tutor-mfe>=19.0.0,<20.0.0"
|
||||
"tutor>=20.0.0,<21.0.0",
|
||||
"tutor-discovery>=20.0.0,<21.0.0",
|
||||
"tutor-mfe>=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"]
|
||||
@ -64,8 +63,24 @@ build-backend = "hatchling.build"
|
||||
[tool.hatch.build.targets.sdist]
|
||||
# Disable strict naming, otherwise twine is not able to detect name/version
|
||||
strict-naming = false
|
||||
include = [ "/tutorcredentials"]
|
||||
include = [ "/tutorcredentials", '.hatch_build.py']
|
||||
exclude = ["tests*"]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["tutorcredentials"]
|
||||
|
||||
[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]
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__ = "19.0.0"
|
||||
__version__ = "20.0.0"
|
||||
|
||||
@ -15,8 +15,8 @@ spec:
|
||||
app.kubernetes.io/name: credentials
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
runAsUser: {{ APP_USER_ID }}
|
||||
runAsGroup: {{ APP_USER_ID }}
|
||||
containers:
|
||||
- name: credentials
|
||||
image: {{ CREDENTIALS_DOCKER_IMAGE }}
|
||||
|
||||
@ -5,10 +5,9 @@ import typing as t
|
||||
from glob import glob
|
||||
|
||||
import importlib_resources
|
||||
from tutormfe.hooks import MFE_APPS, MFE_ATTRS_TYPE
|
||||
|
||||
from tutor import hooks as tutor_hooks
|
||||
from tutor.__about__ import __version_suffix__
|
||||
from tutormfe.hooks import MFE_APPS, MFE_ATTRS_TYPE
|
||||
|
||||
from .__about__ import __version__
|
||||
|
||||
@ -25,7 +24,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
|
||||
"defaults": {
|
||||
"VERSION": __version__,
|
||||
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "{{ CREDENTIALS_OAUTH2_KEY }}",
|
||||
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}",
|
||||
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}", # noqa: E501
|
||||
"EXTRA_PIP_REQUIREMENTS": [],
|
||||
"HOST": "credentials.{{ LMS_HOST }}",
|
||||
"MYSQL_DATABASE": "credentials",
|
||||
|
||||
@ -70,7 +70,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
|
||||
# https://pypi.org/project/setuptools/
|
||||
# https://pypi.org/project/pip/
|
||||
# https://pypi.org/project/wheel/
|
||||
setuptools==75.1.0 pip==24.2 wheel==0.44.0
|
||||
setuptools==77.0.3 pip==25.0.1 wheel==0.45.1
|
||||
|
||||
# Install base requirements
|
||||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements/production.txt
|
||||
@ -80,7 +80,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
|
||||
# Use redis as a django cache https://pypi.org/project/django-redis/
|
||||
django-redis==5.4.0 \
|
||||
# uwsgi server https://pypi.org/project/uWSGI/
|
||||
uwsgi==2.0.27
|
||||
uwsgi==2.0.28
|
||||
|
||||
{{ patch("credentials-dockerfile-post-python-requirements") }}
|
||||
|
||||
@ -111,7 +111,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
&& apt install -y libxml2 libmysqlclient-dev media-types mailcap
|
||||
|
||||
# From then on, run as unprivileged "app" user
|
||||
ARG APP_USER_ID=1000
|
||||
ARG APP_USER_ID={{ HOST_USER_ID }}
|
||||
RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
|
||||
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
|
||||
USER ${APP_USER_ID}
|
||||
|
||||
@ -11,7 +11,7 @@ INSERT {{ CREDENTIALS_MYSQL_DATABASE }}.core_user (password, last_login, is_supe
|
||||
lms_user.is_staff, \
|
||||
lms_user.is_active, \
|
||||
lms_user.date_joined, \
|
||||
CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE lms_user.first_name + ' ' + lms_user.last_name END as full_name, \
|
||||
CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE CONCAT(lms_user.first_name, ' ', lms_user.last_name) END as full_name, \
|
||||
lms_user.id as lms_user_id \
|
||||
FROM {{ OPENEDX_MYSQL_DATABASE }}.auth_user lms_user \
|
||||
LEFT JOIN {{ OPENEDX_MYSQL_DATABASE }}.auth_userprofile as lms_profile ON (lms_user.id = lms_profile.user_id) \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user