chemsmart.cli package

Subpackages

Submodules

chemsmart.cli.config module

class chemsmart.cli.config.Config[source]

Bases: object

Central configuration helper for chemsmart.

The class is organised into five logical sections:

  1. Template & destination paths — where bundled templates live and where they are copied to (~/.chemsmart).

  2. Conda detection — locate the active conda installation via shutil.which (works on Linux, macOS, Git Bash and Conda PowerShell).

  3. POSIX shell management — detect the active shell (bash / zsh / sh) and return the correct rc file path and export lines.

  4. Windows PowerShell management — detect an Anaconda / Miniconda PowerShell session and write $env:PATH entries into the PS profile.

  5. Windows registry management — fallback for plain CMD sessions that have neither a POSIX shell nor PowerShell; persists PATH via the Windows registry.

property chemsmart_dest

Destination path for the user’s .chemsmart configuration.

property chemsmart_gaussian

Path to the gaussian sub-directory of the user config.

property chemsmart_orca

Path to the orca sub-directory of the user config.

property chemsmart_package_path

Absolute path to the root of the chemsmart source/install tree.

property chemsmart_server

Path to the server sub-directory of the user config.

property chemsmart_template

Return a Traversable pointing to the bundled .chemsmart template directory.

Uses importlib.resources so that the path is resolved correctly after installation on Windows, macOS, and Linux alike.

property conda_folder

Root directory of the conda installation (parent of the directory containing the executable).

property conda_path

Locate the conda executable via shutil.which.

Works on Linux, macOS, Windows Git Bash, and Anaconda / Miniconda PowerShell Prompt (all of which add conda to PATH).

Raises FileNotFoundError if conda is not found.

configure_conda_in_server_yaml()[source]

Auto-detect the conda installation and update the placeholder ~/miniconda3 path in all server YAML files.

Conda is located via conda_folder, which uses shutil.which("conda") and therefore works on all supported platforms — Linux, macOS, Windows Git Bash and Anaconda / Miniconda PowerShell Prompt.

If conda cannot be found a helpful message is logged instead of raising an exception.

Return type:

None

configure_paths_interactively()[source]

Interactively prompt for optional software folder paths.

Prompts the user for the Gaussian g16, ORCA, and NCIPLOT installation folders. Pressing Enter skips a prompt.

Uses click.prompt() so the prompts work correctly on all platforms — Linux, macOS, Windows Git Bash, and Conda PowerShell — without any shell-specific read syntax in the Makefile.

Return type:

None

property env_vars

Unix-style export lines to append to the active shell rc file.

Returns [] on native Windows (no POSIX shell active). On Windows Git Bash / MSYS2 the Unix-style exports are returned so that the shell rc file is updated correctly.

property powershell_profiles

Return profile paths to update when running inside a PowerShell session (e.g. Anaconda / Miniconda PowerShell Prompt).

PowerShell is detected via the PSModulePath environment variable, which is always set by PowerShell regardless of how it was launched.

Both Windows PowerShell 5.x and PowerShell 7+ profile paths are returned so the update works across both versions.

Returns [] on non-Windows platforms or outside a PowerShell session.

property ps_env_vars

PowerShell profile lines written by make configure.

Returns a $env:PYTHONPATH line for editable installs and a Set-Alias declaration that maps the bare chemsmart command to chemsmart.exe.

Note

We use Set-Alias rather than adding directories to $env:PATH or defining a function wrapper.

  • PowerShell resolves aliases before functions and before external commands, so the alias will win even if a bare chemsmart POSIX script is present somewhere on PATH (e.g. in chemsmart/cli/ from a development install).

  • Calling chemsmart.exe directly avoids the Windows “Open with” popup that appears when PowerShell tries to execute a file with no recognised extension.

  • chemsmart.exe is always present in the active conda environment’s Scripts/ directory after a successful pip install.

setup_environment()[source]

Copy bundled templates to ~/.chemsmart and register the chemsmart command in the active shell environment.

