acdh-oeaw / dse-static-cookiecutter

Cookiecutter template for a Static-Site Digital Scholarly Edition
7 stars 4 forks source link

OS-agnostic python setup script as replacement for script.sh #61

Closed dominikfill closed 6 months ago

dominikfill commented 6 months ago

Resolves #46

This pull request replaces the functionality of the existing setup script script.sh with an OS-agnostic Python file named dse_setup.py. This allows for an OS-agnosctic utilization of the dse-static-cookiecutter template, thus enhancing its accessibility and usability across different platforms.

Motivation

During my internship at the ACDH in February, I observed that some of my colleagues encountered challenges setting up a static site with the dse-static-cookiecutter template. These challenges stemmed from either a lack of familiarity with Linux systems or a lack of feedback provided by the existing script. This pull request aims to simplify the setup process and making it more user-friendly.

Key Features

  1. Implementation of an OS-agnostic Python script (dse_setup.py) using only standard Python libraries, eliminating the need for external dependencies.
  2. Error handling and logging to address issues encountered during dependency downloads or directory operations such as renaming and deletion.
  3. Externalization of configurable parameters such as download URLs and folder names into a config.ini file, allowing for easier changes and cutomizations of script parameters.

Usage

python dse_setup.py -a [action]

Options:

-a, --action: Specifies the action to execute.
    Choices: "dd" (Download Dependencies), "bi" (Build Index), "fd" (Fetch Data)

Additional Information

Static-search support for Windows is still in a development branch (Link to PR), slated for inclusion in Release 2.0. Consequently, the script detects Windows environments and fetches the development branch from the staticsearch GitHub page. This experimental Windows support necessitates the inclusion of a separate ss_config_windows.xml file, reflecting changes in the development branch (Link to Issue).

Windows support is thus considered experimental but functional. The script has been tested on Windows 11 and Ubuntu Linux 23.10.

The config.ini file allows for easier adaptation to future changes in download paths once the official release of staticsearch 2.0 is available.