course-setup 3.0.6__tar.gz → 3.0.7__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.
- {course_setup-3.0.6 → course_setup-3.0.7}/PKG-INFO +5 -1
- {course_setup-3.0.6 → course_setup-3.0.7}/README.md +4 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/pyproject.toml +1 -1
- course_setup-3.0.7/src/setup_course_github/.DS_Store +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/retire_course.py +32 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/unretire_course.py +7 -1
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/.claude/settings.local.json +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/__init__.py +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/archive_course.py +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/config.py +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/generic/.gitignore +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/generic/.ipynb_checkpoints/Course notebook-checkpoint.ipynb +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/generic/Course notebook.ipynb +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/generic/README.md +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/init_config.py +0 -0
- {course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/setup_course.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: course-setup
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.7
|
|
4
4
|
Summary: CLI tools for setting up and retiring GitHub-backed course repositories
|
|
5
5
|
Author: Reuven Lerner
|
|
6
6
|
Author-email: Reuven Lerner <reuven@lerner.co.il>
|
|
@@ -177,6 +177,10 @@ retire-course ./Acme-2026-03 ./Beta-2026-03 ./Gamma-2026-02
|
|
|
177
177
|
|
|
178
178
|
If any directory fails, the rest are still processed and errors are reported at the end.
|
|
179
179
|
|
|
180
|
+
> **Tip:** run `retire-course` from the *parent* of the course directory, not
|
|
181
|
+
> from inside it. If you're already inside, the command detects it and tells
|
|
182
|
+
> you to `cd ..` rather than failing with a confusing error.
|
|
183
|
+
|
|
180
184
|
### `archive-course` — Create a zip archive of a course
|
|
181
185
|
|
|
182
186
|
```bash
|
|
@@ -157,6 +157,10 @@ retire-course ./Acme-2026-03 ./Beta-2026-03 ./Gamma-2026-02
|
|
|
157
157
|
|
|
158
158
|
If any directory fails, the rest are still processed and errors are reported at the end.
|
|
159
159
|
|
|
160
|
+
> **Tip:** run `retire-course` from the *parent* of the course directory, not
|
|
161
|
+
> from inside it. If you're already inside, the command detects it and tells
|
|
162
|
+
> you to `cd ..` rather than failing with a confusing error.
|
|
163
|
+
|
|
160
164
|
### `archive-course` — Create a zip archive of a course
|
|
161
165
|
|
|
162
166
|
```bash
|
|
Binary file
|
|
@@ -14,6 +14,36 @@ from setup_course_github import __author__, __email__, __version__, get_github
|
|
|
14
14
|
from setup_course_github.config import load_config
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
class InsideCourseDirectoryError(RuntimeError):
|
|
18
|
+
"""Raised when a command is run from inside the course directory it targets."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _check_not_inside_course(dirname: str) -> None:
|
|
22
|
+
"""Raise InsideCourseDirectoryError if the user is inside *dirname*.
|
|
23
|
+
|
|
24
|
+
Two cases are detected:
|
|
25
|
+
1. *dirname* resolves to the current working directory (e.g. ``.`` or
|
|
26
|
+
the absolute path of cwd).
|
|
27
|
+
2. *dirname* does not exist relative to cwd, but its basename matches
|
|
28
|
+
cwd's basename — the user has cd'd into the directory and then
|
|
29
|
+
passed its bare name on the command line.
|
|
30
|
+
"""
|
|
31
|
+
cwd = Path.cwd().resolve()
|
|
32
|
+
target = Path(dirname)
|
|
33
|
+
|
|
34
|
+
inside = False
|
|
35
|
+
if target.exists() and target.resolve() == cwd:
|
|
36
|
+
inside = True
|
|
37
|
+
elif not target.exists() and target.name == cwd.name:
|
|
38
|
+
inside = True
|
|
39
|
+
|
|
40
|
+
if inside:
|
|
41
|
+
raise InsideCourseDirectoryError(
|
|
42
|
+
f"You appear to be inside '{dirname}'. "
|
|
43
|
+
"Move up one directory (cd ..) and run the command again."
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
17
47
|
def get_remote_url(dirname: str) -> str:
|
|
18
48
|
"""Return the git remote.origin.url for the repo in dirname."""
|
|
19
49
|
result = subprocess.run(
|
|
@@ -126,6 +156,8 @@ def _build_retirement_summary(
|
|
|
126
156
|
|
|
127
157
|
def retire_course(dirname: str, keep_public: bool = False) -> None:
|
|
128
158
|
"""Move the local directory to the archive, optionally making the repo private."""
|
|
159
|
+
_check_not_inside_course(dirname)
|
|
160
|
+
|
|
129
161
|
config = load_config()
|
|
130
162
|
|
|
131
163
|
remote_url = get_remote_url(dirname)
|
|
@@ -6,11 +6,17 @@ import sys
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
8
|
from setup_course_github import __author__, __email__, __version__, get_github
|
|
9
|
-
from setup_course_github.retire_course import
|
|
9
|
+
from setup_course_github.retire_course import (
|
|
10
|
+
_check_not_inside_course,
|
|
11
|
+
get_remote_url,
|
|
12
|
+
parse_repo_name,
|
|
13
|
+
)
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
def unretire_course(dirname: str) -> None:
|
|
13
17
|
"""Make the repo public again and move the directory to cwd."""
|
|
18
|
+
_check_not_inside_course(dirname)
|
|
19
|
+
|
|
14
20
|
remote_url = get_remote_url(dirname)
|
|
15
21
|
repo_name = parse_repo_name(remote_url)
|
|
16
22
|
|
{course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/.claude/settings.local.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{course_setup-3.0.6 → course_setup-3.0.7}/src/setup_course_github/generic/Course notebook.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|