The imsi API
This section describes the imsi Application Programming Interface (API).
Command line interface (cli.py) and link to backend (ui_manager.py)
- imsi.user_interface.ui_manager.apply_options(options_config: Dict, configuration: Configuration, selected_option_names: Dict) Configuration[source]
Take a set of options or ‘patches’ and apply them to the simulation configuration and return an updated configuration.
Input:
- selected_optionsdict
k-v pairs of option name and selection
- imsi.user_interface.ui_manager.build_run_config_on_disk(configuration: Configuration, db: ConfigDatabase, track=True, force=False)[source]
This actually creates the physical config directory on disk, and extracts/modifies various relevant files
- imsi.user_interface.ui_manager.compile_model_execs(args)[source]
Builds all component executables by calling an upstream script from the repository. Pretty rough go. Is it useful abstracting this in imsi TDB.
- imsi.user_interface.ui_manager.create_imsi_configuration(imsi_config_path: str, setup_params: ~typing.Dict) -> (<class 'imsi.config_manager.config_manager.Configuration'>, <class 'imsi.config_manager.databases.ConfigDatabase'>)[source]
Build and return configuration instance and config db given imsi_config_path
- imsi.user_interface.ui_manager.load_run_config(config_filename: str = '.imsi/.imsi_configuration_*.pickle') Configuration[source]
Try to load a imsi statefile either from the PWD, or if not, try $WRK_DIR
This function is re-instantiating the configuration object, which does not exist between independent calls to the gui.
- imsi.user_interface.ui_manager.query_time()[source]
Instantiate the configuration / SimulationTime instances and enable querying timers
- imsi.user_interface.ui_manager.reload_config_from_source(force=False)[source]
Build a new config directory from upstream imsi source
This will re-extract everthing out of the cloned repository to re-create the config directory. I.e. if one made changes in the repo after setup, and wanted to apply them, they would call this update function.
- imsi.user_interface.ui_manager.set_selections(parm_file=None, selections=None, options=None, force=False)[source]
Parse key=value pairs of selection given on the command line Try to apply these to the imsi selections for the sim.
- imsi.user_interface.ui_manager.submit_run()[source]
Instantiate the configuration object and submit job to queue
- imsi.user_interface.ui_manager.update_config_from_state(force=False)[source]
Apply changes made in the “imsi_configuration_${runid}” state file to the configuration and update the config directory as appropriate.
- imsi.user_interface.ui_manager.validate_version_reqs(source_config_path: Path = PosixPath('src/imsi-config'), version_req_file: str = 'version_requirements.yaml')[source]
Checks the version requirements contained in the version controlled config files.
The imsi minor version is toggled when there are config breaking changes, as such we only require the major and minor version match.
- TODO:
update output to better inform users on how to find/build the right environments
Configuration manager (config_manager.py)
This module provides classes and utilities for managing configurations, including models, experiments, machines, compilers, and their interactions.
The module includes classes for defining configuration elements such as Model, Experiment, Machine, and Compiler. Additionally, it provides a Configuration class for composing these elements into a complete configuration.
ConfigManager is a class used to establish configuration objects and facilitate saving and loading configurations for later use. The module also includes abstract classes such as ConfigDatabase for defining an abstract interface for a configuration database and its concrete implementation JsonConfigDatabase.
Lastly, the module contains Factory classes (eg. CompilerFactory), which provide methods for creating instances of analogous classes (eg. Compiler).
The module is designed to support flexibility in configuration management, allowing configurations to be composed, serialized, and deserialized.
This module is a WIP. It is next required to create infrastructure modules that use the configurations created here.
Neil Swart, April 2024
- class imsi.config_manager.config_manager.CompilerFactory[source]
Bases:
objectClass containing methods to instantiate an instance of Compiler. Like for machines, several parsing functions are required and encapsulated here.
- class imsi.config_manager.config_manager.ConfigManager(db: ConfigDatabase = None)[source]
Bases:
objectThis class is used to establish configuration objects, as well as save/load them for later use
- create_configuration(model_name: str, experiment_name: str, machine_name: str = '', compiler_name: str = '', sequencer_name: str = '', flow_name: str = '', postproc_profile: str = '', **kwargs)[source]
Create the individual instances of config elements and return a configuration composed of these
- create_postproc(model: Model, experiment: Experiment, postproc_profile: str) PostProcessing[source]
- create_sequencing(machine: Machine, sequencer_name: str, flow_name: str, experiment: Experiment) Sequencing[source]
- load_configuration(filepath) Configuration[source]
Load the configuration from a file
- load_state(filepath) Configuration[source]
Load the configuration state from a file
- classmethod save_configuration(configuration: Configuration, filepath: str)[source]
Save the configuration to a file
- classmethod save_state(configuration: Configuration, filepath: str)[source]
Pickle the configuration object
- class imsi.config_manager.config_manager.Configuration(*, model: Model, experiment: Experiment, components: Components, machine: Machine, compiler: Compiler, postproc: PostProcessing, setup_params: SetupParams, utilities: Utilities, sequencing: Sequencing)[source]
Bases:
BaseModelContainer class that combines sub-configurations and serves as the goto reference defining the configuration of a simulation.
- compiler: Compiler
- components: Components
- experiment: Experiment
- get_unique_key_value(key: str)[source]
Search recursively through the nested dicts of the configuration to try and find a specified key and return its value if the key is unique. If mulitple instances of they key exist, return an error.
- machine: Machine
- model: Model
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(_Configuration__context)[source]
Used to specifically update defaults only for specific configs
- postproc: PostProcessing
- sequencing: Sequencing
- setup_params: SetupParams
- utilities: Utilities
- class imsi.config_manager.config_manager.ExperimentFactory[source]
Bases:
objectClass containing methods to instantiate an instance of Experiment. On particular check that the model and experiment are consistent
- class imsi.config_manager.config_manager.PostprocFactory[source]
Bases:
objectClass containing methods to instantiate an instance of Postprocessing. Fetch default from Experiment object (preferred) or Model object (backup) if postproc is not set by the user.
- class imsi.config_manager.config_manager.SequencingFactory[source]
Bases:
objectClass containing methods to instantiate an instance of Sequencing. Like for machines, several parsing functions are required and encapsulated here.
- static create_from_database(db: ConfigDatabase, machine: Machine, sequencer_name: str, flow_name: str = None, model_type: str = None)[source]
Create a sequencing instance given the config db, the machine, sequencer and flow names
- static determine_default_flow(model_type: str, sequencer_name: str, sequencer_baseflows: dict, flows, machine: Machine)[source]
Get the default sequencing flow, which handles the selected model_type, and also has configuration support for the selected sequencer and machine.
- Parameters:
model_type (str): The model configuration, e.g. ESM, AMIP or OMIP
Shell interface
Generates the shell interface to the modelling system.
In general this means creating a “config” directory with various files that the model and downstream utilities ingest, such as namelists, and shell_parameters files.
- imsi.shell_interface.shell_interface_manager.build_config_dir(db: ConfigDatabase, configuration: Configuration, track=True, force=False)[source]
Main composition function to manange the build the config directory with appropriately parsed content
- imsi.shell_interface.shell_comp_environment.generate_compilation_template(configuration: Configuration)[source]
Generate the compilation_template file contents based on a Configuraiton instance
Here we just generate and return a list of strings, that will be written to file elsewhere using a common tool.
- imsi.shell_interface.shell_comp_environment.generate_computational_environment(comp_env: dict, machine_name, compiler_name: str = None) List[str][source]
Generate content of a file that can be sourced in a shell to set the computational environment for compiling and running the model.
Here we just generate and return a list of strings, that will be written to file elsewhere using a common tool.
- imsi.shell_interface.shell_comp_environment.generate_computational_environment_controller(machine_config: Machine, run_config_path: str, basename_prefix: str = None) List[str][source]
Generate the contents of the computational environment ‘controller’ file.
The controller is a passthrough shell file that simply sources the correct computational_environment file for the machine at runtime. It does so by matching the hostname of the current machine (via regex) to the machine name (used in imsi config). Both the regex and machine name are known from upstream config and supplied via the machine_config (instance of Machine). The file that is sourced is then: {run_config_path}/{basename_prefix}_{machine name}.
- Parameters:
- machine_config: Machine
machine configuration object
- run_config_path: str
path to run config folder (usually {runid}/config)
- basename_prefix: str
file basename prefix for file names to source.
- Returns:
contents of the controller file, a list of strings (lines)
- imsi.shell_interface.shell_config_parameters.generate_flattened_config(full_config_dict: dict)[source]
This creates a far more extenives shell parameters file content for the simulation, that contains every variable defined in the imsi configuration.
The idea is not to practically use this, but to demonstrate it could be possible to make a clean break and do anything in shell downstream of this.
Here we just generate and return a list of strings, that will be written to file elsewhere using a common tool.
- imsi.shell_interface.shell_config_parameters.generate_shell_parameters(shell_config: dict)[source]
This creates a shell_parameters file contents for the simulation, that contains variable definitions required by downstream shell scripting. What appears in this file is defined by the “shell_config” template in the imsi json.
Here we just generate and return a list of strings, that will be written to file elsewhere using a common tool.
- imsi.shell_interface.shell_config_parameters.set_shell_config(shell_config_template: dict, full_config_dict: dict) dict[source]
Set shell parameters based on shell_config.yaml and internal imsi variables
- Parameters:
- shell_config_templatedict
A template of the shell config, from the database (contains {{}} enclosed strings to be replaced)
- full_config_dictdict
The full configuration as a single dictionary, which will be searched for key=value in order to do the replacements in the template above
- imsi.shell_interface.shell_diag_parameters.generate_diag_parameters_content(diag_config)[source]
This creates content for the diag_parameters file for the simulation, that contains variable definitions required by downstream shell scripting. Currently this is just a pure propagation of variables from the diagnostic config. Ultimately, the interaction of imsi with diagnostics needs to be refined.
- imsi.shell_interface.shell_inputs_outputs.add_atmos_forcing_preamble(component_config, script_content)[source]
- imsi.shell_interface.shell_inputs_outputs.extract_utility_files(files_to_extract: Dict, imsi_config_path: str, work_dir: str)[source]
Extract utility files from the source repository into workdir for use. The file source path is defined relative to imsi_config_path The destination path is defined relative to the run work_dir The destination path cannot be in: src, config, sequencer
- imsi.shell_interface.shell_inputs_outputs.generate_directory_packing_content(component_dict: dict) List[str][source]
Generate directory packing commands based on content in an imsi “components” config, to be called post model run
- imsi.shell_interface.shell_inputs_outputs.generate_final_file_saving_content(component_dict: dict) List[str][source]
Generate all required saved commands for final outputs based on an imsi “components” config (dict) to be called post model run and post directory packing
- imsi.shell_interface.shell_inputs_outputs.generate_input_script_content(component_dict: dict, shell_config: dict) List[str][source]
Generate content for the input files script (to be called at runtime with access’ etc)
- imsi.shell_interface.shell_inputs_outputs.process_cpp_file(ref_file_path, target_file_path, file_content)[source]
Process cpp files Updates default cpp files from ref_file_path with “file_content”
- imsi.shell_interface.shell_inputs_outputs.process_model_config_files(component: str, component_config: dict, imsi_config_path: str, run_config_path: str, file_type: str, shell_config: dict)[source]
Process namelist and compilation files for all component defined in component_config
Does replacements of {{}} variables using shell_config inputs Updates reference files from “ref_file_path” with “file_content”
- imsi.shell_interface.shell_inputs_outputs.process_namelist_file(ref_file_path, target_file_path, file_content, shell_config)[source]
Process namelist files Does replacements of {{}} variables using shell_config inputs Updates default namelists from ref_file_path with “file_content”
General utility functions for creating the “shell interface” (config directory) and associated files.
Scheduler interface
- class imsi.scheduler_interface.schedulers.BatchJob(user_script: ~typing.List[str], job_directives: ~typing.Dict[str, str] = <factory>)[source]
Bases:
objectDefines a batch job with specific directives
- construct_job_script(scheduler: Scheduler) List[str][source]
Constructs the entire job script from the header and user script using the scheduler’s directives
- job_directives: Dict[str, str]
- user_script: List[str]
- class imsi.scheduler_interface.schedulers.PBSScheduler(name: str = 'PBS', directive_prefix: str = '#PBS', submission_command: str = 'qsub', queue_info_command: str = 'qstat', cancel_command: str = 'qdel', output_redirect: str = '-o {PATH}.o', default_directives: list = <factory>)[source]
Bases:
Scheduler- cancel_command: str = 'qdel'
- construct_job_header(job_directives: List) str[source]
Constructs the job header based on directives
- default_directives: list
- directive_prefix: str = '#PBS'
- name: str = 'PBS'
- output_redirect: str = '-o {PATH}.o'
- queue_info_command: str = 'qstat'
- submission_command: str = 'qsub'
- class imsi.scheduler_interface.schedulers.SLURMScheduler(name: str = 'SLURM', directive_prefix: str = '#SBATCH', submission_command: str = 'sbatch', queue_info_command: str = 'squeue', cancel_command: str = 'scancel', output_redirect: str = '-o {PATH}_%j.out', default_directives: list = <factory>)[source]
Bases:
Scheduler- cancel_command: str = 'scancel'
- construct_job_header(job_directives: List) str[source]
Constructs the job header based on directives
- default_directives: list
- directive_prefix: str = '#SBATCH'
- name: str = 'SLURM'
- output_redirect: str = '-o {PATH}_%j.out'
- queue_info_command: str = 'squeue'
- submission_command: str = 'sbatch'
- class imsi.scheduler_interface.schedulers.Scheduler(name: str, directive_prefix: str, submission_command: str, queue_info_command: str, cancel_command: str, output_redirect: str)[source]
Bases:
ABCDefines an abstract interface for scheduler classes
- cancel_command: str
- abstract construct_job_header(job_directives: List) List[source]
Constructs the job header based on directives
- directive_prefix: str
- name: str
- output_redirect: str
- queue_info_command: str
- submission_command: str
Sequencer interface
sequencers
Provide a generic sequencer class, as an interface for dedicated sequencer sub-classes. This allows imsi to interface with multiple underlying sequencers.
- class imsi.sequencer_interface.sequencers.Sequencer[source]
Bases:
ABCA class that absracts the definition of a sequencer cap for imsi.
Sub-classes for specific sequencers will provide the concerete implementations of the methods below, using the imsi Configuration information, and using their own specifically required methods.
The sequencer specific implementation must expose back, through this interface, all the methods below.
- abstract config(configuration: Configuration)[source]
Steps needed to configure sequencer files based on updated imsi input. Examples might include editing resource files.
- abstract setup(configuration: Configuration)[source]
Any steps needed to setup the sequencer, including cloning source and creating any directories
- abstract status(configuration: Configuration)[source]
Steps needed to configure sequencer files based on updated imsi input. Examples might include editing resource files.
- abstract submit(configuration: Configuration)[source]
Steps needed to configure sequencer files based on updated imsi input. Examples might include editing resource files.
- imsi.sequencer_interface.sequencers.create_sequencer(seq_name)[source]
Create and return a sequencer object
An interface between IMSI upstream configuration and tooling and the iss.
imsi configuration is taken and processed into the configuration required for iss. Specifically, the IMSISimpleSequencerInterface exposes methods that correspond to imsi setup, config, and submit.
- class imsi.sequencer_interface.iss_cap.IMSISimpleSequencerInterface[source]
Bases:
SequencerAn interface between upstream imsi tooling and the IMSISimpleSequencer.
- config(configuration: Configuration, force=True)[source]
Write files needed for the imsi shell sequencer, including the .simulation.time.state file, and the submission files for the model and diagnostics.
- setup(configuration: Configuration, force=True)[source]
Any steps needed to setup the sequencer, including cloning source and creating any directories
- status(configuration: Configuration, setup_params: dict)[source]
Steps needed to configure sequencer files based on updated imsi input. Examples might include editing resource files.
- submit(configuration: Configuration)[source]
Submits the job to the queue. Also checks that this command is being run from the location (machine) that was used for configuration.
- imsi.sequencer_interface.iss_cap.create_job(run_id, job_name, script_dir, dates_file, user_script, directives=None, clean_scratch=True, depends_on=None, submit_next=True, submit_dependents=True, listings_basename=None)[source]
Creates a SimpleJob object for a given configuration.
- script_dir: str, Path
where the generated script file will go and be sourced from (make sure this is accesible by your system/scheduling system)
- imsi.sequencer_interface.iss_cap.create_shell_sequencer(configuration: Configuration, scheduler: Scheduler = None)[source]
Create a IMSISimpleSequencer instance from a Configuration and Scheduler
Utility functions
- imsi.utils.general.delete_or_abort(path)[source]
Asks a user for input to abort or delete and replace an existing directory.
- imsi.utils.general.is_path(var: str) bool[source]
Determines if the given string represents a path or a base filename.
- Args:
var (str): The string to check, which may be a base filename or a path.
- Returns:
- bool: True if var includes a directory component, indicating it’s a path;
False if it’s only a base filename.
- Example:
is_path(“woo”) => False is_path(“boo/woo”) => True
- imsi.utils.general.parse_memory_string_to_bytes(memory: str, base=2)[source]
Parses a string that specifies memory value and unit and returns the value in bytes.
- Parameters
- memorya string composed of the value and units, where units
are denoted as KB, MB, or GB (case insensitive, with or without trailing ‘b’). Space is permitted between the value and units.
- baseeither 2 or 10, denoting the conversion from the input
units to bytes. Use with caution. Default 2.
- Returns
value of the information in bytes
Example >>> parse_memory_string_to_bytes(“1 kb”) 1024 >>> parse_memory_string_to_bytes(“10GB”) 10737418240
- imsi.utils.general.write_shell_script(file_path: str, script_content: List[str], mode='w', make_executable=False)[source]
Write shell script content to a file.
- imsi.utils.general.write_shell_string(file_path: str, script_content: str, mode='w', make_executable=False)[source]
Write string to shell script preserving newlines
- imsi.utils.general.yes_or_no(question, compact=True)[source]
Prompts a user if they want to proceed (y) or not (n) given the prompt (the question).
utils
Utility functions used in imsi, largely for parsing json, and updating, searching and modifying nested python dicts.
- imsi.utils.dict_tools.combine_json_configs(rootpath)[source]
combine all json files found recursively under rootpath into one dictionary. This effectively provides a dictionary-database to use.
- Parameters:
- rootpathstr
The path to recursively search for input files ending in .json/.jsonc. Normally this is the path to the imsi-config directory.
- Outputs:
- config: dict
A dictionary of the contents of the json or combined json files found under rootpath.
- imsi.utils.dict_tools.combine_yaml_configs(rootpath)[source]
combine all YAML files found recursively under rootpath into one dictionary. This effectively provides a dictionary-database to use.
- Parameters:
- rootpathstr
The path to recursively search for input files ending in .yaml Normally this is the path to the imsi-config directory.
- Outputs:
- config: dict
A dictionary of the contents of the json or combined json files found under rootpath.
- imsi.utils.dict_tools.flatten(d, parent_key='', sep='_')[source]
Flatten a nested dict, using sep to join keys from levels in order
- imsi.utils.dict_tools.load_config_file(config_file)[source]
Reads a config file using the appropriate function for the file type (supports yaml or json)
- imsi.utils.dict_tools.parse_config_inheritance(configs, selected_config)[source]
Parse a configuration, inheriting attributes from all “parents”.
- Parameters:
- configs: dict
dictionary of all possible configurations, typically from an imsi_database.
- selected_config: str
The configuration to choose
- config_hierarchy: list
Typically not user specified, but used in the recursive function call to layer configurations in the correct order of inheritance.
- imsi.utils.dict_tools.parse_config_inheritance_org(configs, selected_config, config_hierachy=None)[source]
Parse a configuration recursively inheriting attributes from all “parents”.
- Parameters:
- configs: dict
dictionary of all possible configurations, typically from an imsi_database.
- selected_config: str
The configuration to choose
- config_hierachy: dict
Typically not user specified, but used in the recursive function call to layer configurations in the correct order of inheritance.
- imsi.utils.dict_tools.parse_var(s)[source]
Parse a key, value pair, separated by ‘=’ That’s the reverse of ShellArgs. On the command line (argparse) a declaration will typically look like:
foo=hello
or:
foo="hello world"
Courtesy https://stackoverflow.com/questions/27146262/create-variable-key-value-pairs-with-argparse-python
- imsi.utils.dict_tools.parse_vars(items)[source]
Parse a series of key-value pairs and return a dictionary Courtesy https://stackoverflow.com/questions/27146262/create-variable-key-value-pairs-with-argparse-python
- imsi.utils.dict_tools.recursive_lookup(key, d)[source]
Find a unique key in a nested dict. Will not be graceful if there are duplicates!
- imsi.utils.dict_tools.resolve_inheritance(configs, selected_config, config_hierarchy)[source]
Resolve the inheritance tree through recursion and exclusion of duplicates. Ensure ancestors precede descendents.
- Parameters:
- configs: dict
dictionary of all possible configurations, typically from an imsi_database.
- selected_config: str
The configuration to choose
- config_hierarchy: list
Typically not user specified, but used in the recursive function call to layer configurations in the correct order of inheritance.
- imsi.utils.dict_tools.update(d, u, verbose=False)[source]
Recursively update a dictionary, d, with an update, u. If an item appears in only one dictionary, it is included in the result.
- Parameters:
d : dict to update u : dict of updates
Returns:
d : updated dict
nml_tools
This is a module to collect common namelist functions.
This currently exists because neither f90nml nor the rpn nml tools correctly parse the nemo namelists. Ideally all these functions would be replaced with more robust, community packages.
NCS, 10/2021
- imsi.utils.nml_tools.cpp_update(cpp_input_file, cpp_output_file, cpp_changes, verbose=False)[source]
An interface function to update cpp keys.
- Inputs:
- cpp_input_filestr
path to the cpp file to load in
- cpp_output_filestr
path to the updated cpp file to write
- cpp_changesdict
key = value pairs to change in the file, where key appears in the default cpp file, and value is the value to replace it with
This is a basic python implementation of the mod_nl routine. Ideally the work would be done by a standard fortran namelist parser, such as f90nml. However, no existing parsers work correctly on NEMO namelists.
- imsi.utils.nml_tools.nml_read(nml_input_file)[source]
An interface function to read namelists into a dict.
- Inputs:
- nml_input_filestr
path to the namelist file to read
Ideally the work would be done by a standard fortran namelist parser, such as f90nml. However, no existing parsers work correctly on NEMO namelists.
- imsi.utils.nml_tools.nml_update(nml_input_file, nml_output_file, nml_changes)[source]
An interface function to update namelist parameters.
- Inputs:
- nml_input_filestr
path to the namelist file to load in
- nml_output_filestr
path to the updated namelist file to write
- nml_changesdict
A nested dict containing. At the top level the keys are the names of the namelists in nml_input_file, the values are dicts containing key = value pairs to change in the namelist.
This is a basic python implementation of the mod_nl routine. Ideally the work would be done by a standard fortran namelist parser, such as f90nml. However, no existing parsers work correctly on NEMO namelists.
- imsi.utils.nml_tools.nml_write(nml_output_file, nml)[source]
An interface function to write namelists from a dict.
- Inputs:
- nml_output_filestr
path to the namelist file to write
- nmldict
A nested dict containing. At the top level the keys are the names of the namelists, the values are dicts containing key = value pairs of the namelist.
Ideally the work would be done by a standard fortran namelist parser, such as f90nml. However, no existing parsers work correctly on NEMO namelists.
- imsi.utils.nml_tools.update_env_file(infile: str, outfile: str = None, updates: dict = None, commment_char: str = '#', key_value_only: bool = True)[source]
Update simple shell/environment files.
Only replaces values of existing keys, i.e. does not add key-value pairs that are not already in the file.
If key_value_only is True, then only lines that are in the key=value pattern (and commented lines) will be written to the output file. To keep all lines, set key_value_only=False.
git_tools
This is a module to collect common version control operations.
It might be worth checking out e.g. https://gitpython.readthedocs.io/en/stable/
However, for now to reduce dependencies, and given the basic operations needed, I’m just implementing a few functions here.
NCS, 10/2021
- exception imsi.utils.git_tools.GitException(message, *args)[source]
Bases:
ExceptionExceptions from running git commands
- imsi.utils.git_tools.clone(repo_address, local_name, ver, path=None, depth: int | None = None)[source]
Clone a git repository, for standard repositories or containing submodules. If there are submodules, clone the repository recursively, and checkout a specified version across all submodules.
- Inputs:
- repo_addressstr
The address to clone from, typically a url.
- local_namestr
The name to use for the on disk code
- verstr
The reference to checkout. Can be a branch name or tag (used with the –branch arg in git clone). When a SHA-1 is used, a full clone of the repo is done and then checked out to the SHA-1 (depth is ignored).
- pathstr, None
Path of where to clone the repo, path/local_name. If None, cwd used.
- depthint, None
Depth to which the repository is cloned, including submodules. If None, the full git history is cloned. Can’t be used when ver is a SHA1
- imsi.utils.git_tools.ensure_git_config(id_as_fallback=True)[source]
ensures that git config for local repo is set if there isn’t a global one. (necessary for a commit).