making-with-code-cli 2.1.0__py3-none-any.whl → 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ from making_with_code_cli.teach.update import update
4
4
  from making_with_code_cli.teach.status import status
5
5
  from making_with_code_cli.teach.log import log
6
6
  from making_with_code_cli.teach.patch import patch
7
- from making_with_code_cli.teach.test import test
7
+ from making_with_code_cli.teach.check import check
8
8
 
9
9
  @click.group()
10
10
  def teach():
@@ -15,4 +15,4 @@ teach.add_command(update)
15
15
  teach.add_command(status)
16
16
  teach.add_command(log)
17
17
  teach.add_command(patch)
18
- teach.add_command(test)
18
+ teach.add_command(check)
@@ -0,0 +1,31 @@
1
+ import click
2
+ import requests
3
+ from pathlib import Path
4
+ from tqdm import tqdm
5
+ from making_with_code_cli.curriculum import get_curriculum
6
+ from making_with_code_cli.teach.check.check_module import TestMWCModule
7
+
8
+ @click.command()
9
+ @click.argument("url")
10
+ @click.argument("course_name")
11
+ @click.argument("repo_dir", type=click.Path(exists=True, file_okay=False, writable=True,
12
+ path_type=Path))
13
+ def check(url, course_name, repo_dir):
14
+ "Test MWC curriuclum and modules"
15
+ curriculum = get_curriculum(url, course_name)
16
+ test_cases = []
17
+ for unit in curriculum['units']:
18
+ for module in unit['modules']:
19
+ full_slug = '/'.join([curriculum['slug'], unit['slug'], module['slug']])
20
+ path = repo_dir / full_slug
21
+ test_cases.append((module, path, full_slug))
22
+ results = []
23
+ for mod, path, slug in tqdm(test_cases):
24
+ test = TestMWCModule(module, path)
25
+ errors = test.run()
26
+ if errors:
27
+ results.append((slug, errors))
28
+ for slug, errors in results:
29
+ print(slug)
30
+ for error in errors:
31
+ print(f" - {error}")
@@ -0,0 +1,71 @@
1
+ # test_module.py
2
+ # --------------
3
+ # Defines a test case for a MWC module.
4
+
5
+ from pathlib import Path
6
+ import requests
7
+ import toml
8
+ from git import Repo, InvalidGitRepositoryError, GitCommandError
9
+
10
+ DEFAULT_BRANCH_NAME = "main"
11
+ PYTHON_VERSION = "^3.10"
12
+
13
+ class TestCouldNotContinue(Exception):
14
+ pass
15
+
16
+ class TestMWCModule:
17
+
18
+ def __init__(self, module_metadata, repo_path):
19
+ self.module_metadata = module_metadata
20
+ self.repo_path = repo_path
21
+
22
+ def run(self):
23
+ self.errors = []
24
+ try:
25
+ self.fetch_repo()
26
+ self.test_curriculum_page_exists()
27
+ self.test_has_commit_template()
28
+ self.test_module_metadata()
29
+ except TestCouldNotContinue as err:
30
+ self.errors.append(str(err))
31
+ return self.errors
32
+
33
+ def fetch_repo(self):
34
+ """Ensures the repo is present and up to date.
35
+ """
36
+ if self.repo_path.exists():
37
+ try:
38
+ repo = Repo(self.repo_path)
39
+ repo.remotes.origin.pull()
40
+ except InvalidGitRepositoryError:
41
+ raise TestCouldNotContinue(f"{self.module_path} exists but is not a repo")
42
+ else:
43
+ try:
44
+ repo = Repo.clone_from(self.module_metadata['repo_url'], self.repo_path)
45
+ except GitCommandError:
46
+ raise TestCouldNotContinue("Could not clone repo")
47
+ if not repo.active_branch.name == DEFAULT_BRANCH_NAME:
48
+ self.errors.append(f"Default branch is not '{DEFAULT_BRANCH_NAME}'")
49
+
50
+ def test_curriculum_page_exists(self):
51
+ page_url = self.module_metadata['url']
52
+ response = requests.get(page_url)
53
+ if not response.ok:
54
+ self.errors.append(f"Curriculum page missing: {page_url}")
55
+
56
+ def test_has_commit_template(self):
57
+ ct = self.repo_path / ".commit_template"
58
+ if not ct.exists:
59
+ self.errors.append(".commit_template is missing")
60
+
61
+ def test_module_metadata(self):
62
+ md_file = self.repo_path/"pyproject.toml"
63
+ if not md_file.exists():
64
+ self.errors.append(f"pyproject.toml missing")
65
+ return
66
+ md = toml.load(md_file)
67
+ pyversion = md["tool"]["poetry"]["dependencies"]["python"]
68
+ if not pyversion == PYTHON_VERSION:
69
+ self.errors.append(f"python version is {pyversion}, expected {PYTHON_VERSION}")
70
+ if "dev-dependencies" in md["tool"]["poetry"]:
71
+ self.errors.append("pyproject.toml has deprecated tool.poetry.dev-dependencies")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: making-with-code-cli
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Courseware for Making With Code
5
5
  Home-page: https://github.com/cproctor/making-with-code-courseware
