Skip to content

Conversation

@GernotMaier
Copy link
Contributor

@GernotMaier GernotMaier commented Dec 19, 2025

Improved version and build info handling:

  • simtools application prints at startup now the simtools, database, CORSIKA, and sim_telarray versions
  • simtools applications output full build information for log level DEBUG
  • added two new command line options:
    • --build_info to print detailed build information of the application
    • --export_build_info EXPORT_BUILD_INFO export build information to file (json or yaml format)
  • removed applications simtools-print-version (above functionality replaces it)
  • Changed path to sim_telarray to SIMTOOLS_SIM_TELARRAY_PATH (from SIMTOOLS_SIMTEL_PATH). This is consistent with the naming of the simulation software packages and the schema values. Requires changes by the users to their .env files.

Examples

Main version printout:

simtools-db-get-parameter-from-db  --parameter num_gains --site North --telescope LSTN-design --parameter_version 1.0.0
INFO::application_control(l177)::_version_info::simtools: 0.25.1.dev344+gcc0bcd787 DB: CTAO-Simulation-Model v0.12.0 CORSIKA: 78010 sim_telarray: master
....

With log level debug:

 simtools-db-get-parameter-from-db  --parameter num_gains --site North --telescope LSTN-design --parameter_version 1.0.0 --log_level debug
INFO::application_control(l177)::_version_info::simtools: 0.25.1.dev344+gcc0bcd787 DB: CTAO-Simulation-Model v0.12.0 CORSIKA: 78010 sim_telarray: master
DEBUG::application_control(l184)::_version_info::Build options:
 {'corsika_version': '78010', 'corsika_opt_patch_version': 'v1.1.0', 'corsika_config_version': 'v0.1.0', 'avx_flag': 'no_opt', 'variant': [{'executable': 'corsika_epos_urqmd_curved', 'config': 'config_epos_urqmd_curved', 'atmosphere_geometry': 'curved', 'he_hadronic_model': 'epos', 'le_hadronic_model': 'urqmd'}, {'executable': 'corsika_epos_urqmd_flat', 'config': 'config_epos_urqmd_flat', 'atmosphere_geometry': 'flat', 'he_hadronic_model': 'epos', 'le_hadronic_model': 'urqmd'}, {'executable': 'corsika_qgs3_urqmd_curved', 'config': 'config_qgs3_urqmd_curved', 'atmosphere_geometry': 'curved', 'he_hadronic_model': 'qgs3', 'le_hadronic_model': 'urqmd'}, {'executable': 'corsika_qgs3_urqmd_flat', 'config': 'config_qgs3_urqmd_flat', 'atmosphere_geometry': 'flat', 'he_hadronic_model': 'qgs3', 'le_hadronic_model': 'urqmd'}], 'simtel_version': 'master', 'hessio_version': 'master', 'stdtools_version': 'master', 'extra_defines': '-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99', 'build_date': '2025-12-17T20:10:25Z', 'components': [{'name': 'hessioxxx', 'version': 'master', 'build_flags': 'DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG'}, {'name': 'stdtools', 'version': 'master', 'build_flags': 'EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG'}, {'name': 'sim_telarray', 'version': 'master', 'build_flags': 'EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG', 'executables': ['sim_telarray']}, {'name': 'sim_telarray_debug_trace', 'version': 'master', 'build_flags': 'EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DDEBUG_TRACE_99 -DWITH_GSL -DWITH_GSL_RNG', 'executables': ['sim_telarray_debug_trace']}]}
DEBUG::mongo_db(l165)::_initialize_client::MongoDB client initialized successfully.
...

and with an output file:

simtools-db-get-parameter-from-db --parameter num_gains --site North --telescope LSTN-design --parameter_version 1.0.0 --export_build_info tt.json