Dispatch logic:

  • POSIX shell (Linux, macOS, Git Bash on Windows): append export lines to the shell rc file (~/.bashrc, ~/.zshrc, …).

  • Windows PowerShell (Anaconda / Miniconda PS Prompt, detected via PSModulePath): write a Set-Alias declaration and $env:PYTHONPATH line to the PS profile, replacing any previous chemsmart block.

  • Windows CMD / other: update PATH / PYTHONPATH in the Windows user registry.

property shell_config

Return the shell startup file path for the active POSIX shell.

Returns None on native Windows when no POSIX shell is active (i.e. the SHELL environment variable is not set). On Windows Git Bash / MSYS2 the SHELL variable is set, so the shell rc file is managed exactly as on Linux / macOS.

chemsmart.cli.config.add_lines_in_yaml_files(target_directory, lines_in_positions, lines_to_add, prepend_string='')[source]

Add lines (lines_to_add) to at specific positions after given lines (lines_in_positions) in all yaml files in a target directory.

chemsmart.cli.config.update_yaml_files(target_directory, value_in_file, user_value)[source]

Update YAML files in ~/.chemsmart/server to replace value_in_file with the provided user_value.

chemsmart.cli.job module

CLI options for ALL jobs that can be run in this package.

This module provides common command-line interface decorators and options that are shared across different job types in the chemsmart package.

chemsmart.cli.job.click_file_label_and_index_options(f)[source]

Common click options for specifying file label, append-label, and index via CLI.

chemsmart.cli.job.click_filename_options(f)[source]

Common click options for specifying filenames via CLI.

chemsmart.cli.job.click_filenames_options(f)[source]

Common click options for specifying filenames via CLI.

chemsmart.cli.job.click_folder_options(f)[source]

CLI options for directory-based batch processing.

chemsmart.cli.job.click_job_options(f)[source]

Common job control options for all job types.

Provides standard options for job execution control, including the ability to skip completed jobs or force re-execution.

chemsmart.cli.job.click_molecule_vibrational_displacement_options(f)[source]

CLI options for the vibrationally_displaced() method of Molecule object.

chemsmart.cli.job.click_pubchem_options(f)[source]

PubChem integration options for molecular structure retrieval.

Provides command-line options for querying molecular structures from the PubChem database using various identifiers.

chemsmart.cli.jobrunner module

chemsmart.cli.jobrunner.click_jobrunner_options(f)[source]

Common job runner configuration options.

chemsmart.cli.logger module

chemsmart.cli.logger.logger_options(f)[source]

Logging configuration options.

chemsmart.cli.main module

CLI interface for chemsmart project.

This module provides the main entry point for the chemsmart command-line interface, organizing various subcommands and providing the ASCII art banner display.

chemsmart.cli.main.main()[source]

The main function executes on commands: python -m chemsmart and $ chemsmart.

This is your program’s entry point.

You can change this function to do whatever you want. .. rubric:: Examples

  • Run a test suite

  • Run a server

  • Do some other stuff

  • Run a command line application (Click, Typer, ArgParse)

  • List all available tasks

  • Run an application (Flask, FastAPI, Django, etc.)

chemsmart.cli.run module

chemsmart.cli.run.process_pipeline(ctx, *args, **kwargs)[source]

Process the job returned by subcommands.

chemsmart.cli.sub module

Submission of jobs to queuing system via cli.

This module provides command-line interface for submitting jobs to various queuing systems and cluster schedulers.

chemsmart.cli.sub.process_pipeline(ctx, *args, **kwargs)[source]

Process the job for submission to queuing system.

This callback function handles job submission by reconstructing command-line arguments and interfacing with the appropriate scheduler system.

chemsmart.cli.subcommands module

chemsmart.cli.update module

class chemsmart.cli.update.Updater[source]

Bases: object

Handles dependency updates in pyproject.toml.

property docs_conf_file_path: Path
property package_path: Path
property pyproject_path: Path
update_pyproject_toml()[source]

Update dependencies in pyproject.toml.

update_version_number(version_number)[source]

Update version number in chemsmart/VERSION, pyproject.toml, and docs/source/conf.py

property version_file_path: Path

Module contents