g3w-admin
g3w-admin copied to clipboard
Add a `Makefile` to automate common command-line tasks
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
-
/ci_scripts/build_suite.sh
-
/ci_scripts/setup_suite.sh
-
/ci_scripts/run_env_development.sh
-
/run_docker_tests.sh
manage.py
-
/g3w-admin/base/management/commands/export_language_files.py
-
/g3w-admin/base/management/commands/import_language_files.py
-
/g3w-admin/base/management/commands/initadmin.py
-
/g3w-admin/base/management/commands/set_passwords.py
-
/g3w-admin/base/management/commands/update_modules.py
-
/g3w-admin/editing/management/commands/check_features_locked.py
-
/g3w-admin/editing/management/commands/migration_grant_to_atomic_permissions.py
-
/g3w-admin/usersmanage/management/commands/load_demo_dev_users_groups.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:
- remove paver as project dependency and convert all
pavement.py
tasks (which are already almost bash commands) into Makefile directives - remove or simplify
build_suite.sh
andsetup_suite.sh
by calling Makefile directives within those files - 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
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
.