geonature.utils.module¶
Functions¶
|
|
|
|
|
|
|
Iterate revisions without following depends_on directive. |
|
|
|
Is an Alembic branch in use. |
|
Is a specific Alembic branch fully stamped. |
|
Returns True if a module with the given code exists in the database |
|
Is a GeoNature module installed. |
|
|
|
Get the module version from the module_code. We check what python package is installed. |
Module Contents¶
- geonature.utils.module.iterate_revisions(script, base_revision)[source]¶
Iterate revisions without following depends_on directive. Useful to find all revisions of a given branch.
- geonature.utils.module.get_script_from_config(directory: str, x_arg: []) alembic.script.ScriptDirectory[source]¶
- geonature.utils.module.get_script_and_base_revision_for_one_branch(branch_name: str, directory, x_arg)[source]¶
- geonature.utils.module.get_all_revisions_for_one_branch(branch_name: str, directory, x_arg) set[source]¶
- geonature.utils.module.get_last_revision_for_one_branch(branch_name: str, directory, x_arg) set[source]¶
- geonature.utils.module.alembic_branch_in_use(branch_name: str, directory, x_arg)[source]¶
Is an Alembic branch in use.
Return True if at least one revision of the given branch is stamped.
Returns¶
- bool
True if the Alembic branch has at least one revision stamped, False otherwise.
- geonature.utils.module.is_alembic_branch_up_to_date(branch_name: str, directory: str = None, x_arg: list = []) bool[source]¶
Is a specific Alembic branch fully stamped.
Parameters¶
- branch_namestr
The name of the Alembic branch.
- directorystr
The name of the directory containing the migrations files for the branch. Value of None defaults to « migrations ».
- x_arglist
Additional arguments consumed by custom env.py scripts.
Returns¶
- bool
True if the Alembic branch has all its revisions stamped, False otherwise.
- geonature.utils.module.exists_in_t_modules(module_code: str)[source]¶
Returns True if a module with the given code exists in the database
Parameters¶
- module_codestr
The code of the module (for ex. : SYNTHESE, OCCHAB, etc…)
- geonature.utils.module.is_module_installed(python_module_name: str, migrations_dir: str = None, alembic_branch_name: str = None, check_if_all_revisions_have_been_applied: bool = True)[source]¶
Is a GeoNature module installed.
We consider a module is installed if and only if: - The Python package is installed
- and (
check_if_all_revisions_have_been_applied == true and
- (
all its Alembic migrations are stamped or there is no Alembic migration at all for the module
)
) and the module is registered in the database
Parameters¶
- python_module_namestr
The name of the python module. Can be found in the root file « setup.py » of the module repository. Examples:
« gn_module_occhab »
« occtax »
« gn_module_validation »
« gn_module_dashboard »
« gn_module_export »
« gn_module_monitoring »
- migrations_dirstr
The name of the directory containing the migrations files for the branch. Value of None defaults to « migrations ».
- alembic_branch_namestr
The name of the Alembic branch. Value of None defaults to the module code in lowercase.
- check_if_all_revisions_have_been_appliedbool
Check if all revisions of the module have been applied.
Returns¶
- bool
True if the module is installed, False otherwise.