g3w-admin icon indicating copy to clipboard operation
g3w-admin copied to clipboard

Add a `Makefile` to automate common command-line tasks

Open Raruto opened this issue 2 years ago • 0 comments

Checklist

  • [X] I've searched through the current issues to make sure this feature hasn't been requested already.

Motivation

As per v3.5,

these are some files that include development scripts that can be found in the source code bundle:

paver

yarn / npm

docker-compose

manage.py

Some of the issues to report with the current structure:

  • each of these commands requires specific tools and knowledge for the developer to find, understand and use them *
  • when using different tools it is difficult to have an overview on the available scripts (or at least the most useful ones) and where it is recommended to code to simplify some development tasks (e.g. versioning, virtualenv, ...) **
  • too much freedom for the final developers in writing output logs for bash scripts (eg. it's not always so easy to understand if and when a task is executed) ***

* ref: https://github.com/g3w-suite/g3w-suite-docker/issues/75, https://github.com/g3w-suite/g3w-admin/issues/352, https://github.com/g3w-suite/g3w-admin/issues/419, https://github.com/g3w-suite/g3w-admin/issues/434

** ref: https://github.com/g3w-suite/g3w-client/issues/112

*** ref: https://github.com/g3w-suite/g3w-admin/issues/373

Suggested solution

Use a Makefile in order to make writing administrative tasks independent of the tool and language needed to run it.

In particular we could start with:

  1. remove paver as project dependency and convert all pavement.py tasks (which are already almost bash commands) into Makefile directives
  2. remove or simplify build_suite.sh and setup_suite.sh by calling Makefile directives within those files
  3. update the contributing section within project's README.md or as seperated file (ref: https://github.com/g3w-suite/g3w-admin/issues/380) for people who don't want to use docker to develop

Below a sample project from which we can get inspiration:

Alternatives considered

Python Project Scripts

ref: Python Project Scripts

PyPA specs states that we can install scripts locally (python only? I didn't investigate in depth) when resolving project dependencies (e.g. while a pip install .).

This type of solution should be easily integrated with all the build tools present in the python world (e.g. poetry), but also directly via a regular python install using adding a pyproject.toml file to your project (here a sample pyproject on which you can experiment with adding a project script thus defined).

On the other hand:

  • a Makefile shouldn't need any further dependencies to work (to be updated and configured)
  • the make command is quite straightforward and is generally already available in many Linux installations
  • the make command does not need to create dedicated environments before starting a directive (ref. virtualenv for python projects)

NB all the considerations above are to be taken with the right caution, at the moment I have not investigated whether through the use of a python package manager (there are really too many) it could be simpler than a simple Makefile.

Raruto avatar Dec 21 '22 14:12 Raruto