making-with-code-cli 5.0.2__tar.gz → 5.1.0__tar.gz
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.
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/PKG-INFO +1 -1
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/pyproject.toml +1 -1
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/mwc_accounts_api.py +7 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/settings.py +1 -1
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/setup/__init__.py +2 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/setup/tasks.py +36 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/section/__init__.py +4 -2
- making_with_code_cli-5.1.0/src/making_with_code_cli/teach/section/delete.py +24 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/section/edit.py +1 -1
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/README.md +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/cli.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/curriculum.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/decorators.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/errors.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/git_backend/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/git_backend/base_backend.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/git_backend/mwc_backend.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/git_wrapper.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/helpers.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/styles.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/submit.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/assess.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/check/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/check/check_module.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/gitea_api/api.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/gitea_api/exceptions.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/log.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/patch.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/section/create.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/section/show.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/setup.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/status.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/student/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/student/create.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/student/update.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/student_repo_functions.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/student_repos.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/update.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/update/__init__.py +0 -0
- {making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/version.py +0 -0
|
@@ -46,6 +46,10 @@ class MWCAccountsAPI:
|
|
|
46
46
|
response = self.put("/sections", data=params, token=token)
|
|
47
47
|
return self.handle_response(response)
|
|
48
48
|
|
|
49
|
+
def delete_section(self, token, params):
|
|
50
|
+
response = self.delete("/sections", data=params, token=token)
|
|
51
|
+
return self.handle_response(response)
|
|
52
|
+
|
|
49
53
|
def get(self, url, data=None, token=None):
|
|
50
54
|
return self.http_request("get", url, data=data, token=token)
|
|
51
55
|
|
|
@@ -55,6 +59,9 @@ class MWCAccountsAPI:
|
|
|
55
59
|
def put(self, url, data=None, token=None):
|
|
56
60
|
return self.http_request("put", url, data=data, token=token)
|
|
57
61
|
|
|
62
|
+
def delete(self, url, data=None, token=None):
|
|
63
|
+
return self.http_request("delete", url, data=data, token=token)
|
|
64
|
+
|
|
58
65
|
def http_request(self, method, url, data=None, token=None):
|
|
59
66
|
fn = getattr(requests, method)
|
|
60
67
|
headers = {"Authorization": f"Token {token}"} if token else None
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/settings.py
RENAMED
|
@@ -15,7 +15,7 @@ def get_settings_path(settings_path=None):
|
|
|
15
15
|
return Path(os.environ["MWC_CONFIG"])
|
|
16
16
|
else:
|
|
17
17
|
xdg_config_home = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
18
|
-
return xdg_config_home / "settings.toml"
|
|
18
|
+
return xdg_config_home / "mwc" / "settings.toml"
|
|
19
19
|
|
|
20
20
|
def read_settings(settings_path=None):
|
|
21
21
|
"""Reads the settings file and returns a dict.
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/setup/__init__.py
RENAMED
|
@@ -31,6 +31,7 @@ from making_with_code_cli.setup.tasks import (
|
|
|
31
31
|
choose_editor,
|
|
32
32
|
WriteMWCShellConfig,
|
|
33
33
|
SourceMWCShellConfig,
|
|
34
|
+
SuppressDirenvDiffs,
|
|
34
35
|
InstallXCode,
|
|
35
36
|
InstallDirenv,
|
|
36
37
|
InstallGit,
|
|
@@ -104,6 +105,7 @@ def setup(ctx, config, debug, git_name, git_email, mwc_accounts_url):
|
|
|
104
105
|
WriteMWCShellConfig,
|
|
105
106
|
SourceMWCShellConfig,
|
|
106
107
|
InstallXCode,
|
|
108
|
+
SuppressDirenvDiffs,
|
|
107
109
|
InstallDirenv,
|
|
108
110
|
InstallGit,
|
|
109
111
|
InstallTree,
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/setup/tasks.py
RENAMED
|
@@ -5,6 +5,7 @@ import sys
|
|
|
5
5
|
import os
|
|
6
6
|
import re
|
|
7
7
|
import platform
|
|
8
|
+
import tomlkit
|
|
8
9
|
from importlib.util import find_spec
|
|
9
10
|
from making_with_code_cli.mwc_accounts_api import MWCAccountsAPI
|
|
10
11
|
from making_with_code_cli.styles import (
|
|
@@ -287,6 +288,41 @@ class SourceMWCShellConfig(SetupTask):
|
|
|
287
288
|
fh.write(f"source {get_mwc_rc_path()}\n")
|
|
288
289
|
click.echo(info(f"Updated your shell login file ({rc_file}). You may need to close and reopen Terminal."))
|
|
289
290
|
|
|
291
|
+
class SuppressDirenvDiffs(SetupTask):
|
|
292
|
+
"Tell direnv not to pring out diffs when changing dirs"
|
|
293
|
+
description = "Write direnv config file"
|
|
294
|
+
|
|
295
|
+
def is_complete(self):
|
|
296
|
+
if self.settings.get("skip_direnv_config") == True:
|
|
297
|
+
return True
|
|
298
|
+
f = self.get_direnv_config_file()
|
|
299
|
+
if not f.exists():
|
|
300
|
+
return False
|
|
301
|
+
with open(f, 'rb') as fh:
|
|
302
|
+
direnv_conf = tomlkit.load(fh)
|
|
303
|
+
g = direnv_conf.get("global", {})
|
|
304
|
+
return g.get("hide_env_diff") == True and g.get("log_filter") == "^$"
|
|
305
|
+
|
|
306
|
+
def run_task(self):
|
|
307
|
+
f = self.get_direnv_config_file()
|
|
308
|
+
if f.exists():
|
|
309
|
+
with open(f, 'rb') as fh:
|
|
310
|
+
direnv_conf = tomlkit.load(fh)
|
|
311
|
+
else:
|
|
312
|
+
f.parent.mkdir(parents=True)
|
|
313
|
+
direnv_conf = {}
|
|
314
|
+
if 'global' not in direnv_conf:
|
|
315
|
+
direnv_conf['global'] = {}
|
|
316
|
+
direnv_conf["global"]["hide_env_diff"] = True
|
|
317
|
+
direnv_conf["global"]["log_filter"] = "^$"
|
|
318
|
+
with open(f, 'w') as fh:
|
|
319
|
+
tomlkit.dump(direnv_conf, fh)
|
|
320
|
+
|
|
321
|
+
def get_direnv_config_file(self):
|
|
322
|
+
config_home = os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")
|
|
323
|
+
return Path(config_home) / "direnv" / "direnv.toml"
|
|
324
|
+
|
|
325
|
+
|
|
290
326
|
class InstallXCode(SetupTask):
|
|
291
327
|
description = "Install XCode"
|
|
292
328
|
platform = Platform.MAC
|
|
@@ -8,8 +8,9 @@ from making_with_code_cli.styles import (
|
|
|
8
8
|
)
|
|
9
9
|
from making_with_code_cli.teach.setup import check_required_teacher_settings
|
|
10
10
|
from making_with_code_cli.teach.section.create import create_section
|
|
11
|
-
from making_with_code_cli.teach.section.edit import edit_section
|
|
12
11
|
from making_with_code_cli.teach.section.show import show_section
|
|
12
|
+
from making_with_code_cli.teach.section.edit import edit_section
|
|
13
|
+
from making_with_code_cli.teach.section.delete import delete_section
|
|
13
14
|
|
|
14
15
|
@click.group(invoke_without_command=True)
|
|
15
16
|
@click.pass_context
|
|
@@ -42,6 +43,7 @@ def summarize_sections(section_data):
|
|
|
42
43
|
return section_data
|
|
43
44
|
|
|
44
45
|
section.add_command(create_section)
|
|
45
|
-
section.add_command(edit_section)
|
|
46
46
|
section.add_command(show_section)
|
|
47
|
+
section.add_command(edit_section)
|
|
48
|
+
section.add_command(delete_section)
|
|
47
49
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from making_with_code_cli.settings import read_settings
|
|
3
|
+
from making_with_code_cli.mwc_accounts_api import MWCAccountsAPI
|
|
4
|
+
from making_with_code_cli.styles import (
|
|
5
|
+
address,
|
|
6
|
+
error,
|
|
7
|
+
info,
|
|
8
|
+
question,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
@click.command('delete')
|
|
12
|
+
@click.argument("slug")
|
|
13
|
+
@click.option("--config", help="Path to config file (default: ~/.mwc)")
|
|
14
|
+
def delete_section(slug, config):
|
|
15
|
+
"Delete a section"
|
|
16
|
+
settings = read_settings(config)
|
|
17
|
+
api = MWCAccountsAPI(settings.get('mwc_accounts_url'))
|
|
18
|
+
params = {"slug": slug}
|
|
19
|
+
try:
|
|
20
|
+
response = api.delete_section(settings.get('mwc_accounts_token'), params)
|
|
21
|
+
click.echo(info(f"Deleted section {slug}."))
|
|
22
|
+
except api.RequestFailed as err:
|
|
23
|
+
click.echo(error(f"Error deleting section {slug}."))
|
|
24
|
+
|
|
@@ -19,7 +19,7 @@ from making_with_code_cli.styles import (
|
|
|
19
19
|
@click.option("--course-name", help="MWC course name")
|
|
20
20
|
@click.option("--code", help="Code students can use to join the section")
|
|
21
21
|
@click.option("--roster", help="csv file containing student information")
|
|
22
|
-
def edit_section(
|
|
22
|
+
def edit_section(slug, config, name, curriculum_site_url, course_name, code, roster):
|
|
23
23
|
"Edit an existing section"
|
|
24
24
|
settings = read_settings(config)
|
|
25
25
|
api = MWCAccountsAPI(settings.get('mwc_accounts_url'))
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/curriculum.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/decorators.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/git_wrapper.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/helpers.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/styles.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/submit.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/__init__.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/assess.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/log.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/patch.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/setup.py
RENAMED
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/teach/update.py
RENAMED
|
File without changes
|
|
File without changes
|
{making_with_code_cli-5.0.2 → making_with_code_cli-5.1.0}/src/making_with_code_cli/version.py
RENAMED
|
File without changes
|