From 3c004bad3be8361d5af4fec5d2904ba28dea97f1 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Oct 2023 14:17:53 +0330 Subject: [PATCH 1/7] chore: changelog entry added --- changelog.d/20231004_141354_codewithemad.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/20231004_141354_codewithemad.md diff --git a/changelog.d/20231004_141354_codewithemad.md b/changelog.d/20231004_141354_codewithemad.md new file mode 100644 index 000000000..81ca4f19a --- /dev/null +++ b/changelog.d/20231004_141354_codewithemad.md @@ -0,0 +1 @@ +- [Improvement] Added Makefile and test action to repository and formatted code with Black and isort. (by @CodeWithEmad) \ No newline at end of file From 2af2f5c0bb3fc1ccdab71435532df533cb7b788d Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Oct 2023 14:18:15 +0330 Subject: [PATCH 2/7] feat: Makefile added --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..6e9bebb27 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.DEFAULT_GOAL := help +.PHONY: docs +SRC_DIRS = ./tutorindigo +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-format: ## Run code formatting tests + black --check --diff $(BLACK_OPTS) + +test-lint: ## Run code linting tests + pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${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) + +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} + +changelog-entry: ## Create a new changelog entry. + scriv create + +changelog: ## Collect changelog entries in the CHANGELOG.md file. + scriv collect + +ESCAPE =  +help: ## Print this help + @grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ + | sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \ + | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' From 731cad24d06dbdecea7cff6f92f835a33ccfb45b Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Oct 2023 14:21:45 +0330 Subject: [PATCH 3/7] chore: cleanup --- tutorindigo/__about__.py | 1 - tutorindigo/plugin.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tutorindigo/__about__.py b/tutorindigo/__about__.py index 1722f39b5..5e5e9109a 100644 --- a/tutorindigo/__about__.py +++ b/tutorindigo/__about__.py @@ -1,2 +1 @@ __version__ = "16.0.0" - diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 39e6d3acf..a94acc867 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -1,5 +1,4 @@ import pkg_resources - from tutor import hooks from tutor.__about__ import __version_suffix__ From 4ab02f406d760591f10fc182a93bed20d0d601f5 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Oct 2023 14:21:54 +0330 Subject: [PATCH 4/7] fix: typing added --- tutorindigo/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index a94acc867..d04ff6390 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -1,3 +1,5 @@ +import typing as t + import pkg_resources from tutor import hooks from tutor.__about__ import __version_suffix__ @@ -10,7 +12,7 @@ ################# Configuration -config = { +config: t.Dict[str, t.Dict[str, t.Any]] = { # Add here your new settings "defaults": { "VERSION": __version__, From 3cb48bdce24478347ac25379779edb7d00988945 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Mon, 9 Oct 2023 14:30:33 +0330 Subject: [PATCH 5/7] docs: update reference to tutor 13 There's no compatible version for tutor v13.x.x. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 46e028a21..b402b432d 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,7 @@ Installation Indigo was specially developed to be used with `Tutor `__ (at least v14.0.0). If you have not installed Open edX with Tutor, then installation instructions will vary. -Since Tutor v13.2.0, Indigo can be installed as a Tutor plugin:: +Install and enable Indigo plugin:: tutor plugins install indigo tutor plugins enable indigo From 57b8e85a30d5647656e085a52b78213b247de234 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Tue, 5 Dec 2023 16:27:42 +0330 Subject: [PATCH 6/7] feat: Including dev dependencies in extras_require --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f097cc732..d90cba1c8 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ def load_about(): include_package_data=True, python_requires=">=3.8", install_requires=["tutor>=16.0.0,<17.0.0"], + extras_require={"dev": "tutor[dev]>=16.0.0,<17.0.0"}, entry_points={"tutor.plugin.v1": ["indigo = tutorindigo.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", From 060b47d98d2ce7122db1ac367d1703023259546f Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Tue, 5 Dec 2023 16:27:57 +0330 Subject: [PATCH 7/7] ci: test action added --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..829f6137d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Run tests + +on: + pull_request: + branches: [master] + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Upgrade pip + run: python -m pip install --upgrade pip setuptools + - name: Install dependencies + run: | + pip install .[dev] + - name: Test lint, types, and format + run: make test