6
6
  License: MIT
@@ -11,6 +11,8 @@ Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
14
16
  Requires-Dist: PyYAML (>=6.0,<7.0)
15
17
  Requires-Dist: click (>=8.0.3,<9.0.0)
16
18
  Requires-Dist: dateparser (>=1.1.8,<2.0.0)
@@ -18,6 +20,7 @@ Requires-Dist: gitpython (>=3.1.32,<4.0.0)
18
20
  Requires-Dist: requests (>=2.27.1,<3.0.0)
19
21
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
20
22
  Requires-Dist: toml (>=0.10.2,<0.11.0)
23
+ Requires-Dist: tqdm (>=4.67.1,<5.0.0)
21
24
  Project-URL: issues, https://github.com/cproctor/making-with-code-courseware/issues
22
25
  Description-Content-Type: text/markdown
23
26
 
@@ -12,9 +12,10 @@ making_with_code_cli/setup/__init__.py,sha256=aSVNO769ML-C3QphiAPzXWOKa3sf5ELd6P
12
12
  making_with_code_cli/setup/tasks.py,sha256=7MpWZuSw311yjb13wf6oCjoa3oJr-BSbDj-jkWs6dAY,15771
13
13
  making_with_code_cli/styles.py,sha256=ZKbs-Grq1aF3wV8scwQxMO1UjnphuIccdNzksLxAo_A,910
14
14
  making_with_code_cli/submit.py,sha256=gWnueoyvZVdJdSLxOBSS0Qvx_8OdQB5VonQ1p7hjYSA,1207
15
- making_with_code_cli/teach/__init__.py,sha256=-k77b1m68uV0PkAcya6R74ouSfGCD2r9FaP4cyDAr9o,524
15
+ making_with_code_cli/teach/__init__.py,sha256=KBunSACqLyJsy-n6QFlslYrmz7tbPSXy4hlUX73ICTY,527
16
16
  making_with_code_cli/teach/assess.py,sha256=2--XhfMRsyMoEaP7EAeRD4uk5tynB3wLE3KE5pdYC30,1625
17
- making_with_code_cli/teach/check.py,sha256=0jhzZGBBoenfVbBo-P-7aoy0VG3DFO1XXOJ6HeWdDow,1280
17
+ making_with_code_cli/teach/check/__init__.py,sha256=IOZDRkl4jcZ194zneDPGvzVNmsQDUlCSNQYVB-pBVd4,1109
18
+ making_with_code_cli/teach/check/check_module.py,sha256=fFBJxUCN7hMiquyeF_jepy-46RWM0el5UrD2XlSI2mY,2515
18
19
  making_with_code_cli/teach/gitea_api/api.py,sha256=ofT0Uyo-rIaSYcPxVsPvs81UPSLW66kBIg7ZoIL2ojY,2600
19
20
  making_with_code_cli/teach/gitea_api/exceptions.py,sha256=VPXU8dArT52RucCS5o5aUZ3vhNsyGvBb8ket2WYNL7k,313
20
21
  making_with_code_cli/teach/log.py,sha256=dVq4ba1Fdz96fCB4luMsIJaW5370olBm-iSemwfrdXo,3229
@@ -23,12 +24,10 @@ making_with_code_cli/teach/setup.py,sha256=rgIxinzpy-BgcY3TiTUoN2cMhodheT_W5OOrB
23
24
  making_with_code_cli/teach/status.py,sha256=NesolWoP8jYmY_MOpn_byi1NveuhpBukJoAEmgrGKiY,4205
24
25
  making_with_code_cli/teach/student_repo_functions.py,sha256=yD4gvPT0UPuTmwvq2gjrMTvnij1lnF9xFQoB05wtSGo,3129
