Skip to main content

A CLI for converting graded Moodle quiz HTMLs to a vik.wiki quiz wikitext

Project description

🎓 moodle-to-vikwikiquiz

Lines of code Build status Code quality Type hinting used Code style: Black

Recent activity Commits since latest release PRs welcome

📖 About

A CLI for converting graded Moodle quizzes saved as HTML files to a vik.viki quiz wikitext.

📥 Installation

✨ Easy

  1. Install pipx

  2. If using Linux: follow these steps.

  3. Run the following command in the terminal:

    pipx install moodle-to-vikwikiquiz
    

🛠️ Executable zipapp

  1. Download the .pyz file of the latest release from here.

  2. If using Linux: run the following command in the terminal:

    chmod +x moodle-to-vikwikiquiz_x.x.x.pyz
    
  3. Run the following command in the terminal:

    ./moodle-to-vikwikiquiz_x.x.x.pyz [parameters]
    

🧑‍💻 Usage

moodle-to-vikwikiquiz [--verbose|-v] [--new|-n] [--recursive|-r] source_path

Parameters:

  • --new: Create a new quiz on vik.wiki by automatically opening an edit page for the new article.
  • --recursive: Import HTML files from the current directory recursively.
  • source_path: The absolute or relative path of the file or directory where the Moodle quiz HTML files are located. These HTML files should contain the Review page of the quizzes.

Always check and correct the output before submitting it to the wiki! This includes uploading all images and adding their filenames to the quiz manually.

📋 Features

  • Imports multiple HTML files at once (recursively, if desired)
  • Supports true or false, single and multiple choice questions
  • Opens an existing article or creates a new one on vik.wiki with the edit summary pre-filled
  • Formats LaTeX equations as wikitext
  • Adds the only remaining correct answer automatically if it can be determined from the grade
  • Asks for correct answers if it can't be determined from a graded question
  • Deduplicates questions with the same text
  • Prepares illustrations for batch upload
    • If they are unavailable: creates placeholders for them
  • Copies the generated wikitext to the clipboard

⏫ Updating

Run the following command in the terminal:

pipx upgrade-all

If you want this to run automatically, create a cron job:

  1. Open the crontab file:

    crontab -e
    
  2. Add this line to the beginning of the file:

    PATH=~/.local/bin
    

    If there is already a line beginning with PATH=, add :~/.local/bin to the end of it.

  3. Add the following line to the end of the file:

    @daily		pipx upgrade-all
    

    You may replace @daily with @weekly or @monthly.

🧑‍💻 Development

⌨️ Developing

After you make changes to the Python codebase, please check whether the supported minimum Python version has changed. Run the following command in the terminal:

vermin --backport argparse --backport enum --backport typing_extensions --eval-annotations .

If it has changed, update pyproject.toml accordingly.

🏗️ Building

  • Wheels (.whl):

    1. Install build:
      python3 -m pip install --upgrade pip
      pip install build
      
    2. Create the wheels:
      python3 -m build
      
  • zipapp (.pyz):

    1. Install pipx
    2. Install shiv:
      pipx install shiv
      
    3. Create the executable:
      shiv --entry-point moodle_to_vikwikiquiz.main:main --output-file moodle-to-vikwikiquiz.pyz --reproducible .
      

📜 License

This project is licensed under the GNU General Public License v3.0. See the license file (or the GPL-3.0 license tab on GitHub) for its full text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moodle_to_vikwikiquiz-1.3.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

moodle_to_vikwikiquiz-1.3.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file moodle_to_vikwikiquiz-1.3.0.tar.gz.

File metadata

  • Download URL: moodle_to_vikwikiquiz-1.3.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for moodle_to_vikwikiquiz-1.3.0.tar.gz
Algorithm Hash digest
SHA256 80420d6a6d85138bf0aaadabf26b5fb26456218f155e5e8212688df0c6c8a14e
MD5 f9253d0552b54752b7d139ea6721abae
BLAKE2b-256 77ca8619b907d6654dba12c38b81c9df31e6d03bb4460f907ae1ff9d4c368c16

See more details on using hashes here.

File details

Details for the file moodle_to_vikwikiquiz-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for moodle_to_vikwikiquiz-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 760f2b0ab9bea5ee4b462d40b80f30abedb97245cb5c479ea0c6afc96a4bb97d
MD5 db74b5d59a6e9b842d64f45ef39b0268
BLAKE2b-256 3a2b6f0572469d4a0434fa4fd94e105dee3051e3ed406aad340f9dba14241c2c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page