Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: move node_modules out of edx-platform repo #18

Closed
wants to merge 11 commits into from
11 changes: 2 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,9 @@ jobs:

##### Create release on GitHub
- name: Create or update GitHub release
# I wish there was an `--update` option to the `gh release create` command, but
# there isn't.
# https://cli.github.com/manual/gh_release_create
run: |
make release-description | tee release_description.md
export GH_ARGS="${{ github.ref_name }} --notes-file=release_description.md"
echo "gh args: '$GH_ARGS'"
${{ env.gh_bin }} release create $GH_ARGS || ${{ env.gh_bin }} release edit $GH_ARGS
run: scriv github-release
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
- name: Upload release asset to GitHub
run: |
export FILENAME="tutor-$(uname -s)_$(uname -m)"
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ instructions, because git commits are used to generate release notes:

<!-- scriv-insert-here -->

<a id='changelog-15.2.0'></a>
## v15.2.0 (2023-01-19)

- 💥[Bugfix] Fix "example.com" links in registration emails. This is a breaking change for platforms that have modified the "id" field of the LMS site object in the database. These platforms should set `SITE_ID=1` in the common settings via a plugin. (by @regisb)
- [Bugfix] Running `tutor k8s upgrade --from=maple` won't apply and won't wait for the MySQL deployment to be ready if `RUN_MYSQL: false` (When you host your MySQL somewhere else like RDS) (by @CodeWithEmad)
- [Bugfix] Fix HTML component editing in studio by cherry-picking [upstream fix](https://github.com/openedx/edx-platform/pull/31500). (by @regisb)
- [Improvement] Changes annotations from `typing` to use built-in generic types from `__future__.annotations` (by @Carlos-Muniz)
- [Improvement] Resolve `CORS_ORIGIN_WHITELIST` warnings that pollute the LMS and CMS logs. As far as we know they were not causing any issue, apart from being a nuisance. (by @regisb)

<a id='changelog-15.1.0'></a>
## v15.1.0 (2022-12-13)

Expand Down
27 changes: 10 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ format: ## Format code automatically
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}

bootstrap-dev: ## Install dev requirements
pip install .
pip install -r requirements/dev.txt
changelog-entry: ## Create a new changelog entry
scriv create

bootstrap-dev-plugins: bootstrap-dev ## Install dev requirements and all supported plugins
pip install -r requirements/plugins.txt
changelog: ## Collect changelog entries in the CHANGELOG.md file
scriv collect

###### Code coverage

Expand All @@ -78,23 +77,17 @@ coverage-html: coverage-report ## Generate HTML report for the code coverage
coverage-browse-report: coverage-html ## Open the HTML report in the browser
sensible-browser htmlcov/index.html

###### Deployment
###### Continuous integration tasks

bundle: ## Bundle the tutor package in a single "dist/tutor" executable
pyinstaller tutor.spec

bootstrap-dev: ## Install dev requirements
pip install .
pip install -r requirements/dev.txt

changelog-entry: ## Create a new changelog entry
scriv create

changelog: ## Collect changelog entries in the CHANGELOG.md file
scriv collect

release-description: ## Write the current release description to a file
@sed "s/TUTOR_VERSION/v$(shell make version)/g" docs/_release_description.md
@git log -1 --pretty=format:%b

###### Continuous integration tasks
bootstrap-dev-plugins: bootstrap-dev ## Install dev requirements and all supported plugins
pip install -r requirements/plugins.txt

pull-base-images: # Manually pull base images
docker image pull docker.io/ubuntu:20.04
Expand Down

This file was deleted.

10 changes: 10 additions & 0 deletions changelog.d/20230110_165850_kdmc_global_node_modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
Create a changelog entry for every new user-facing change. Please respect the following instructions:
- Indicate breaking changes by prepending an explosion 💥 character.
- Prefix your changes with either [Bugfix], [Improvement], [Feature], [Security], [Deprecation].
- You may optionally append "(by @<author>)" at the end of the line, where "<author>" is either one (just one)
of your GitHub username, real name or affiliated organization. These affiliations will be displayed in
the release notes for every release.
-->