gives you:

 cat simtools-output/tt.json
{
    "corsika_version": "78010",
    "corsika_opt_patch_version": "v1.1.0",
    "corsika_config_version": "v0.1.0",
    "avx_flag": "no_opt",
    "variant": [
        {
            "executable": "corsika_epos_urqmd_curved",
            "config": "config_epos_urqmd_curved",
            "atmosphere_geometry": "curved",
            "he_hadronic_model": "epos",
            "le_hadronic_model": "urqmd"
        },
        {
            "executable": "corsika_epos_urqmd_flat",
            "config": "config_epos_urqmd_flat",
            "atmosphere_geometry": "flat",
            "he_hadronic_model": "epos",
            "le_hadronic_model": "urqmd"
        },
        {
            "executable": "corsika_qgs3_urqmd_curved",
            "config": "config_qgs3_urqmd_curved",
            "atmosphere_geometry": "curved",
            "he_hadronic_model": "qgs3",
            "le_hadronic_model": "urqmd"
        },
        {
            "executable": "corsika_qgs3_urqmd_flat",
            "config": "config_qgs3_urqmd_flat",
            "atmosphere_geometry": "flat",
            "he_hadronic_model": "qgs3",
            "le_hadronic_model": "urqmd"
        }
    ],
    "simtel_version": "master",
    "hessio_version": "master",
    "stdtools_version": "master",
    "extra_defines": "-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99",
    "build_date": "2025-12-17T20:10:25Z",
    "components": [
        {
            "name": "hessioxxx",
            "version": "master",
            "build_flags": "DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG"
        },
        {
            "name": "stdtools",
            "version": "master",
            "build_flags": "EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG"
        },
        {
            "name": "sim_telarray",
            "version": "master",
            "build_flags": "EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DWITH_GSL -DWITH_GSL_RNG",
            "executables": [
                "sim_telarray"
            ]
        },
        {
            "name": "sim_telarray_debug_trace",
            "version": "master",
            "build_flags": "EXTRA_DEFINES=-DCTA_PROD6 -DMAXIMUM_TELESCOPES=99 -DDEBUG_TRACE_99 -DWITH_GSL -DWITH_GSL_RNG",
            "executables": [
                "sim_telarray_debug_trace"
            ]
        }
    ],
    "simtools": "0.25.1.dev344+gcc0bcd787",
    "database_name": "CTAO-Simulation-Model",
    "database_version": "v0.12.0"
}

@GernotMaier GernotMaier self-assigned this Dec 19, 2025
@GernotMaier GernotMaier marked this pull request as ready for review December 19, 2025 14:13
Copilot AI review requested due to automatic review settings December 19, 2025 14:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves version and build information handling across the simtools application by consolidating version printing functionality, renaming environment variables for consistency, and adding new command-line options for build information export.

Key changes include:

  • Renamed environment variable from SIMTOOLS_SIMTEL_PATH to SIMTOOLS_SIM_TELARRAY_PATH for consistency with software naming
  • Added --build_info and --export_build_info command-line options to all applications
  • Implemented automatic version information printing at application startup
  • Removed the standalone simtools-print-version application (functionality now integrated into all applications)

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/simtools/utils/general.py Added load_environment_variables() utility function for reading .env files
src/simtools/settings.py Updated to use SIMTOOLS_SIM_TELARRAY_PATH environment variable
src/simtools/dependencies.py Added export_build_info() and _get_package_path() functions; refactored get_build_options()
src/simtools/configuration/configurator.py Refactored to use new load_environment_variables() utility
src/simtools/configuration/commandline_parser.py Added BuildInfoAction class and new CLI arguments --build_info and --export_build_info
src/simtools/application_control.py Added _version_info() function for startup version printing
src/simtools/applications/simulate_prod_htcondor_generator.py Updated documentation to reference new environment variable name
src/simtools/applications/print_version.py Removed file (functionality integrated into all applications)
pyproject.toml Removed simtools-print-version script entry
tests/unit_tests/utils/test_general.py Added comprehensive tests for load_environment_variables()
tests/unit_tests/test_dependencies.py Added tests for new functions and updated mocks for path handling
tests/unit_tests/test_application_control.py Added tests for _version_info() function
tests/unit_tests/test_settings.py Updated tests to use new environment variable name
tests/unit_tests/testing/test_helpers.py Updated tests to use new environment variable name
tests/unit_tests/simtel/test_simtel_config_writer.py Updated comment referencing sim_telarray path
tests/unit_tests/ray_tracing/test_mirror_panel_psf.py Updated test data to use new path variable name
tests/unit_tests/configuration/test_configurator.py Updated tests to use new environment variable name
tests/unit_tests/configuration/test_commandline_parser.py Added test for BuildInfoAction
tests/conftest.py Updated environment variable setup for test fixtures
tests/integration_tests/config/print_version.yml Removed integration test config for deleted application
.env_template Updated environment variable name in template
.github/workflows/build-simtools-legacy.yml Updated CI workflow to use new environment variable and removed print-version step
.github/workflows/CI-integrationtests.yml Updated CI workflow to use new environment variable and removed print-version step
docs/source/user-guide/applications.md Removed reference to simtools-print-version application
docs/source/user-guide/applications/simtools-print-version.rst Removed documentation file for deleted application
docs/changes/1957.feature.md Added feature changelog entry
docs/changes/1957.api.md Added API change changelog entry

GernotMaier and others added 3 commits December 19, 2025 16:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ctao-sonarqube
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants