MO2.2.4 Developer tools: backend - openimis-be_py
Developer tools
To create backend module skeleton in single command
from
/openimis-be_py/openIMIS:run this command:
python manage.py create_openimis_module <module_name> <author> <author_email> [--template <template>]<author>and<author_email>params are required because they are necessary during creatingsetup.pyfile--templateparam allow to specify a template adding additional files, depending on module type provided: -businesstemplate provides the module withservices.pyfile containing example service, tests for that service, andapps.pycontaining module config. -calculationtemplate is an alias tocreate_calcrule_modulecommand explained inTo create calculation backend module skeleton in single commandsectionthis command executes every steps described in "To create a new openIMIS module (e.g.
openimis-be-mymodule)"file templates for setup, readme, license, manifest and urls can be found in
developer_tools/skeletonsdirectoryfiles to be added through that command based on provided templates:
setup.py
README.md
LICENSE.md
MANIFEST.md
<module_name>/urls.py
as the option could be added
--github. This allows to add gitignore file and workflows files to execute CI on every pull request (this option will execute this commandpython manage.py add_github_files_to_module <module_name>)example with using
--githuboption:python manage.py create_openimis_module <module_name> <author> <author_email> --githubfrom here on, your local openIMIS has a new module called
openimis-be-<module_name>_py, directly loaded from your directory by using single command.
To add GitHub files like workflows, gitignore etc
from
/openimis-be_py/openIMIS:run this command:
python manage.py add_github_files_to_module <module_name>this command allows to add to the existing module github files like gitignore, workflows etc
files to be added through that command based on provided templates:
openmis-module-test.yml
python-publish.yml
.gitignore
To fetch a module and install it from local directory
first install all modules as in "Developers setup"
from
/openimis-be_py/openIMIS:run this command:
python manage.py install_module_locally <module_name> [--url <url>] [--branch <branch>] [--path <path>]. This command will execute all steps required steps to first uninstall currently installed version of the module, clone the module repository and install it as an editable library.The
--urlparameter allows you to specify the git repository url (By default it will use openimis.json)The
--branchparameter allows to specify the branch that will be cloned, develop by defaultThe
--pathallows you to specify the directory the repository will be cloned to. By default, the repository will be saved next toopenimis-be_pydirectory.
To fetch all modules and install them from local directories
first install all modules as in "Developers setup"
from
/openimis-be_py/openIMIS:run this command:
python manage.py install_module_locally all. This command will execute all steps required steps to fetch all modules present inopenimis.jsonfrom the git repositories and install them as editable libraries.
To install modules from PyPI
first install all modules as in "Developers setup"
from
/openimis-be_py/openIMIS:run this command:
python manage.py install_module_pypi <module_name> [--target-version <version>] [--library-name <library_name>] [--check-only]. This command will execute all steps required steps to first uninstall currently installed version of the module, check the newest version of the library and install it from PyPI.The
--target-versionparameter allows you to specify the version that will be used to install the moduleThe
--library-nameparameter allows you to override the library name. By default, the library name is derived from module name, following this scheme:openimis-be-<module_name>The
--check-onlyflag allows to check the newest version without installing the library or modifying openimis.json file. This parameter can be also used to check availability of a specific version when used with--target-version
To install all modules from PyPI
first install all modules as in "Developers setup"
from
/openimis-be_py/openIMIS:run this command:
python manage.py install_module_locally all. This command will execute all steps required steps to install most recent versions of all modules present inopenimis.jsonfrom PyPI.
To create calculation backend module skeleton in single command
from
/openimis-be_py/openIMIS:run this command:
python manage.py create_calcrule_module <module_name> <author> <author_email><author>and<author_email>params are required because they are necessary during creatingsetup.pyfilefile templates for apps.py, config.py and calculation_rule.py can be found in
developer_tools/skeletonsdirectoryanother files necessary to launch module such as setup.py etc are also added by this command.
files to be added through that command based on provided templates:
setup.py
README.md
LICENSE.md
MANIFEST.md
<module_name>/urls.py
<module_name>/apps.py
<module_name>/config.py
<module_name>/calculation_rule.py
as the option could be added
--github. This allows to add gitignore file and workflows files so as to execute CI on every pull request (this option will execute this commandpython manage.py add_github_files_to_module <module_name>)example with using
--githuboption:python manage.py create_calcrule_module <module_name> <author> <author_email> --githubfrom here on, your local openIMIS has a new module called
openimis-be-calcrule-<module_name>_py, directly loaded from your directory by using single command.
To create release branches for all backend/frontend modules presented in openimis.json
from
/openimis-be_py/openIMIS:run this command:
python manage.py create_release_branch <version> <from_branch: by default 'develop'>. This command will execute all steps required to create release branches of all modules present inopenimis.json(frontend json and backend json).
To extract all translations from frontend modules
from
/openimis-be_py/openIMIS:run this command:
python manage.py extract_translations. This command will execute all steps required to extract frontend translations of all modules present inopenimis.json.those translations will be copied into 'extracted_translations_fe' folder in assembly backend module
Did you encounter a problem or do you have a suggestion?
Please contact our Service Desk
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/