- [Improvement] Remove the need to run ``npm install`` when setting up an edx-platform development environment. (by @kdmccormick)
5 changes: 3 additions & 2 deletions changelog.d/scriv.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ version = literal: tutor/__about__.py: __version__
categories =
format = md
md_header_level = 2
new_fragment_template = file: scriv/new_fragment.${config:format}.j2
entry_title_template = file: scriv/entry_title.${config:format}.j2
new_fragment_template = file: changelog.d/scriv/new_fragment.${config:format}.j2
entry_title_template = file: changelog.d/scriv/entry_title.${config:format}.j2
ghrel_template = file: changelog.d/scriv/github_release.${config:format}.j2
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Install this version from pip with:

pip install "tutor[full]==TUTOR_VERSION"
pip install "tutor[full]=={{ version }}"

Or download the compiled binaries:

sudo curl -L "https://github.com/overhangio/tutor/releases/download/TUTOR_VERSION/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
sudo curl -L "https://github.com/overhangio/tutor/releases/download/{{ version }}/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
sudo chmod 0755 /usr/local/bin/tutor

See the [installation docs](https://docs.tutor.overhang.io/install.html) for more installation options and instructions.

## Changes

{{ body }}
6 changes: 6 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
("py:class", "tutor.hooks.filters.P"),
("py:class", "tutor.hooks.filters.T"),
("py:class", "tutor.hooks.actions.P"),
("py:class", "P"),
("py:class", "P.args"),
("py:class", "P.kwargs"),
("py:class", "T"),
("py:class", "t.Any"),
("py:class", "t.Optional"),
]

# -- Sphinx-Click configuration
Expand Down
8 changes: 5 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements/base.in
#
Expand Down Expand Up @@ -62,7 +62,9 @@ six==1.16.0
tomli==2.0.1
# via mypy
typing-extensions==4.4.0
# via mypy
# via
# -r requirements/base.in
# mypy
urllib3==1.26.13
# via
# kubernetes
Expand Down
10 changes: 7 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements/dev.in
#
Expand Down Expand Up @@ -172,7 +172,7 @@ rsa==4.9
# via
# -r requirements/base.txt
# google-auth
scriv==1.0.0
scriv==1.1.0
# via -r requirements/dev.in
secretstorage==3.3.3
# via keyring
Expand Down Expand Up @@ -204,7 +204,11 @@ types-setuptools==65.6.0.2
typing-extensions==4.4.0
# via
# -r requirements/base.txt
# astroid
# black
# mypy
# pylint
# rich
urllib3==1.26.13
# via
# -r requirements/base.txt
Expand Down
8 changes: 6 additions & 2 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements/docs.in
#
Expand Down Expand Up @@ -42,6 +42,8 @@ idna==3.4
# requests
imagesize==1.4.1
# via sphinx
importlib-metadata==6.0.0
# via sphinx
jinja2==3.1.2
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -147,6 +149,8 @@ websocket-client==1.4.2
# via
# -r requirements/base.txt
# kubernetes
zipp==3.11.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
6 changes: 3 additions & 3 deletions tests/commands/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import typing as t
from __future__ import annotations

import click.testing

Expand All @@ -12,13 +12,13 @@ class TestCommandMixin:
"""

@staticmethod
def invoke(args: t.List[str]) -> click.testing.Result:
def invoke(args: list[str]) -> click.testing.Result:
with temporary_root() as root:
return TestCommandMixin.invoke_in_root(root, args)

@staticmethod
def invoke_in_root(
root: str, args: t.List[str], catch_exceptions: bool = True
root: str, args: list[str], catch_exceptions: bool = True
) -> click.testing.Result:
"""
Use this method for commands that all need to run in the same root:
Expand Down
15 changes: 7 additions & 8 deletions tests/commands/test_compose.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import typing as t
import unittest
from io import StringIO
Expand Down Expand Up @@ -62,9 +63,9 @@ def test_compose_local_tmp_generation(self, _mock_stdout: StringIO) -> None:
# Mount volumes
compose.mount_tmp_volumes(mount_args, LocalContext(""))

