kahoot-to-anki 1.0.0__tar.gz → 1.2.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.
- kahoot_to_anki-1.2.0/PKG-INFO +79 -0
- kahoot_to_anki-1.2.0/README.md +65 -0
- kahoot_to_anki-1.2.0/kahoot_to_anki/__init__.py +1 -0
- kahoot_to_anki-1.2.0/kahoot_to_anki/cli.py +127 -0
- kahoot_to_anki-1.2.0/kahoot_to_anki/main.py +40 -0
- kahoot_to_anki-1.2.0/kahoot_to_anki/processing.py +143 -0
- kahoot_to_anki-1.2.0/kahoot_to_anki.egg-info/PKG-INFO +79 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/kahoot_to_anki.egg-info/SOURCES.txt +5 -2
- kahoot_to_anki-1.2.0/kahoot_to_anki.egg-info/entry_points.txt +2 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/kahoot_to_anki.egg-info/top_level.txt +1 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/pyproject.toml +3 -3
- kahoot_to_anki-1.2.0/tests/test_cli.py +111 -0
- kahoot_to_anki-1.2.0/tests/test_processing.py +340 -0
- kahoot_to_anki-1.0.0/PKG-INFO +0 -16
- kahoot_to_anki-1.0.0/README.md +0 -2
- kahoot_to_anki-1.0.0/kahoot_to_anki/__init__.py +0 -1
- kahoot_to_anki-1.0.0/kahoot_to_anki/converter.py +0 -254
- kahoot_to_anki-1.0.0/kahoot_to_anki.egg-info/PKG-INFO +0 -16
- kahoot_to_anki-1.0.0/kahoot_to_anki.egg-info/entry_points.txt +0 -2
- kahoot_to_anki-1.0.0/tests/test_project.py +0 -226
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/LICENSE +0 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/kahoot_to_anki.egg-info/dependency_links.txt +0 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/kahoot_to_anki.egg-info/requires.txt +0 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/setup.cfg +0 -0
- {kahoot_to_anki-1.0.0 → kahoot_to_anki-1.2.0}/tests/__init__.py +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: kahoot-to-anki
|
3
|
+
Version: 1.2.0
|
4
|
+
Summary: CLI tool to convert Kahoot quiz reports into Anki flashcards
|
5
|
+
Author: Simon Hardmeier
|
6
|
+
License-Expression: MIT
|
7
|
+
Requires-Python: >=3.9
|
8
|
+
Description-Content-Type: text/markdown
|
9
|
+
License-File: LICENSE
|
10
|
+
Requires-Dist: genanki
|
11
|
+
Requires-Dist: pandas
|
12
|
+
Requires-Dist: openpyxl
|
13
|
+
Dynamic: license-file
|
14
|
+
|
15
|
+
# kahoot-to-anki
|
16
|
+
[](#installation)
|
17
|
+
[](LICENSE)
|
18
|
+
|
19
|
+
<br>
|
20
|
+
|
21
|
+
**kahoot-to-anki** is a command‑line tool that converts exported Kahoot quiz reports (Excel Files) into Anki flashcard decks (.apkg format).<br>
|
22
|
+
Designed for educators, students, and any self-learners to easily turn quiz results into effective spaced‑repetition decks.
|
23
|
+
|
24
|
+
## Installation & Usage
|
25
|
+
### Option 1: Install via pip
|
26
|
+
```
|
27
|
+
pip install kahoot-to-anki
|
28
|
+
```
|
29
|
+
Then run:
|
30
|
+
```
|
31
|
+
kahoot-to-anki --help
|
32
|
+
```
|
33
|
+
Example: Process all Kahoot Exports in the `./exports/` folder and write the flashcard deck and CSV file to `./data/`:
|
34
|
+
```
|
35
|
+
kahoot-to-anki --inp "./exports" --out "./data" --csv
|
36
|
+
```
|
37
|
+
|
38
|
+
### Option 2: Run with Docker
|
39
|
+
```
|
40
|
+
# Clone Repository
|
41
|
+
git clone https://github.com/SimonHRD/kahoot-to-anki.git
|
42
|
+
|
43
|
+
# Move into Repository
|
44
|
+
cd kahoot-to-anki
|
45
|
+
|
46
|
+
# Build docker image with the kahoot-to-anki tag
|
47
|
+
docker build -t kahoot-to-anki .
|
48
|
+
|
49
|
+
# Check help command
|
50
|
+
docker run --rm kahoot-to-anki --help
|
51
|
+
|
52
|
+
# Run with local data
|
53
|
+
docker run --rm -v "$(pwd)/data:/app/data" kahoot-to-anki --out "./data" --csv
|
54
|
+
```
|
55
|
+
|
56
|
+
On PowerShell:
|
57
|
+
```
|
58
|
+
docker run --rm -v ${PWD}\data:/app/data kahoot-to-anki --out "./data" --csv
|
59
|
+
```
|
60
|
+
|
61
|
+
## CLI Arguments
|
62
|
+
You can provide either a single Kahoot Excel file or a directory containing multiple `.xlsx` files as input.<br>
|
63
|
+
All valid Excel files in the directory will be processed.
|
64
|
+
|
65
|
+
| Argument | Description |
|
66
|
+
|----------------------|--------------------------------------------------------------------------------|
|
67
|
+
| `-i`, `--inp` | Path to the input Excel file or directory (default: `./data`) |
|
68
|
+
| `-o`, `--out` | Path to the output directory for the Anki deck (default: `./`) |
|
69
|
+
| `--sheet` | The Excel Sheet with the raw Kahoot quiz data (default: `RawReportData Data`) |
|
70
|
+
| `--csv`, `--no-csv` | Enable or disable CSV export of the questions (default: disabled) |
|
71
|
+
| `-t`, `--title` | Title of the generated Anki deck (default: `"Kahoot"`) |
|
72
|
+
| `--version` | Show the version of the installed kahoot-to-anki package |
|
73
|
+
|
74
|
+
|
75
|
+
## Example
|
76
|
+
An example Kahoot export file is available in `data/`. The generated deck will be saved as `anki.apkg` in the specified `--out` directory (default: `./`).
|
77
|
+
|
78
|
+
## License
|
79
|
+
MIT — see [LICENSE](./LICENSE)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# kahoot-to-anki
|
2
|
+
[](#installation)
|
3
|
+
[](LICENSE)
|
4
|
+
|
5
|
+
<br>
|
6
|
+
|
7
|
+
**kahoot-to-anki** is a command‑line tool that converts exported Kahoot quiz reports (Excel Files) into Anki flashcard decks (.apkg format).<br>
|
8
|
+
Designed for educators, students, and any self-learners to easily turn quiz results into effective spaced‑repetition decks.
|
9
|
+
|
10
|
+
## Installation & Usage
|
11
|
+
### Option 1: Install via pip
|
12
|
+
```
|
13
|
+
pip install kahoot-to-anki
|
14
|
+
```
|
15
|
+
Then run:
|
16
|
+
```
|
17
|
+
kahoot-to-anki --help
|
18
|
+
```
|
19
|
+
Example: Process all Kahoot Exports in the `./exports/` folder and write the flashcard deck and CSV file to `./data/`:
|
20
|
+
```
|
21
|
+
kahoot-to-anki --inp "./exports" --out "./data" --csv
|
22
|
+
```
|
23
|
+
|
24
|
+
### Option 2: Run with Docker
|
25
|
+
```
|
26
|
+
# Clone Repository
|
27
|
+
git clone https://github.com/SimonHRD/kahoot-to-anki.git
|
28
|
+
|
29
|
+
# Move into Repository
|
30
|
+
cd kahoot-to-anki
|
31
|
+
|
32
|
+
# Build docker image with the kahoot-to-anki tag
|
33
|
+
docker build -t kahoot-to-anki .
|
34
|
+
|
35
|
+
# Check help command
|
36
|
+
docker run --rm kahoot-to-anki --help
|
37
|
+
|
38
|
+
# Run with local data
|
39
|
+
docker run --rm -v "$(pwd)/data:/app/data" kahoot-to-anki --out "./data" --csv
|
40
|
+
```
|
41
|
+
|
42
|
+
On PowerShell:
|
43
|
+
```
|
44
|
+
docker run --rm -v ${PWD}\data:/app/data kahoot-to-anki --out "./data" --csv
|
45
|
+
```
|
46
|
+
|
47
|
+
## CLI Arguments
|
48
|
+
You can provide either a single Kahoot Excel file or a directory containing multiple `.xlsx` files as input.<br>
|
49
|
+
All valid Excel files in the directory will be processed.
|
50
|
+
|
51
|
+
| Argument | Description |
|
52
|
+
|----------------------|--------------------------------------------------------------------------------|
|
53
|
+
| `-i`, `--inp` | Path to the input Excel file or directory (default: `./data`) |
|
54
|
+
| `-o`, `--out` | Path to the output directory for the Anki deck (default: `./`) |
|
55
|
+
| `--sheet` | The Excel Sheet with the raw Kahoot quiz data (default: `RawReportData Data`) |
|
56
|
+
| `--csv`, `--no-csv` | Enable or disable CSV export of the questions (default: disabled) |
|
57
|
+
| `-t`, `--title` | Title of the generated Anki deck (default: `"Kahoot"`) |
|
58
|
+
| `--version` | Show the version of the installed kahoot-to-anki package |
|
59
|
+
|
60
|
+
|
61
|
+
## Example
|
62
|
+
An example Kahoot export file is available in `data/`. The generated deck will be saved as `anki.apkg` in the specified `--out` directory (default: `./`).
|
63
|
+
|
64
|
+
## License
|
65
|
+
MIT — see [LICENSE](./LICENSE)
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "1.2.0"
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# Standard library imports
|
2
|
+
import argparse
|
3
|
+
from dataclasses import dataclass
|
4
|
+
import logging
|
5
|
+
import os
|
6
|
+
import glob
|
7
|
+
|
8
|
+
from kahoot_to_anki import __version__
|
9
|
+
|
10
|
+
|
11
|
+
# Constants
|
12
|
+
DEFAULT_INPUT_DIRECTORY = "./data"
|
13
|
+
DEFAULT_OUTPUT_DIRECTORY = "./"
|
14
|
+
DEFAULT_DECK_TITLE = "Kahoot"
|
15
|
+
KAHOOT_EXCEL_SHEET_NAME_RAW_DATA = "RawReportData Data"
|
16
|
+
|
17
|
+
# Dataclass to hold CLI arguments
|
18
|
+
@dataclass
|
19
|
+
class CLIArgs:
|
20
|
+
input_path: str
|
21
|
+
output_path: str
|
22
|
+
sheet: str
|
23
|
+
export_csv: bool
|
24
|
+
deck_title: str
|
25
|
+
|
26
|
+
|
27
|
+
def get_commandline_arguments() -> CLIArgs:
|
28
|
+
"""
|
29
|
+
Parses the command line arguments and returns a CLIArgs dataclass instance.
|
30
|
+
|
31
|
+
:return: A CLIArgs dataclass instance
|
32
|
+
:rtype: CLIArgs
|
33
|
+
"""
|
34
|
+
parser = argparse.ArgumentParser(description="Create Anki Deck from Kahoot answer")
|
35
|
+
parser.add_argument(
|
36
|
+
"-i",
|
37
|
+
"--inp",
|
38
|
+
default=DEFAULT_INPUT_DIRECTORY,
|
39
|
+
help=f"Path to the directory containing input Excel files or a single input Excel file. If a directory is "
|
40
|
+
f"provided, all Excel files in the directory will be processed. Default: {DEFAULT_INPUT_DIRECTORY}",
|
41
|
+
type=str,
|
42
|
+
)
|
43
|
+
parser.add_argument(
|
44
|
+
"-o",
|
45
|
+
"--out",
|
46
|
+
default=DEFAULT_OUTPUT_DIRECTORY,
|
47
|
+
help="Path to the directory where the Anki flashcards package will be generated. "
|
48
|
+
"If not specified, the package will be created in the current working directory.",
|
49
|
+
type=str,
|
50
|
+
)
|
51
|
+
parser.add_argument(
|
52
|
+
"--sheet",
|
53
|
+
default=KAHOOT_EXCEL_SHEET_NAME_RAW_DATA,
|
54
|
+
help=f"The Excel Sheet Name with the Kahoot Raw Data. Default {KAHOOT_EXCEL_SHEET_NAME_RAW_DATA}",
|
55
|
+
type=str,
|
56
|
+
)
|
57
|
+
parser.add_argument(
|
58
|
+
"--csv",
|
59
|
+
action=argparse.BooleanOptionalAction,
|
60
|
+
default=False,
|
61
|
+
help="Enable or disable CSV export of question data (default: disabled).",
|
62
|
+
)
|
63
|
+
parser.add_argument(
|
64
|
+
"-t",
|
65
|
+
"--title",
|
66
|
+
default=DEFAULT_DECK_TITLE,
|
67
|
+
help="Name of the Anki deck to be created. "
|
68
|
+
f"If not specified, the default deck name '{DEFAULT_DECK_TITLE}' will be used.",
|
69
|
+
type=str,
|
70
|
+
)
|
71
|
+
parser.add_argument(
|
72
|
+
"--version",
|
73
|
+
action="version",
|
74
|
+
version=f"%(prog)s {__version__}",
|
75
|
+
help="Show the version number and exit.",
|
76
|
+
)
|
77
|
+
args = parser.parse_args()
|
78
|
+
|
79
|
+
return CLIArgs(
|
80
|
+
input_path=os.path.abspath(args.inp),
|
81
|
+
output_path=os.path.abspath(args.out),
|
82
|
+
sheet=args.sheet,
|
83
|
+
export_csv=args.csv,
|
84
|
+
deck_title=args.title
|
85
|
+
)
|
86
|
+
|
87
|
+
|
88
|
+
def validation(input_directory: str, output_directory: str) -> None:
|
89
|
+
"""
|
90
|
+
This function validates the command line arguments, checking if the input path is a valid Excel file or directory
|
91
|
+
and if the output path is a valid directory.
|
92
|
+
The input path needs to be an Excel file or a directory that contains Excel files.
|
93
|
+
The output path needs to be a directory and not a file.
|
94
|
+
|
95
|
+
:param input_directory: The path of the input Excel or directory
|
96
|
+
:param output_directory: The path of the output directory
|
97
|
+
:return: None
|
98
|
+
:rtype: None
|
99
|
+
"""
|
100
|
+
# Check if input is a file
|
101
|
+
if not os.path.exists(input_directory):
|
102
|
+
logging.error(f"Input directory {input_directory} does not exist!")
|
103
|
+
raise FileNotFoundError(f"Input directory {input_directory} does not exist!")
|
104
|
+
elif (
|
105
|
+
os.path.isfile(input_directory)
|
106
|
+
and os.path.splitext(input_directory)[-1] != ".xlsx"
|
107
|
+
):
|
108
|
+
logging.error("Input file is not an excel file!")
|
109
|
+
raise ValueError("Input file is not an excel file!")
|
110
|
+
elif os.path.isdir(input_directory):
|
111
|
+
input_excels = os.path.join(input_directory, "*.xlsx")
|
112
|
+
if not glob.glob(input_excels):
|
113
|
+
logging.error("Input directory does not contain any excel files!")
|
114
|
+
raise FileNotFoundError("Input directory does not contain any excel files!")
|
115
|
+
|
116
|
+
# Check output directory and create when not existing
|
117
|
+
if not os.path.isdir(output_directory):
|
118
|
+
logging.error("Output is not a directory!")
|
119
|
+
raise ValueError("Output is not a directory!")
|
120
|
+
if not os.path.exists(output_directory):
|
121
|
+
try:
|
122
|
+
os.makedirs(output_directory)
|
123
|
+
except OSError as e:
|
124
|
+
logging.error(
|
125
|
+
"Failed to create output directory '%s': %s", output_directory, str(e)
|
126
|
+
)
|
127
|
+
raise
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import os
|
2
|
+
import logging
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from kahoot_to_anki.cli import get_commandline_arguments, validation
|
6
|
+
from kahoot_to_anki.processing import get_questions, make_anki
|
7
|
+
|
8
|
+
# Configure logging settings
|
9
|
+
logging.basicConfig(level=logging.INFO)
|
10
|
+
|
11
|
+
|
12
|
+
def main() -> None:
|
13
|
+
# Check command line arguments
|
14
|
+
args = get_commandline_arguments()
|
15
|
+
|
16
|
+
validation(args.input_path, args.output_path)
|
17
|
+
|
18
|
+
df = get_questions(input_directory=args.input_path, sheet_name=args.sheet)
|
19
|
+
|
20
|
+
if df.empty:
|
21
|
+
logging.warning("No Kahoot questions found to process. Exiting.")
|
22
|
+
sys.exit(0)
|
23
|
+
|
24
|
+
if args.export_csv:
|
25
|
+
df.to_csv(
|
26
|
+
os.path.join(args.output_path, "kahoot.csv"),
|
27
|
+
sep=";",
|
28
|
+
index=False,
|
29
|
+
encoding="utf-8-sig",
|
30
|
+
)
|
31
|
+
|
32
|
+
make_anki(df, args.output_path, args.deck_title)
|
33
|
+
|
34
|
+
|
35
|
+
if __name__ == "__main__":
|
36
|
+
main()
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Standard library imports
|
2
|
+
import logging
|
3
|
+
import os
|
4
|
+
import glob
|
5
|
+
from typing import Iterator, Optional
|
6
|
+
|
7
|
+
# Third-party library imports
|
8
|
+
import genanki
|
9
|
+
import pandas as pd
|
10
|
+
|
11
|
+
|
12
|
+
def get_questions(input_directory: str, sheet_name: str) -> pd.DataFrame:
|
13
|
+
"""
|
14
|
+
Extracts all the kahoot questions out of the Excel file(s)
|
15
|
+
|
16
|
+
:param input_directory: The path to the input directory or Excel file
|
17
|
+
:param sheet_name: The Excel sheet name with the Kahoot Answers
|
18
|
+
:return: All the questions with the possible answers and the solution
|
19
|
+
:rtype: pd.DataFrame
|
20
|
+
"""
|
21
|
+
|
22
|
+
out = pd.DataFrame(columns=["Question", "Possible Answers", "Correct Answers"])
|
23
|
+
|
24
|
+
questions_cnt = 0
|
25
|
+
files_cnt = 0
|
26
|
+
|
27
|
+
for file in get_excels(input_directory):
|
28
|
+
df = get_excel_data(excel_file=file, sheet_name=sheet_name)
|
29
|
+
if df is None:
|
30
|
+
continue
|
31
|
+
files_cnt += 1
|
32
|
+
|
33
|
+
df = df_processing(df)
|
34
|
+
|
35
|
+
# add to out dataframe
|
36
|
+
out = pd.concat([out, df], axis=0, ignore_index=True)
|
37
|
+
|
38
|
+
questions_cnt += len(df)
|
39
|
+
|
40
|
+
logging.info("Read input files: %d", files_cnt)
|
41
|
+
logging.info("Read questions: %d", questions_cnt)
|
42
|
+
out = out.drop_duplicates(subset=["Question"])
|
43
|
+
return out
|
44
|
+
|
45
|
+
|
46
|
+
def get_excels(path: str) -> Iterator[str]:
|
47
|
+
"""
|
48
|
+
Returns a generator with all Excel files in the given path.
|
49
|
+
:param path: the path to an Excel file or a directory with Excel files
|
50
|
+
:return: a generator of Excel file paths
|
51
|
+
"""
|
52
|
+
if os.path.isfile(path):
|
53
|
+
yield path
|
54
|
+
else:
|
55
|
+
yield from glob.glob(os.path.join(path, "*.xlsx"))
|
56
|
+
|
57
|
+
|
58
|
+
def get_excel_data(excel_file: str, sheet_name:str) -> Optional[pd.DataFrame]:
|
59
|
+
"""
|
60
|
+
Returns a pd.DataFrame with the kahoot raw data
|
61
|
+
:param excel_file: an Excel file with Kahoot raw data
|
62
|
+
:param sheet_name: the Excel sheet name with the Kahoot answers
|
63
|
+
:return: a DataFrame with the data
|
64
|
+
"""
|
65
|
+
try:
|
66
|
+
# read file
|
67
|
+
return pd.read_excel(
|
68
|
+
excel_file, sheet_name=sheet_name
|
69
|
+
)
|
70
|
+
except ValueError:
|
71
|
+
logging.warning(
|
72
|
+
"Skipping file '%s' as it is not a valid Excel file.", excel_file
|
73
|
+
)
|
74
|
+
return None
|
75
|
+
except Exception as e:
|
76
|
+
logging.error("Failed to read file '%s': %s", excel_file, str(e))
|
77
|
+
return None
|
78
|
+
|
79
|
+
|
80
|
+
def df_processing(data: pd.DataFrame) -> pd.DataFrame:
|
81
|
+
"""
|
82
|
+
Processes the Kahoot question data.
|
83
|
+
:param data: DataFrame with Kahoot question data
|
84
|
+
:return: Processed DataFrame
|
85
|
+
"""
|
86
|
+
if data.empty:
|
87
|
+
return pd.DataFrame(columns=["Question", "Possible Answers", "Correct Answers"])
|
88
|
+
|
89
|
+
# delete duplicated questions
|
90
|
+
data = data.drop_duplicates(subset=["Question Number"])
|
91
|
+
data = data.fillna("")
|
92
|
+
|
93
|
+
data["Possible Answers"] = data[
|
94
|
+
["Answer 1", "Answer 2", "Answer 3", "Answer 4", "Answer 5", "Answer 6"]
|
95
|
+
].astype(str).agg("<br>".join, axis=1)
|
96
|
+
|
97
|
+
# keep only needed columns
|
98
|
+
data = data[["Question", "Possible Answers", "Correct Answers"]]
|
99
|
+
|
100
|
+
return data
|
101
|
+
|
102
|
+
|
103
|
+
def make_anki(df: pd.DataFrame, out: str, title: str) -> None:
|
104
|
+
"""
|
105
|
+
Creates an Anki deck from the given Kahoot questions
|
106
|
+
|
107
|
+
:param df: The kahoot questions in a pd.DataFrame
|
108
|
+
:param out: The path to the output directory
|
109
|
+
:param title: The title of the Anki deck
|
110
|
+
:return: None
|
111
|
+
"""
|
112
|
+
my_model = genanki.Model(
|
113
|
+
1607392319,
|
114
|
+
"Simple Model",
|
115
|
+
fields=[
|
116
|
+
{"name": "Question"},
|
117
|
+
{"name": "Answer"},
|
118
|
+
{"name": "selects"},
|
119
|
+
],
|
120
|
+
templates=[
|
121
|
+
{
|
122
|
+
"name": "Card 1",
|
123
|
+
"qfmt": "{{Question}}<br><br>{{selects}}",
|
124
|
+
"afmt": '{{FrontSide}}<hr id="answer">{{Answer}}',
|
125
|
+
},
|
126
|
+
],
|
127
|
+
)
|
128
|
+
|
129
|
+
my_deck = genanki.Deck(2059400110, title)
|
130
|
+
|
131
|
+
for index, row in df.iterrows():
|
132
|
+
my_note = genanki.Note(
|
133
|
+
model=my_model,
|
134
|
+
fields=[row["Question"], row["Correct Answers"], row["Possible Answers"]],
|
135
|
+
)
|
136
|
+
my_deck.add_note(my_note)
|
137
|
+
|
138
|
+
try:
|
139
|
+
genanki.Package(my_deck).write_to_file(
|
140
|
+
os.path.join(out, "anki.apkg"),
|
141
|
+
)
|
142
|
+
except Exception as e:
|
143
|
+
logging.error("Failed to write Anki package file: %s", str(e))
|
@@ -0,0 +1,79 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: kahoot-to-anki
|
3
|
+
Version: 1.2.0
|
4
|
+
Summary: CLI tool to convert Kahoot quiz reports into Anki flashcards
|
5
|
+
Author: Simon Hardmeier
|
6
|
+
License-Expression: MIT
|
7
|
+
Requires-Python: >=3.9
|
8
|
+
Description-Content-Type: text/markdown
|
9
|
+
License-File: LICENSE
|
10
|
+
Requires-Dist: genanki
|
11
|
+
Requires-Dist: pandas
|
12
|
+
Requires-Dist: openpyxl
|
13
|
+
Dynamic: license-file
|
14
|
+
|
15
|
+
# kahoot-to-anki
|
16
|
+
[](#installation)
|
17
|
+
[](LICENSE)
|
18
|
+
|
19
|
+
<br>
|
20
|
+
|
21
|
+
**kahoot-to-anki** is a command‑line tool that converts exported Kahoot quiz reports (Excel Files) into Anki flashcard decks (.apkg format).<br>
|
22
|
+
Designed for educators, students, and any self-learners to easily turn quiz results into effective spaced‑repetition decks.
|
23
|
+
|
24
|
+
## Installation & Usage
|
25
|
+
### Option 1: Install via pip
|
26
|
+
```
|
27
|
+
pip install kahoot-to-anki
|
28
|
+
```
|
29
|
+
Then run:
|
30
|
+
```
|
31
|
+
kahoot-to-anki --help
|
32
|
+
```
|
33
|
+
Example: Process all Kahoot Exports in the `./exports/` folder and write the flashcard deck and CSV file to `./data/`:
|
34
|
+
```
|
35
|
+
kahoot-to-anki --inp "./exports" --out "./data" --csv
|
36
|
+
```
|
37
|
+
|
38
|
+
### Option 2: Run with Docker
|
39
|
+
```
|
40
|
+
# Clone Repository
|
41
|
+
git clone https://github.com/SimonHRD/kahoot-to-anki.git
|
42
|
+
|
43
|
+
# Move into Repository
|
44
|
+
cd kahoot-to-anki
|
45
|
+
|
46
|
+
# Build docker image with the kahoot-to-anki tag
|
47
|
+
docker build -t kahoot-to-anki .
|
48
|
+
|
49
|
+
# Check help command
|
50
|
+
docker run --rm kahoot-to-anki --help
|
51
|
+
|
52
|
+
# Run with local data
|
53
|
+
docker run --rm -v "$(pwd)/data:/app/data" kahoot-to-anki --out "./data" --csv
|
54
|
+
```
|
55
|
+
|
56
|
+
On PowerShell:
|
57
|
+
```
|
58
|
+
docker run --rm -v ${PWD}\data:/app/data kahoot-to-anki --out "./data" --csv
|
59
|
+
```
|
60
|
+
|
61
|
+
## CLI Arguments
|
62
|
+
You can provide either a single Kahoot Excel file or a directory containing multiple `.xlsx` files as input.<br>
|
63
|
+
All valid Excel files in the directory will be processed.
|
64
|
+
|
65
|
+
| Argument | Description |
|
66
|
+
|----------------------|--------------------------------------------------------------------------------|
|
67
|
+
| `-i`, `--inp` | Path to the input Excel file or directory (default: `./data`) |
|
68
|
+
| `-o`, `--out` | Path to the output directory for the Anki deck (default: `./`) |
|
69
|
+
| `--sheet` | The Excel Sheet with the raw Kahoot quiz data (default: `RawReportData Data`) |
|
70
|
+
| `--csv`, `--no-csv` | Enable or disable CSV export of the questions (default: disabled) |
|
71
|
+
| `-t`, `--title` | Title of the generated Anki deck (default: `"Kahoot"`) |
|
72
|
+
| `--version` | Show the version of the installed kahoot-to-anki package |
|
73
|
+
|
74
|
+
|
75
|
+
## Example
|
76
|
+
An example Kahoot export file is available in `data/`. The generated deck will be saved as `anki.apkg` in the specified `--out` directory (default: `./`).
|
77
|
+
|
78
|
+
## License
|
79
|
+
MIT — see [LICENSE](./LICENSE)
|
@@ -2,7 +2,9 @@ LICENSE
|
|
2
2
|
README.md
|
3
3
|
pyproject.toml
|
4
4
|
kahoot_to_anki/__init__.py
|
5
|
-
kahoot_to_anki/
|
5
|
+
kahoot_to_anki/cli.py
|
6
|
+
kahoot_to_anki/main.py
|
7
|
+
kahoot_to_anki/processing.py
|
6
8
|
kahoot_to_anki.egg-info/PKG-INFO
|
7
9
|
kahoot_to_anki.egg-info/SOURCES.txt
|
8
10
|
kahoot_to_anki.egg-info/dependency_links.txt
|
@@ -10,4 +12,5 @@ kahoot_to_anki.egg-info/entry_points.txt
|
|
10
12
|
kahoot_to_anki.egg-info/requires.txt
|
11
13
|
kahoot_to_anki.egg-info/top_level.txt
|
12
14
|
tests/__init__.py
|
13
|
-
tests/
|
15
|
+
tests/test_cli.py
|
16
|
+
tests/test_processing.py
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "kahoot-to-anki"
|
7
|
-
version = "1.
|
7
|
+
version = "1.2.0"
|
8
8
|
description = "CLI tool to convert Kahoot quiz reports into Anki flashcards"
|
9
9
|
authors = [{ name = "Simon Hardmeier" }]
|
10
10
|
license = "MIT"
|
11
11
|
readme = "README.md"
|
12
|
-
requires-python = ">=3.
|
12
|
+
requires-python = ">=3.9"
|
13
13
|
dependencies = [
|
14
14
|
"genanki",
|
15
15
|
"pandas",
|
@@ -17,7 +17,7 @@ dependencies = [
|
|
17
17
|
]
|
18
18
|
|
19
19
|
[project.scripts]
|
20
|
-
kahoot-to-anki = "kahoot_to_anki.
|
20
|
+
kahoot-to-anki = "kahoot_to_anki.main:main"
|
21
21
|
|
22
22
|
[tool.setuptools.packages.find]
|
23
23
|
where = ["."]
|