25
26
  making_with_code_cli/teach/student_repos.py,sha256=RNSrH54VP4uEnUDfxmgZ-UiRaaghpcIn6Ltkf0HlDXU,2547
26
- making_with_code_cli/teach/test/__init__.py,sha256=7lFl3AU6XGLZefyOaAY2wK0i50uNlDafTGQOB-XQEXs,298
27
- making_with_code_cli/teach/test/test_module.py,sha256=qLCqC8RCb0p_hDTholfp-PgnPAXE84UZLKewCMBEyjU,202
28
27
  making_with_code_cli/teach/update.py,sha256=nvEiaTxc57F9bFlOtwdz-jhDk00tk1Az4GvKuqPbpJs,1850
29
28
  making_with_code_cli/update/__init__.py,sha256=ZJJolyJL4x7li-HUYiA_HYvvwQ59SDMVUPMPRN1xun4,2613
30
29
  making_with_code_cli/version.py,sha256=4t7TOR5OlBrLFy7jrtS_d6FtIReco1NDdVPQoCb6Jx8,286
31
- making_with_code_cli-2.1.0.dist-info/METADATA,sha256=WW8lQQMDZMnYjqLCGGmTielXbp71AYGblg90yYtjo9w,2224
32
- making_with_code_cli-2.1.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
33
- making_with_code_cli-2.1.0.dist-info/entry_points.txt,sha256=XnS9X6fVIRhBnRwWh7cSi4AKG5rDUqVGeH9EPKKNdVg,52
34
- making_with_code_cli-2.1.0.dist-info/RECORD,,
30
+ making_with_code_cli-2.2.0.dist-info/METADATA,sha256=qmpjWPH_fzDFXaD2pWhubmaio6mFcLmzwo-sl_pRrKA,2364
31
+ making_with_code_cli-2.2.0.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
32
+ making_with_code_cli-2.2.0.dist-info/entry_points.txt,sha256=XnS9X6fVIRhBnRwWh7cSi4AKG5rDUqVGeH9EPKKNdVg,52
33
+ making_with_code_cli-2.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.5.1
2
+ Generator: poetry-core 2.0.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,25 +0,0 @@
1
- # Checks setup of
2
-
3
- # - Curriculum
4
- # - Check out each template directory
5
- # - Main branch?
6
- # - Has .commit_template?
7
- # - Is template?
8
-
9
- class MWCModuleTests:
10
-
11
- {'teacher_groups': [{'code': 'lai676',
12
- 'course_name': 'Making With Code I',
13
- 'curriculum_site_url': 'https://makingwithcode.org',
14
- 'group_name': 'LAI 676 Summer 2023',
15
- 'student_tokens': {'cchung': 'b6f7bbeb34a076c1da7c6a58c9d41e1c1faecb9e',
16
- 'finn': '320abfad1c97c78a274a66d1f7cbd651151d7f7d',
17
- 'jtoombs': 'aae00b2af1722517efadd5cfc58156696de9626c',
18
- 'kodell-hamilton': '66054d1f27ff7b793c3d19b96a1e207105938149',
19
- 'lcooper': '31d0d64ecb7182eef437fd33f8eeb7e45f4c32ad',
20
- 'mgunsolus': '1f9549e36f44fc710bac82153d972e41b0df2b0f',
21
- 'mhall': '8dbab4a23a988bbfab71ff96ee673a03224f90ac',
22
- 'pwick': '3e28563be3eba4e9fcd8e9d8ce5abb494fe27d94',
23
- 'test_user_lai676': '87bbf8e278b6fa5ead76467810f8e48d93b1b46e',
24
- 'tnaber': '00456bd8df3e513e787d113df8992d5c66475c3f'}}],
25
- 'username': 'chris'}
@@ -1,14 +0,0 @@
1
- import click
2
- from making_with_code_cli.teach.test.test_module import TestMWCModule
3
-
4
- @click.command()
5
- def test():
6
- "Test MWC curriuclum and modules"
7
-
8
- """
9
- """
10
- # - Curriculum
11
- # - Check out each template directory
12
- # - Main branch?
13
- # - Has .commit_template?
14
- # - Is template?
@@ -1,9 +0,0 @@
1
- # test_module.py
2
- # --------------
3
- # Defines a testcase for a MWC module.
4
-
5
- from unittest import TestCase
6
-
7
- class TestMWCModule:
8
- def __init__(self, module_path):
9
- self.module_path = module_path