compose_file: t.Dict[str, t.Any] = hooks.Filters.COMPOSE_LOCAL_TMP.apply({})
actual_services: t.Dict[str, t.Any] = compose_file["services"]
expected_services: t.Dict[str, t.Any] = {
compose_file: dict[str, t.Any] = hooks.Filters.COMPOSE_LOCAL_TMP.apply({})
actual_services: dict[str, t.Any] = compose_file["services"]
expected_services: dict[str, t.Any] = {
"cms": {"volumes": ["/path/to/edx-platform:/openedx/edx-platform"]},
"cms-worker": {"volumes": ["/path/to/edx-platform:/openedx/edx-platform"]},
"lms": {
Expand All @@ -78,11 +79,9 @@ def test_compose_local_tmp_generation(self, _mock_stdout: StringIO) -> None:
}
self.assertEqual(actual_services, expected_services)

compose_jobs_file: t.Dict[
str, t.Any
] = hooks.Filters.COMPOSE_LOCAL_JOBS_TMP.apply({})
actual_jobs_services: t.Dict[str, t.Any] = compose_jobs_file["services"]
expected_jobs_services: t.Dict[str, t.Any] = {
compose_jobs_file = hooks.Filters.COMPOSE_LOCAL_JOBS_TMP.apply({})
actual_jobs_services = compose_jobs_file["services"]
expected_jobs_services: dict[str, t.Any] = {
"cms-job": {"volumes": ["/path/to/edx-platform:/openedx/edx-platform"]},
"lms-job": {"volumes": ["/path/to/edx-platform:/openedx/edx-platform"]},
}
Expand Down
5 changes: 3 additions & 2 deletions tests/hooks/test_filters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import typing as t
import unittest

Expand All @@ -23,14 +24,14 @@ def filter1(value: int) -> int:

def test_add_items(self) -> None:
@hooks.filters.add("tests:add-sheeps")
def filter1(sheeps: t.List[int]) -> t.List[int]:
def filter1(sheeps: list[int]) -> list[int]:
return sheeps + [0]

hooks.filters.add_item("tests:add-sheeps", 1)
hooks.filters.add_item("tests:add-sheeps", 2)
hooks.filters.add_items("tests:add-sheeps", [3, 4])

sheeps: t.List[int] = hooks.filters.apply("tests:add-sheeps", [])
sheeps: list[int] = hooks.filters.apply("tests:add-sheeps", [])
self.assertEqual([0, 1, 2, 3, 4], sheeps)

def test_filter_callbacks(self) -> None:
Expand Down
5 changes: 2 additions & 3 deletions tests/test_plugins_v0.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import typing as t
from unittest.mock import patch

Expand Down Expand Up @@ -197,9 +198,7 @@ def test_dict_plugin(self) -> None:
{"name": "myplugin", "config": {"set": {"KEY": "value"}}, "version": "0.1"}
)
plugins.load("myplugin")
overriden_items: t.List[
t.Tuple[str, t.Any]
] = hooks.Filters.CONFIG_OVERRIDES.apply([])
overriden_items = hooks.Filters.CONFIG_OVERRIDES.apply([])
versions = list(plugins.iter_info())
self.assertEqual("myplugin", plugin.name)
self.assertEqual([("myplugin", "0.1")], versions)
Expand Down
2 changes: 1 addition & 1 deletion tutor/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Increment this version number to trigger a new release. See
# docs/tutor.html#versioning for information on the versioning scheme.
__version__ = "15.1.0"
__version__ = "15.2.0"

# The version suffix will be appended to the actual version, separated by a
# dash. Use this suffix to differentiate between the actual released version and
Expand Down
3 changes: 2 additions & 1 deletion tutor/commands/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sys
import typing as t

Expand Down Expand Up @@ -61,7 +62,7 @@ def ensure_plugins_enabled(cls, ctx: click.Context) -> None:
hooks.Actions.PROJECT_ROOT_READY.do(ctx.params["root"])
cls.IS_ROOT_READY = True

def list_commands(self, ctx: click.Context) -> t.List[str]:
def list_commands(self, ctx: click.Context) -> list[str]:
"""
This is run in the following cases:
- shell autocompletion: tutor <tab>
Expand Down
Loading