Compare commits

..

7 Commits

Author SHA1 Message Date
Florian du Garage Num
ab18396e89 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:47:30 +02:00
Syed Muhammad Dawoud Sheraz Ali
ae4e3f20ac
feat: migrate to ruff for linting and formatting checks (#50) 2025-09-24 10:30:18 +05:00
Ahmed Khalid
4fde7e355b
Merge pull request #49 from overhangio/teak 2025-06-27 17:04:20 +05:00
Syed Muhammad Dawoud Sheraz Ali
1ff9c0bd77 chore: generate changelog for v20 2025-06-05 17:50:09 +05:00
jfavellar90
3fe46bc278 feat: upgrade to teak 2025-04-04 12:44:52 -05:00
Syed Muhammad Dawoud Sheraz Ali
cde10c2f97
v19.0.2 (#48) 2025-03-12 15:17:38 +05:00
Syed Muhammad Dawoud Sheraz Ali
97aed60b38
build: Add hatch_build in sdist to fix installation issues (#47)
* build: Add hatch_build in sdist to fix installation issues
2025-03-12 15:13:12 +05:00
13 changed files with 83 additions and 34 deletions

View File

@ -17,5 +17,5 @@ class MetaDataHook(MetadataHookInterface):
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(os.path.join(HERE, "tutornotes", "__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,23 @@ 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)
- 💥[Feature] Upgrade to Teak. (by @jfavellar90)
<a id='changelog-19.0.2'></a>
## v19.0.2 (2025-03-12)
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
<a id='changelog-19.0.1'></a>
## v19.0.1 (2025-03-11)
- [Bugfix] Fix broken feature in `dev` mode, where the frontend is reporting a CORS error on loading the notes. (by @regisb)
- [Improvement] Migrate from `setup.py` (setuptools) to `pyproject.toml` (hatch). (by @jfavellar90)
<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-10-24)

View File

@ -1,22 +1,31 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutornotes
BLACK_OPTS = --exclude templates ${SRC_DIRS}
RUFF_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
test-format: ## Run code formatting tests.
black --check --diff $(BLACK_OPTS)
ruff format --check --diff $(RUFF_OPTS)
test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
test-lint:
ruff check ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
build-pythonpackage:
python -m build --sdist
test-pythonpackage: build-pythonpackage
twine check dist/tutor_notes-$(shell make version).tar.gz
format: ## Format code automatically.
black $(BLACK_OPTS)
ruff format $(RUFF_OPTS)
fix-lint: ## Fix linting issues automatically.
ruff check --fix $(RUFF_OPTS)
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}
@ -27,6 +36,9 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-notes version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutornotes", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help.
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -1 +0,0 @@
- [Bugfix] Fix broken feature in `dev` mode, where the frontend is reporting a CORS error on loading the notes. (by @regisb)

View File

@ -1 +0,0 @@
- [Improvement] Migrate from `setup.py` (setuptools) to `pyproject.toml` (hatch). (by @jfavellar90)

View File

@ -1 +0,0 @@
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)

View File

@ -0,0 +1,2 @@
- [Improvement] Migrate from pylint and black to ruff. (by @dawoudsheraz)
- [Improvement] Test python package distribution build when running make-test. (by @dawoudsheraz)

View File

@ -27,7 +27,7 @@ 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
@ -35,9 +35,8 @@ dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=19.0.0,<20.0.0",
"black",
"pylint"
"tutor[dev]>=20.0.0,<21.0.0",
"ruff"
]
@ -69,3 +68,20 @@ exclude = ["tests*"]
[project.entry-points."tutor.plugin.v1"]
notes = "tutornotes.plugin"
[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]
# Default config is automatically taken from https://docs.astral.sh/ruff/configuration/

View File

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

View File

@ -15,8 +15,8 @@ spec:
app.kubernetes.io/name: notes
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: notes
image: {{ NOTES_DOCKER_IMAGE }}

View File

@ -1 +1 @@
setowner 1000 /mounts/notes
setowner {{ APP_USER_ID }} /mounts/notes

View File

@ -17,7 +17,7 @@ if __version_suffix__:
config = {
"defaults": {
"VERSION": __version__,
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-notes:{{ NOTES_VERSION }}",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-notes:{{ NOTES_VERSION }}", # noqa: E501
"HOST": "notes.{{ LMS_HOST }}",
"MYSQL_DATABASE": "notes",
"MYSQL_USERNAME": "notes",

View File

@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.4
# syntax=docker/dockerfile:1
FROM docker.io/ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
@ -7,21 +7,21 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN userdel -r ubuntu
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt upgrade -y && \
apt install -y \
language-pack-en \
git \
python3 \
python3-pip \
python3-venv \
libmysqlclient-dev \
pkg-config
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt upgrade -y && \
apt install -y \
language-pack-en \
git \
python3 \
python3-pip \
python3-venv \
libmysqlclient-dev \
pkg-config
RUN ln -s /usr/bin/python3 /usr/bin/python
###### Git-clone Notes repo ######
ARG APP_USER_ID=1000
ARG APP_USER_ID={{ HOST_USER_ID }}
RUN useradd --home-dir /app --create-home --shell /bin/bash --uid ${APP_USER_ID} app
USER ${APP_USER_ID}
@ -34,8 +34,13 @@ ENV PATH=/app/venv/bin:${PATH}
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
RUN --mount=type=cache,target=/app/.cache/pip,sharing=shared pip install setuptools==75.2.0 pip==24.2 wheel==0.44.0
RUN --mount=type=cache,target=/app/.cache/pip,sharing=shared pip install setuptools==78.1.0 pip==25.0.1 wheel==0.46.0
RUN --mount=type=cache,target=/app/.cache/pip,sharing=shared pip install -r requirements/base.txt
EXPOSE 8000
CMD gunicorn --workers=2 --name notes --bind=0.0.0.0:8000 --max-requests=1000 notesserver.wsgi:application
CMD ["gunicorn", \
"--workers=2", \
"--name", "notes", \
"--bind=0.0.0.0:8000", \
"--max-requests=1000", \
"notesserver.wsgi:application"]