ExtractZip
Extract Slides, Exercises, Solutions, TestExams or Exams!
Installation
- Create the user
extractzipand set the access rights for the home directory.
# as user root:
adduser --disabled-password extractzip
chmod 2771 ~extractzip
- Add
extractzipgroup to admin users that want to use this tool.
# as user root:
adduser jupyter-sebastian extractzip
- Create the config directory and file and set access rights and ownership.
# as user root
mkdir /etc/extractzip
chmod 755 /etc/extractzip
touch /etc/extractzip/config.yaml
chmod 664 /etc/extractzip/config.yaml
chown extractzip:extractzip /etc/extractzip/config.yaml
- Edit the config file, where you specify the
base_path(home directory ofextractzip) and thecourses. Each course has aname(the directory inbase_path) that follows the pattern^[a-z0-9_]+$and optional entries forslides,exercises,solutions,testexamandexamwhich points to the basename of the corresponding zip file.
# as admin user with extractzip group (e.g. jupyter-sebastian)
# You can see here an course with the name 'testcourse'.
# The exam is commented out -> it can't be downloaded yet.
# /etc/extractzip/config.yaml
---
base_path: /home/extractzip
courses:
- name: testcourse
slides: Slides.zip
examples: Examples.zip
exercises: Exercises.zip
solutions: Solutions.zip
# exam: Exam.zip
testexam: Testexam.zip
- Create the corresponding directory for the configured course, copy the zip files in it and set the correct access rights.
# as admin user with extractzip group (e.g. jupyter-sebastian)
cd ~extractzip
mkdir testcourse
chmod 2751 testcourse
# copy zipfiles to new directory from <src_dir>
cp <src_dir>/{Exercises,Solutions,Exam,Testexam}.zip testcourse/.
chmod 644 testcourse/*.zip
Check config, course directory and zip files
Run the following command with the course directory to check:
CheckExtractZip testcourse
The result of the checks will be prefix with an emoji to indicate success (🤩), failure (👿) or the zipfile is not yet in the course directory (💀). The last one is not an error (see the third example below).
If everything is ok, the output should look like this (make sure that the last line reads Check complete!):
-----Course name----------------------------------
🤩 The course name 'testcourse' is well formed.
-----Check config file----------------------------
🤩 Config file loaded.
-----Check base path------------------------------
🤩 Base path is ok.
-----Check course 'testcourse' directory----------
🤩 Course path is ok.
-----Check Exercises in course 'testcourse'-------
🤩 Exercises is defined in the config.
🤩 The file Exercises.zip is ok.
🤩 The file Exercises.zip is not encrypted.
-----Check Solutions in course 'testcourse'-------
🤩 Solutions is defined in the config.
🤩 The file Solutions.zip is ok.
🤩 The file Solutions.zip is not encrypted.
-----Check Exam in course 'testcourse'------------
🤩 Exam is defined in the config.
🤩 The file Exam.zip is ok.
🤩 The file Exam.zip is encrypted.
-----Check TestExam in course 'testcourse'--------
🤩 TestExam is defined in the config.
🤩 The file Testexam.zip is ok.
🤩 The file Testexam.zip is encrypted.
--------------------------------------------------
Check complete!
If the result is not ok, the output looks something like this (make sure the last line reads Check incomplete!):
-----Course name----------------------------------
🤩 The course name 'testcourse' is well formed.
-----Check config file----------------------------
🤩 Config file loaded.
-----Check base path------------------------------
🤩 Base path is ok.
-----Check course 'testcourse' directory----------
🤩 Course path is ok.
-----Check Exercises in course 'testcourse'-------
🤩 Exercises is defined in the config.
👿 Exercises.zip mode is 444 but it should be 644
-----Check Solutions in course 'testcourse'-------
🤩 Solutions is defined in the config.
🤩 The file Solutions.zip is ok.
🤩 The file Solutions.zip is not encrypted.
-----Check Exam in course 'testcourse'------------
🤩 Exam is defined in the config.
🤩 The file Exam.zip is ok.
🤩 The file Exam.zip is encrypted.
-----Check TestExam in course 'testcourse'--------
🤩 TestExam is defined in the config.
🤩 The file Testexam.zip is ok.
🤩 The file Testexam.zip is encrypted.
--------------------------------------------------
Check incomplete!
If you see lines like the following than it means, you have not put the configured zipfile for TestExam in the course directory.
This is not an error because you could have intentionally withheld the file until it is convenient during the course:
-----Check TestExam in course 'testcourse'--------
🤩 TestExam is defined in the config.
💀 The TestExam doesn't exist (yet).
--------------------------------------------------
Using the ExtractZip package
The ExtractZip class has the following general method for extracting a specific zip file:
ExtractZip().extract_<lang>_<zip_type>_<course>()
Where
<lang>is eitherdefor german orenfor english,<exam_type>is eitherslides,examples,exercises,solutions,testexamorexamand<course>is the name of the course from theconfig.yaml.
In a Jupyter Notebook you can put the following in a cell to extract the slides of the testcourse with english output:
from extractzip import ExtractZip
ExtractZip().extract_en_slides_testcourse()
When the cell is executed, the corresponding zipfile will be extracted in the home directory of the current user.
Note
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.
Metadata
Release files for extractzip-sebastian-stigler 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| extractzip-sebastian-stigler-0.1.5.tar.gz | 25.3 kB | Without provenance | Details for extractzip-sebastian-stigler-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| extractzip_sebastian_stigler-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for extractzip_sebastian_stigler-0.1.5-py3-none-any.whl |
Total release size: 35.2 kB
Release files / extractzip-sebastian-stigler-0.1.5.tar.gz
| Download URL | extractzip-sebastian-stigler-0.1.5.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e336fd050281b1153b8eeb1f098c1176c142fe029fdfe698b523f98091d35b8d
|
|
BLAKE2b-256 checksum How to use checksums |
df73697ab3d0c1278e94244921421425892e7ea1affa9a0f76fc681a8f83c678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / extractzip_sebastian_stigler-0.1.5-py3-none-any.whl
| Download URL | extractzip_sebastian_stigler-0.1.5-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed076c0232a207a4137c6b65fe7cc28447dcb2e250e62bc50f5716fd185323cc
|
|
BLAKE2b-256 checksum How to use checksums |
7256cb084f019b4570e05d213e50c7dc9b0fc493a954b7d6221625053a84eb1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for extractzip-sebastian-stigler 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.