Dependency and version management.#
dependencies#
Simtools dependencies version management.
This modules provides two main functionalities:
retrieve the versions of simtools dependencies (e.g., databases, sim_telarray, CORSIKA)
provide space for future implementations of version management
- dependencies.get_build_options(run_time=None)[source]#
Return CORSIKA / sim_telarray build options.
Expects a build_opts.yml file in the sim_telarray directory.
- Parameters:
- run_timelist, optional
Runtime environment command (e.g., Docker).
- Returns:
- dict
Build options from build_opts.yml file.
- dependencies.get_corsika_version(run_time=None)[source]#
Get the version of the CORSIKA package.
- Parameters:
- run_timelist, optional
Runtime environment command (e.g., Docker).
- Returns:
- str
Version of the CORSIKA package.
- dependencies.get_database_version_or_name(db_config, version=True)[source]#
Get the version or name of the simulation model data base used.
- Parameters:
- db_configdict
Dictionary containing the database configuration.
- versionbool
If True, return the version of the database. If False, return the name.
- Returns:
- str
Version or name of the simulation model data base used.
- dependencies.get_sim_telarray_version(run_time)[source]#
Get the version of the sim_telarray package using ‘sim_telarray –version’.
- Parameters:
- run_timelist, optional
Runtime environment command (e.g., Docker).
- Returns:
- str
Version of the sim_telarray package.
- dependencies.get_version_string(db_config=None, run_time=None)[source]#
Print the versions of the dependencies.
- Parameters:
- db_configdict, optional
Database configuration dictionary.
- run_timelist, optional
Runtime environment command (e.g., Docker).
- Returns:
- str
String containing the versions of the dependencies.
version#
Software version setting.
- version.resolve_version_to_latest_patch(partial_version, available_versions)[source]#
Resolve a partial version (major.minor) to the latest patch version.
Given a partial version string (e.g., “6.0”) and a list of available versions, finds the latest patch version that matches the major.minor pattern.
- Parameters:
- partial_versionstr
Partial version string in format “major.minor” (e.g., “6.0”, “5.2”)
- available_versionslist of str
List of available semantic versions (e.g., [“5.0.0”, “5.0.1”, “6.0.0”, “6.0.2”])
- Returns:
- str
Latest patch version matching the partial version pattern
- Raises:
- ValueError
If partial_version is not in major.minor format
- ValueError
If no matching versions are found
Examples
>>> versions = ["5.0.0", "5.0.1", "6.0.0", "6.0.2", "6.1.0"] >>> resolve_version_to_latest_patch("6.0", versions) '6.0.2' >>> resolve_version_to_latest_patch("5.0", versions) '5.0.1' >>> resolve_version_to_latest_patch("5.0.1", versions) '5.0.1'