xmipp3-installer 1.0.1__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. xmipp3_installer-1.1.0/PKG-INFO +86 -0
  2. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/README.md +21 -2
  3. xmipp3_installer-1.1.0/pyproject.toml +50 -0
  4. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/__main__.py +1 -1
  5. xmipp3_installer-1.1.0/src/xmipp3_installer/api_client/api_client.py +51 -0
  6. xmipp3_installer-1.1.0/src/xmipp3_installer/api_client/assembler/installation_info_assembler.py +176 -0
  7. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/application/cli/arguments/__init__.py +3 -2
  8. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/arguments/modes.py +147 -0
  9. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/arguments/params.py +86 -0
  10. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/cli.py +252 -0
  11. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/parsers/base_help_formatter.py +265 -0
  12. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/parsers/error_handler_parser.py +68 -0
  13. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/parsers/format.py +35 -0
  14. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/parsers/general_help_formatter.py +110 -0
  15. xmipp3_installer-1.1.0/src/xmipp3_installer/application/cli/parsers/mode_help_formatter.py +154 -0
  16. xmipp3_installer-1.1.0/src/xmipp3_installer/application/logger/__init__.py +5 -0
  17. xmipp3_installer-1.1.0/src/xmipp3_installer/application/logger/errors.py +28 -0
  18. xmipp3_installer-1.1.0/src/xmipp3_installer/application/logger/logger.py +233 -0
  19. xmipp3_installer-1.1.0/src/xmipp3_installer/application/logger/predefined_messages.py +73 -0
  20. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/application/user_interactions.py +6 -0
  21. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/constants/paths.py +6 -0
  22. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/handlers/cmake/cmake_handler.py +65 -0
  23. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/handlers/conda_handler.py +13 -0
  24. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/handlers/generic_package_handler.py +18 -0
  25. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/handlers/git_handler.py +184 -0
  26. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/handlers/shell_handler.py +113 -0
  27. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/handlers/versions_manager.py +20 -6
  28. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/installer_service.py +22 -8
  29. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_all_executor.py +73 -0
  30. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +52 -0
  31. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +104 -0
  32. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +59 -0
  33. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +68 -0
  34. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +62 -0
  35. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +83 -0
  36. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_config_executor.py +57 -0
  37. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/modes/mode_executor.py +14 -13
  38. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_get_sources_executor.py +141 -0
  39. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_git_executor.py +53 -0
  40. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/modes/mode_selector.py +6 -0
  41. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +118 -0
  42. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +63 -0
  43. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +54 -0
  44. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +158 -0
  45. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/modes/mode_version_executor.py +175 -0
  46. xmipp3_installer-1.1.0/src/xmipp3_installer/installer/orquestrator.py +37 -0
  47. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/urls.py +4 -3
  48. xmipp3_installer-1.1.0/src/xmipp3_installer/repository/config.py +239 -0
  49. xmipp3_installer-1.1.0/src/xmipp3_installer/repository/config_vars/__init__.py +5 -0
  50. xmipp3_installer-1.1.0/src/xmipp3_installer/repository/config_vars/config_values_adapter.py +113 -0
  51. xmipp3_installer-1.1.0/src/xmipp3_installer/repository/config_vars/default_values.py +36 -0
  52. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/repository/config_vars/variables.py +9 -9
  53. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/repository/invalid_config_line.py +17 -0
  54. xmipp3_installer-1.1.0/src/xmipp3_installer/shared/file_operations.py +20 -0
  55. xmipp3_installer-1.1.0/src/xmipp3_installer/shared/singleton.py +24 -0
  56. xmipp3_installer-1.1.0/src/xmipp3_installer.egg-info/PKG-INFO +86 -0
  57. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer.egg-info/SOURCES.txt +1 -1
  58. xmipp3_installer-1.1.0/src/xmipp3_installer.egg-info/requires.txt +16 -0
  59. xmipp3_installer-1.0.1/PKG-INFO +0 -729
  60. xmipp3_installer-1.0.1/pyproject.toml +0 -31
  61. xmipp3_installer-1.0.1/src/xmipp3_installer/api_client/api_client.py +0 -50
  62. xmipp3_installer-1.0.1/src/xmipp3_installer/api_client/assembler/installation_info_assembler.py +0 -181
  63. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/arguments/modes.py +0 -130
  64. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/arguments/params.py +0 -76
  65. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/cli.py +0 -271
  66. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/parsers/base_help_formatter.py +0 -244
  67. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/parsers/error_handler_parser.py +0 -68
  68. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/parsers/format.py +0 -35
  69. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/parsers/general_help_formatter.py +0 -92
  70. xmipp3_installer-1.0.1/src/xmipp3_installer/application/cli/parsers/mode_help_formatter.py +0 -115
  71. xmipp3_installer-1.0.1/src/xmipp3_installer/application/logger/__init__.py +0 -0
  72. xmipp3_installer-1.0.1/src/xmipp3_installer/application/logger/errors.py +0 -28
  73. xmipp3_installer-1.0.1/src/xmipp3_installer/application/logger/logger.py +0 -230
  74. xmipp3_installer-1.0.1/src/xmipp3_installer/application/logger/predefined_messages.py +0 -66
  75. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/handlers/cmake/cmake_handler.py +0 -69
  76. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/handlers/conda_handler.py +0 -13
  77. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/handlers/generic_package_handler.py +0 -18
  78. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/handlers/git_handler.py +0 -185
  79. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/handlers/shell_handler.py +0 -114
  80. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_all_executor.py +0 -63
  81. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +0 -44
  82. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +0 -94
  83. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +0 -45
  84. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +0 -55
  85. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +0 -49
  86. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +0 -64
  87. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_config_executor.py +0 -46
  88. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_get_sources_executor.py +0 -132
  89. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_git_executor.py +0 -41
  90. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +0 -104
  91. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +0 -51
  92. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +0 -48
  93. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +0 -91
  94. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/modes/mode_version_executor.py +0 -164
  95. xmipp3_installer-1.0.1/src/xmipp3_installer/installer/orquestrator.py +0 -37
  96. xmipp3_installer-1.0.1/src/xmipp3_installer/repository/config.py +0 -241
  97. xmipp3_installer-1.0.1/src/xmipp3_installer/repository/config_vars/__init__.py +0 -0
  98. xmipp3_installer-1.0.1/src/xmipp3_installer/repository/config_vars/config_values_adapter.py +0 -107
  99. xmipp3_installer-1.0.1/src/xmipp3_installer/repository/config_vars/default_values.py +0 -36
  100. xmipp3_installer-1.0.1/src/xmipp3_installer/shared/file_operations.py +0 -18
  101. xmipp3_installer-1.0.1/src/xmipp3_installer/shared/singleton.py +0 -25
  102. xmipp3_installer-1.0.1/src/xmipp3_installer.egg-info/PKG-INFO +0 -729
  103. xmipp3_installer-1.0.1/src/xmipp3_installer.egg-info/requires.txt +0 -11
  104. /xmipp3_installer-1.0.1/LICENSE → /xmipp3_installer-1.1.0/LICENSE.txt +0 -0
  105. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/setup.cfg +0 -0
  106. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/__init__.py +0 -0
  107. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/application/__init__.py +0 -0
  108. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/application/cli/__init__.py +0 -0
  109. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/__init__.py +0 -0
  110. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/constants/__init__.py +0 -0
  111. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/handlers/__init__.py +0 -0
  112. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/handlers/cmake/__init__.py +0 -0
  113. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/handlers/cmake/cmake_constants.py +0 -0
  114. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/modes/__init__.py +0 -0
  115. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/modes/mode_clean/__init__.py +0 -0
  116. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/installer/modes/mode_cmake/__init__.py +0 -0
  117. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer/repository/__init__.py +0 -0
  118. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer.egg-info/dependency_links.txt +0 -0
  119. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer.egg-info/entry_points.txt +0 -0
  120. {xmipp3_installer-1.0.1 → xmipp3_installer-1.1.0}/src/xmipp3_installer.egg-info/top_level.txt +0 -0
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: xmipp3_installer
3
+ Version: 1.1.0
4
+ Summary: Package to handle the installation of Xmipp3
5
+ Author-email: Martín Salinas <ssalinasmartin@gmail.com>
6
+ License: GPL-3.0-only
7
+ Project-URL: Homepage, https://github.com/I2PC/xmipp3-installer
8
+ Project-URL: Issues, https://github.com/I2PC/xmipp3-installer/issues
9
+ Keywords: xmipp3,installer
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ Requires-Dist: typing-extensions>=4.12
23
+ Requires-Dist: distro>=1.9.0
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest==8.*; extra == "test"
26
+ Requires-Dist: pytest-cov==5.*; python_version < "3.9" and extra == "test"
27
+ Requires-Dist: pytest-cov==6.*; python_version >= "3.9" and extra == "test"
28
+ Requires-Dist: pytest-subprocess==1.*; extra == "test"
29
+ Requires-Dist: pytest-localserver==0.*; extra == "test"
30
+ Requires-Dist: ruff==0.*; extra == "test"
31
+ Requires-Dist: cmake==4.*; extra == "test"
32
+ Requires-Dist: ninja==1.*; extra == "test"
33
+ Dynamic: license-file
34
+
35
+ # xmipp3-installer
36
+ Python package that handles the installation of [xmipp3](https://github.com/I2PC/xmipp).
37
+
38
+ ## Installation
39
+ To install the package, simply run:
40
+ ```
41
+ pip install xmipp3-installer
42
+ ```
43
+
44
+ ## Usage
45
+ This package has a CLI built-in, with help messages that explain how to use it.
46
+ To run such help, once the package is installed, run:
47
+ ```
48
+ xmipp3_installer -h
49
+ ```
50
+
51
+ ## Testing the code
52
+ In order to run the tests for this project, the project needs to be installed in development mode and also the test dependencies need to be installed.
53
+
54
+ To do that, you need to clone this project, move inside the repository's folder, and run:
55
+ ```
56
+ pip install -e .[test]
57
+ ```
58
+ Once the dependencies have been installed, the automatic tests for this package can be run using `./scripts/run-tests.sh` in bash, or `.\scripts\run-tests.ps1` in PowerShell.
59
+ If you intend to run this tests from within VSCode, you will need extension `Test Adapter Converter`, and a local `.vscode` folder with a file named `settings.json` inside with the following content:
60
+ ```json
61
+ {
62
+ "python.testing.pytestArgs": [
63
+ ".",
64
+ "--capture=no"
65
+ ],
66
+ "python.testing.unittestEnabled": false,
67
+ "python.testing.pytestEnabled": true
68
+ }
69
+ ```
70
+
71
+ ## SonarQube status
72
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
73
+
74
+ ### Ratings
75
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
76
+ [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
77
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
78
+
79
+ ### Specific metrics
80
+ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
81
+ [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
82
+ [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
83
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=coverage)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
84
+ [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
85
+ [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
86
+ [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=I2PC_xmipp3-installer&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=I2PC_xmipp3-installer)
@@ -1,8 +1,27 @@
1
1
  # xmipp3-installer
2
- Python package that handles the installation of xmipp3
2
+ Python package that handles the installation of [xmipp3](https://github.com/I2PC/xmipp).
3
+
4
+ ## Installation
5
+ To install the package, simply run:
6
+ ```
7
+ pip install xmipp3-installer
8
+ ```
9
+
10
+ ## Usage
11
+ This package has a CLI built-in, with help messages that explain how to use it.
12
+ To run such help, once the package is installed, run:
13
+ ```
14
+ xmipp3_installer -h
15
+ ```
3
16
 
4
17
  ## Testing the code
5
- The automatic tests for this package can be run using `./scripts/run-tests.sh` in bash, or `.\scripts\run-tests.ps1` in PowerShell.
18
+ In order to run the tests for this project, the project needs to be installed in development mode and also the test dependencies need to be installed.
19
+
20
+ To do that, you need to clone this project, move inside the repository's folder, and run:
21
+ ```
22
+ pip install -e .[test]
23
+ ```
24
+ Once the dependencies have been installed, the automatic tests for this package can be run using `./scripts/run-tests.sh` in bash, or `.\scripts\run-tests.ps1` in PowerShell.
6
25
  If you intend to run this tests from within VSCode, you will need extension `Test Adapter Converter`, and a local `.vscode` folder with a file named `settings.json` inside with the following content:
7
26
  ```json
8
27
  {
@@ -0,0 +1,50 @@
1
+ [project]
2
+ name = "xmipp3_installer"
3
+ version = "1.1.0"
4
+ authors = [
5
+ { name = "Martín Salinas", email = "ssalinasmartin@gmail.com" },
6
+ ]
7
+ description = "Package to handle the installation of Xmipp3"
8
+ keywords = ["xmipp3", "installer"]
9
+ classifiers = [
10
+ "Programming Language :: Python :: 3",
11
+ "Programming Language :: Python :: 3.8",
12
+ "Programming Language :: Python :: 3.9",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ "Operating System :: POSIX :: Linux"
19
+ ]
20
+ readme = "README.md"
21
+ license = { text = "GPL-3.0-only" }
22
+
23
+ requires-python = ">=3.8"
24
+ dependencies = [
25
+ "typing-extensions>=4.12",
26
+ "distro>=1.9.0"
27
+ ]
28
+
29
+ [build-system]
30
+ requires = ["setuptools>=75.1", "wheel"]
31
+ build-backend = "setuptools.build_meta"
32
+
33
+ [project.optional-dependencies]
34
+ test = [
35
+ "pytest==8.*",
36
+ "pytest-cov==5.*; python_version < '3.9'",
37
+ "pytest-cov==6.*; python_version >= '3.9'",
38
+ "pytest-subprocess==1.*",
39
+ "pytest-localserver==0.*",
40
+ "ruff==0.*",
41
+ "cmake==4.*",
42
+ "ninja==1.*"
43
+ ]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/I2PC/xmipp3-installer"
47
+ Issues = "https://github.com/I2PC/xmipp3-installer/issues"
48
+
49
+ [project.scripts]
50
+ xmipp3_installer = "xmipp3_installer.__main__:main"
@@ -3,4 +3,4 @@
3
3
  from xmipp3_installer.application.cli.cli import main
4
4
 
5
5
  if __name__ == "__main__":
6
- main()
6
+ main()
@@ -0,0 +1,51 @@
1
+ """### Contains an API client that registers the installation attempts."""
2
+
3
+ import http.client
4
+ import json
5
+ from typing import Dict
6
+ from urllib.parse import urlparse, ParseResult
7
+
8
+ from xmipp3_installer.installer import urls
9
+ from xmipp3_installer.application.logger.logger import logger
10
+
11
+ def send_installation_attempt(installation_info: Dict):
12
+ """
13
+ ### Sends a POST request to Xmipp's metrics's API.
14
+
15
+ #### Params:
16
+ - installation_info (dict): Dictionary containing all the installation information.
17
+ """
18
+ if installation_info is None:
19
+ return
20
+ params = json.dumps(installation_info)
21
+ headers = {"Content-type": "application/json"}
22
+ parsed_url = urlparse(urls.API_URL)
23
+ conn = None
24
+ try:
25
+ conn = __get_https_connection(parsed_url, 6)
26
+ conn.request("POST", parsed_url.path, body=params, headers=headers)
27
+ conn.getresponse()
28
+ except TimeoutError:
29
+ logger(
30
+ logger.yellow("There was a timeout while sending installation data."),
31
+ show_in_terminal=False
32
+ )
33
+ finally:
34
+ if conn is not None:
35
+ conn.close()
36
+
37
+
38
+ def __get_https_connection(parsed_url: ParseResult, timeout_seconds: int) -> http.client.HTTPSConnection:
39
+ """
40
+ ### Establishes the connection needed to send the API call.
41
+
42
+ Separated to enable integration & E2E tests.
43
+
44
+ #### Params:
45
+ - parsed_url (ParseResult): Object containing all elements of the url.
46
+ - timeout_seconds (int): Number of seconds to wait until a timeout.
47
+
48
+ #### Returns:
49
+ - (HTTPSConnection): Established connection.
50
+ """
51
+ return http.client.HTTPSConnection(parsed_url.hostname or "localhost", parsed_url.port, timeout=timeout_seconds)
@@ -0,0 +1,176 @@
1
+ """### Contains functions to assemble the data dictionary required by the API client."""
2
+
3
+ import getpass
4
+ import hashlib
5
+ import platform
6
+ import re
7
+ import os
8
+ from typing import Optional, List, Dict
9
+
10
+ import distro
11
+
12
+ from xmipp3_installer.installer import constants, orquestrator
13
+ from xmipp3_installer.installer.constants import paths
14
+ from xmipp3_installer.installer.handlers import shell_handler, git_handler, versions_manager
15
+ from xmipp3_installer.installer.handlers.cmake import cmake_constants, cmake_handler
16
+
17
+ def get_installation_info(version_manager: versions_manager.VersionsManager, ret_code: int=0) -> Dict:
18
+ """
19
+ ### Creates a dictionary with the necessary data for the API POST message.
20
+
21
+ #### Params:
22
+ - version_manager (VersionsManager): Object containing all the version-related info.
23
+ - ret_code (int): Optional. Return code for the API request.
24
+
25
+ #### Return:
26
+ - (dict): Dictionary with the required info.
27
+ """
28
+ library_versions = cmake_handler.get_library_versions_from_cmake_file(
29
+ paths.LIBRARY_VERSIONS_FILE
30
+ )
31
+ environment_info = orquestrator.run_parallel_jobs(
32
+ [
33
+ __get_cpu_flags,
34
+ git_handler.get_current_branch,
35
+ git_handler.is_branch_up_to_date,
36
+ __is_installed_by_scipion,
37
+ __get_log_tail
38
+ ],
39
+ [(), (), (), (), ()]
40
+ )
41
+
42
+ return {
43
+ "user": {
44
+ "userId": __get_user_id()
45
+ },
46
+ "version": {
47
+ "os": get_os_release_name(),
48
+ "cpuFlags": environment_info[0],
49
+ "cuda": library_versions.get(cmake_constants.CMAKE_CUDA),
50
+ "cmake": library_versions.get(cmake_constants.CMAKE_CMAKE),
51
+ "gcc": library_versions.get(cmake_constants.CMAKE_GCC),
52
+ "gpp": library_versions.get(cmake_constants.CMAKE_GPP),
53
+ "mpi": library_versions.get(cmake_constants.CMAKE_MPI),
54
+ "python": library_versions.get(cmake_constants.CMAKE_PYTHON),
55
+ "sqlite": library_versions.get(cmake_constants.CMAKE_SQLITE),
56
+ "java": library_versions.get(cmake_constants.CMAKE_JAVA),
57
+ "hdf5": library_versions.get(cmake_constants.CMAKE_HDF5),
58
+ "jpeg": library_versions.get(cmake_constants.CMAKE_JPEG)
59
+ },
60
+ "xmipp": {
61
+ "branch": __get_installation_branch_name(
62
+ environment_info[1], version_manager
63
+ ),
64
+ "updated": environment_info[2],
65
+ "installedByScipion": environment_info[3]
66
+ },
67
+ "returnCode": ret_code,
68
+ "logTail": environment_info[4] if ret_code else None # Only needed if something went wrong
69
+ }
70
+
71
+ def get_os_release_name() -> str:
72
+ """
73
+ ### Returns the name of the current system OS release.
74
+
75
+ #### Returns:
76
+ - (str): OS release name.
77
+ """
78
+ platform_system = platform.system()
79
+ if platform_system == "Linux":
80
+ return f"{distro.name()} {distro.version()}"
81
+ return f"{platform_system} {platform.release()}"
82
+
83
+ def __get_installation_branch_name(branch_name: str, version_manager: versions_manager.VersionsManager) -> str:
84
+ """
85
+ ### Returns the branch or release name of Xmipp.
86
+
87
+ #### Params:
88
+ - branch_name (str): Retrieved branch name.
89
+ - version_manager (VersionsManager): Object containing all the version-related info.
90
+
91
+ #### Return:
92
+ - (str): Release name if Xmipp is in a release branch, or the branch name otherwise.
93
+ """
94
+ if not branch_name or branch_name == constants.MASTER_BRANCHNAME:
95
+ return version_manager.xmipp_version_number
96
+ return branch_name
97
+
98
+ def __get_user_id() -> str:
99
+ """
100
+ ### Returns the unique user id for this machine.
101
+
102
+ #### Returns:
103
+ - (str): User id, or 'Anoymous' if there were any errors.
104
+ """
105
+ identifier = __get_mac_address()
106
+ if not identifier:
107
+ identifier = getpass.getuser()
108
+ if not identifier:
109
+ return "Anonymous"
110
+
111
+ sha256 = hashlib.sha256()
112
+ sha256.update(identifier.encode())
113
+ return sha256.hexdigest()
114
+
115
+ def __get_cpu_flags() -> List[str]:
116
+ """
117
+ ### This function obtains the list of compilation flags supported by the CPU.
118
+
119
+ #### Returns:
120
+ - (list(str)): List of flags supported by the CPU.
121
+ """
122
+ flags_header = "Flags:"
123
+ ret_code, flags_line = shell_handler.run_shell_command(f'lscpu | grep \"{flags_header}\"')
124
+ if ret_code:
125
+ return []
126
+ flags_line = flags_line.replace(flags_header, "").strip()
127
+ return [flag for flag in flags_line.split(" ") if flag]
128
+
129
+ def __get_log_tail() -> Optional[str]:
130
+ """
131
+ ### Returns the last lines of the installation log.
132
+
133
+ #### Returns:
134
+ - (str | None): Installation log's last lines, or None if there were any errors.
135
+ """
136
+ ret_code, output = shell_handler.run_shell_command(
137
+ f"tail -n {constants.TAIL_LOG_NCHARS} {paths.LOG_FILE}"
138
+ )
139
+ return output if ret_code == 0 else None
140
+
141
+ def __get_mac_address() -> Optional[str]:
142
+ """
143
+ ### Returns a physical MAC address for this machine. It prioritizes ethernet over wireless.
144
+
145
+ #### Returns:
146
+ - (str | None): MAC address, or None if there were any errors.
147
+ """
148
+ ret_code, output = shell_handler.run_shell_command("ip addr")
149
+ return __find_mac_address_in_lines(output.split('\n')) if ret_code == 0 else None
150
+
151
+ def __find_mac_address_in_lines(lines: List[str]) -> Optional[str]:
152
+ """
153
+ ### Returns a physical MAC address within the text lines provided.
154
+
155
+ #### Params:
156
+ - lines (list(str)): Lines of text where MAC address should be looked for.
157
+
158
+ #### Returns:
159
+ - (str | None): MAC address if found, None otherwise.
160
+ """
161
+ for line_index in range(len(lines) - 1):
162
+ match = re.match(r"^\d+: (enp|wlp|eth|ens|eno)\w+", lines[line_index])
163
+ if not match:
164
+ continue
165
+ mac_match = re.search(r"link/ether ([0-9a-f:]{17})", lines[line_index + 1])
166
+ if mac_match:
167
+ return mac_match.group(1)
168
+
169
+ def __is_installed_by_scipion() -> bool:
170
+ """
171
+ ### Checks if the current xmipp installation is being carried out from Scipion.
172
+
173
+ #### Returns:
174
+ - (bool): True if the installation is executed by Scipion, False otherwise.
175
+ """
176
+ return bool(os.getenv("SCIPION_SOFTWARE"))
@@ -1,8 +1,9 @@
1
1
  """### Containis all common constants needed for the argument parsing part of Xmipp's installation."""
2
2
 
3
+ from xmipp3_installer.installer.constants import paths
4
+
3
5
  XMIPP_PROGRAM_NAME = "xmipp"
4
6
 
5
7
  # Other variables
6
8
  COMMON_USAGE_HELP_MESSAGE = 'Run \"./xmipp -h\" for usage help.'
7
- DEFAULT_BUILD_DIR = 'build'
8
- DEFAULT_MODELS_DIR = DEFAULT_BUILD_DIR
9
+ DEFAULT_MODELS_DIR = paths.INSTALL_PATH
@@ -0,0 +1,147 @@
1
+ """### Containis all mode constants needed for the argument parsing part of Xmipp's installation."""
2
+
3
+ from xmipp3_installer.application.cli import arguments
4
+ from xmipp3_installer.application.cli.arguments.params import (
5
+ PARAM_SHORT, PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT, PARAM_OVERWRITE,
6
+ PARAM_MODELS_DIRECTORY, PARAM_TEST_NAMES, PARAM_SHOW_TESTS, PARAM_GIT_COMMAND,
7
+ PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE, PARAMS, PARAM_ALL_FUNCTIONS,
8
+ PARAM_ALL_PROGRAMS, SHORT_VERSION, LONG_VERSION
9
+ )
10
+ from xmipp3_installer.installer import urls, constants
11
+
12
+ MODE = "mode"
13
+
14
+ # Mode list (alphabetical order)
15
+ MODE_ADD_MODEL = 'addModel'
16
+ MODE_ALL = 'all'
17
+ MODE_CLEAN_ALL = 'cleanAll'
18
+ MODE_CLEAN_BIN = 'cleanBin'
19
+ MODE_COMPILE_AND_INSTALL = 'compileAndInstall'
20
+ MODE_CONFIG_BUILD = 'configBuild'
21
+ MODE_CONFIG = 'config'
22
+ MODE_GET_MODELS = 'getModels'
23
+ MODE_GET_SOURCES = 'getSources'
24
+ MODE_GIT = 'git'
25
+ MODE_TEST = 'test'
26
+ MODE_VERSION = 'version'
27
+
28
+ # Modes with help message
29
+ MODES = {
30
+ 'General': {
31
+ MODE_VERSION: ['Returns the version information. Add \'--short\' to print only the version number.'],
32
+ MODE_COMPILE_AND_INSTALL: ['Compiles and installs Xmipp based on already obtained sources.'],
33
+ MODE_ALL: [f'Default param. Runs {MODE_CONFIG}, {MODE_CONFIG_BUILD}, and {MODE_COMPILE_AND_INSTALL}.'],
34
+ MODE_CONFIG_BUILD: ['Configures the project with CMake.']
35
+ },
36
+ 'Config': {
37
+ MODE_CONFIG: ['Generates a config file template with default values.'],
38
+ },
39
+ 'Downloads': {
40
+ MODE_GET_MODELS: [
41
+ f'Downloads the Deep Learning Models required by the DLTK tools at dir/models ({arguments.DEFAULT_MODELS_DIR} by default).',
42
+ f'Visit {urls.DLTK_DOCS_URL} for more details.'
43
+ ],
44
+ MODE_GET_SOURCES: [f'Clones Xmipp\'s source repositories {constants.XMIPP_CORE} & {constants.XMIPP_VIZ}.']
45
+ },
46
+ 'Clean': {
47
+ MODE_CLEAN_BIN: ['Removes all compiled binaries.'],
48
+ MODE_CLEAN_ALL: ['Removes all compiled binaries and sources, leaves the repository as if freshly cloned (without pulling).']
49
+ },
50
+ 'Test': {
51
+ MODE_TEST: [
52
+ 'Runs Xmipp\'s tests.',
53
+ f'If used with \'{PARAMS[PARAM_TEST_NAMES][SHORT_VERSION]}\', only the tests provided will run.',
54
+ f'If used with \'{PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}\', a list the tests available and how to invoke them will be shown.',
55
+ f'If used with \'{PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}\', all function tests will run.',
56
+ f'If used with \'{PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}\', all program tests will run.'
57
+ ]
58
+ },
59
+ 'Developers': {
60
+ MODE_GIT: ['Runs the given git action for all source repositories.'],
61
+ MODE_ADD_MODEL: [
62
+ "Takes a DeepLearning model from the modelPath, makes a tgz of it and uploads the .tgz according to the <login>.",
63
+ "This mode is used to upload a model folder to the Scipion/Xmipp server.",
64
+ "Usually the model folder contains big files used to feed deep learning procedures "
65
+ "with pretrained data. All the models stored in the server will be downloaded "
66
+ "using the 'get_models' mode, during the compilation/installation time, "
67
+ "or with scipion3 installb deepLearningToolkit.",
68
+ "Param <modelsPath> must be an absolute path.",
69
+ "",
70
+ "Usage: -> ./xmipp addModel <usr@server> <modelsPath> [--update]",
71
+ "Steps: 0. modelName = basename(modelsPath) <- Please, check the folders name!",
72
+ " 1. Packing in 'xmipp_model_modelName.tgz'",
73
+ " 2. Check if that model already exists (use --update to override an existing model)",
74
+ " 3. Upload the model to the server.",
75
+ " 4. Update the MANIFEST file.",
76
+ "",
77
+ "The model name will be the folder name in <modelsPath>",
78
+ "Must have write permissions to such machine."
79
+ ]
80
+ }
81
+ }
82
+
83
+ # Arguments of each mode, sorted by group
84
+ # Inside each mode, params are grouped by mutually exclusive groups
85
+ # For example: MYMODE: [[PARAM1, PARAM2], [PARAM3, PARAM4]] would translate to
86
+ # "mymode ([param1] [param2] | [param3] [param4])" in the general help message
87
+ MODE_ARGS = {
88
+ MODE_VERSION: [PARAM_SHORT],
89
+ MODE_COMPILE_AND_INSTALL: [PARAM_JOBS, PARAM_KEEP_OUTPUT],
90
+ MODE_ALL: [PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT],
91
+ MODE_CONFIG_BUILD: [PARAM_KEEP_OUTPUT],
92
+ MODE_CONFIG: [PARAM_OVERWRITE],
93
+ MODE_GET_MODELS: [PARAM_MODELS_DIRECTORY],
94
+ MODE_GET_SOURCES: [PARAM_BRANCH, PARAM_KEEP_OUTPUT],
95
+ MODE_CLEAN_BIN: [],
96
+ MODE_CLEAN_ALL: [],
97
+ MODE_TEST: [[PARAM_TEST_NAMES], [PARAM_SHOW_TESTS], [PARAM_ALL_FUNCTIONS], [PARAM_ALL_PROGRAMS]],
98
+ MODE_GIT: [PARAM_GIT_COMMAND],
99
+ MODE_ADD_MODEL: [PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE]
100
+ }
101
+
102
+ # Examples for the help message of each mode
103
+ MODE_EXAMPLES = {
104
+ MODE_VERSION: [
105
+ f'./xmipp {MODE_VERSION}',
106
+ f'./xmipp {MODE_VERSION} {PARAMS[PARAM_SHORT][LONG_VERSION]}',
107
+ ],
108
+ MODE_COMPILE_AND_INSTALL: [
109
+ f'./xmipp {MODE_COMPILE_AND_INSTALL}',
110
+ f'./xmipp {MODE_COMPILE_AND_INSTALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
111
+ ],
112
+ MODE_ALL: [
113
+ './xmipp',
114
+ f'./xmipp {MODE_ALL}',
115
+ f'./xmipp {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
116
+ f'./xmipp {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel',
117
+ f'./xmipp {MODE_ALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20 '
118
+ f'{PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
119
+ ],
120
+ MODE_CONFIG_BUILD: [],
121
+ MODE_CONFIG: [
122
+ f'./xmipp {MODE_CONFIG} {PARAMS[PARAM_OVERWRITE][LONG_VERSION]}'
123
+ ],
124
+ MODE_GET_MODELS: [
125
+ f'./xmipp {MODE_GET_MODELS}',
126
+ f'./xmipp {MODE_GET_MODELS} {PARAMS[PARAM_MODELS_DIRECTORY][SHORT_VERSION]} /path/to/my/model/directory'
127
+ ],
128
+ MODE_GET_SOURCES: [
129
+ f'./xmipp {MODE_GET_SOURCES}'
130
+ f'./xmipp {MODE_GET_SOURCES} {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
131
+ ],
132
+ MODE_CLEAN_BIN: [],
133
+ MODE_CLEAN_ALL: [],
134
+ MODE_TEST: [
135
+ f'./xmipp {MODE_TEST} xmipp_sample_test',
136
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}',
137
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}',
138
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}'
139
+ ],
140
+ MODE_GIT: [
141
+ f'./xmipp {MODE_GIT} pull',
142
+ f'./xmipp {MODE_GIT} checkout devel'
143
+ ],
144
+ MODE_ADD_MODEL: [
145
+ f'./xmipp {MODE_ADD_MODEL} myuser@127.0.0.1 /home/myuser/mymodel'
146
+ ]
147
+ }
@@ -0,0 +1,86 @@
1
+ """### Containis all param constants needed for the argument parsing part of Xmipp's installation."""
2
+
3
+ from xmipp3_installer.application.cli import arguments
4
+
5
+ # Definition of all params found in the
6
+ SHORT_VERSION = 'short'
7
+ LONG_VERSION = 'long'
8
+ DESCRIPTION = 'description'
9
+
10
+ # Possible param list
11
+ PARAM_SHORT = 'short'
12
+ PARAM_JOBS = 'jobs'
13
+ PARAM_BRANCH = 'branch'
14
+ PARAM_MODELS_DIRECTORY = 'directory'
15
+ PARAM_TEST_NAMES = 'testNames'
16
+ PARAM_SHOW_TESTS = 'show'
17
+ PARAM_ALL_FUNCTIONS = 'all_functions'
18
+ PARAM_ALL_PROGRAMS = 'all_programs'
19
+ PARAM_GIT_COMMAND = 'command'
20
+ PARAM_LOGIN = 'login'
21
+ PARAM_MODEL_PATH = 'modelPath'
22
+ PARAM_UPDATE = 'update'
23
+ PARAM_OVERWRITE = 'overwrite'
24
+ PARAM_KEEP_OUTPUT = "keep_output"
25
+ PARAMS = {
26
+ PARAM_SHORT: {
27
+ LONG_VERSION: "--short",
28
+ DESCRIPTION: "If set, only version number is shown."
29
+ },
30
+ PARAM_JOBS: {
31
+ SHORT_VERSION: "-j",
32
+ LONG_VERSION: "--jobs",
33
+ DESCRIPTION: "Number of jobs. Defaults to all available."
34
+ },
35
+ PARAM_BRANCH: {
36
+ SHORT_VERSION: "-b",
37
+ LONG_VERSION: "--branch",
38
+ DESCRIPTION: "Branch for the source repositories."
39
+ },
40
+ PARAM_MODELS_DIRECTORY: {
41
+ SHORT_VERSION: "-d",
42
+ LONG_VERSION: "--directory",
43
+ DESCRIPTION: f"Directory where models will be saved. Default is \"{arguments.DEFAULT_MODELS_DIR}\"."
44
+ },
45
+ PARAM_TEST_NAMES: {
46
+ SHORT_VERSION: PARAM_TEST_NAMES,
47
+ DESCRIPTION: "Name of the tests to run."
48
+ },
49
+ PARAM_SHOW_TESTS: {
50
+ LONG_VERSION: "--show",
51
+ DESCRIPTION: "Shows the tests available and how to invoke those."
52
+ },
53
+ PARAM_ALL_FUNCTIONS : {
54
+ LONG_VERSION: "--all-functions",
55
+ DESCRIPTION: "If set, all function tests will be run."
56
+ },
57
+ PARAM_ALL_PROGRAMS : {
58
+ LONG_VERSION: "--all-programs",
59
+ DESCRIPTION: "If set, all program tests will be run."
60
+ },
61
+ PARAM_GIT_COMMAND: {
62
+ SHORT_VERSION: PARAM_GIT_COMMAND,
63
+ DESCRIPTION: "Git command to run on all source repositories."
64
+ },
65
+ PARAM_LOGIN: {
66
+ SHORT_VERSION: "login",
67
+ DESCRIPTION: "Login (usr@server) for remote host to upload the model with. Must have write permissions to such machine."
68
+ },
69
+ PARAM_MODEL_PATH: {
70
+ SHORT_VERSION: PARAM_MODEL_PATH,
71
+ DESCRIPTION: "Path to the model to upload to remote host."
72
+ },
73
+ PARAM_UPDATE: {
74
+ LONG_VERSION: "--update",
75
+ DESCRIPTION: "Flag to update an existing model"
76
+ },
77
+ PARAM_OVERWRITE: {
78
+ SHORT_VERSION: "-o",
79
+ LONG_VERSION: "--overwrite",
80
+ DESCRIPTION: "If set, current config file will be overwritten with a new one."
81
+ },
82
+ PARAM_KEEP_OUTPUT: {
83
+ LONG_VERSION: "--keep-output",
84
+ DESCRIPTION: "If set, output sent through the terminal won't substitute lines, looking more like the log."
85
+ }
86
+ }