# opam %{OPAMVERSION}% API and libraries documentation

`src/core` | opam-core library
Generic standard and system library
opamVersion.ml | (generated) Current opam version
opamCoreConfig.ml | Configuration options for this lib (record, global reference and setter)
opamVersionCompare.ml | Version comparison function used throughout. From the Dose suite.
opamJson.ml | Wrapper on Jsonm; only needed for some debug options
opamStd.ml | Generic stdlib functions (String, List, Option, Sys submodules...)
opamConsole.ml | Console output, ANSI color, logging and user querying
opamCompat.ml.4.01/4.02 | Compatibility layer (Bytes, etc.) for different OCaml versions
System handling
opamProcess.ml | Process and job handling, with logs, termination status, etc.
opamSystem.ml | Bindings of lots of filesystem and system operations
opamHash.ml | Type and computation of file checksums
opamFilename.ml | Higher level file and directory name manipulation AND file operations, wrappers on OpamSystem using the filename type
opamDirTrack.ml | Tracking of changes in a given filesystem subtree
opamParallel.ml | Parallel execution of jobs following a directed graph
opamUrl.ml | URL parsing and printing, with support for our different backends
Windows support
opamStubsTypes.ml | Types in the stubs definitions (shared between both implementations)
opamStubs.ml | C stubs for Windows. A “dummy” alternate is provided for Unix, which doesn’t require any C code
`src/format` | opam-format library
Definition of opam datastructures and its file interface
opamFormatConfig.ml | Configuration options for this lib (record, global reference and setter)
opamTypes.mli | Definitions of many types used throughout
opamTypesBase.ml | Helper functions on the base types. Often opened
opamPath.ml | Defines the file hierarchy in ~/.opam
basic types, used as keys
opamPackage.ml | The package type, and package name type (name+version, values often called "nv" in the code)
opamRepositoryName.ml | The repository type
opamSwitch.ml | The switch type
opamVariable.ml | opam variables with scope (global or module)
more advanced types
opamFilter.ml | Formulas on variables, as used in opam files build scripts
opamFormula.ml | Formulas on packages, opt. with sub-formulas on versions, and conversion functions
file format
opamLineLexer.mll | A simple lexer to list of lines, which are lists of words
opamPp.ml | Bidirectional transformations on top of the parser and printer
opamFormat.ml | opam config files syntax and conversion tools
opamFile.ml | Handles all opam file formats as record types and submodules, conversion to and from syntax
`src/repository` | opam-repository library
Handling of remote sources
opamRepositoryConfig.ml | Configuration options for this lib (record, global reference, setter, initialisation)
opamRepositoryBackend.ml | Signature for repository handlers and some helpers for the repository type
opamRepositoryPath.ml | Defines the file hierarchy in repositories
opamDownload.ml | Configuration init and handling of downloading commands
opamHTTP.ml | Main HTTP backend
opamLocal.ml | Rsync backend, for local or ssh sources
opamVCS.ml | Layer for handling version control sources
opamDarcs.ml | Darcs support (through OpamVCS)
opamGit.ml | Git support (through OpamVCS)
opamHg.ml | Mercurial support (through OpamVCS)
opamRepository.ml | Operations on repositories (update, fetch...) based on the above backends
`src/solver` | opam-solver library
Solver and Cudf interaction
opamSolverConfig.ml | Configuration options for this lib (record, global reference, setter, initialisation)
opamActionGraph.ml | Handles graphs of actions (package changes), based on ocamlgraph
opamCudfSolver.ml | Bindings to implementation of CUDF solvers, either built-in or external
opamCudf.ml | Solver interaction, conversion of answer to solution
opamSolver.ml | Entry point, conversion of universe to cudf, dependencies computation
`src/state` | opam-state library
Handling of the ~/.opam hierarchy, repository and switch states
opamStateConfig.ml | Configuration options for this lib (record, global reference, setter, initialisation)
opamScript.ml | (generated) Shell config scripts as OCaml strings
opamStateTypes.mli | Defines the types holding global, repository and switch states
opamFormatUpgrade.ml | Handles upgrade of an opam root from earlier opam versions
opamSysPoll.ml | Detection of host system (arch, os, distribution)
opamGlobalState.ml | Loading and handling of the global state of an opam root
opamRepositoryState.ml | loading and handling of the repository state of an opam root (i.e. what is in ~/.opam/repo)
opamSwitchState.ml | Loading and querying a switch state
opamPackageVar.ml | Resolution and handling of opam variables + filters
opamFileTools.ml | Generic tools for handling package metadata
opamSwitchAction.ml | Switch-related actions and changes
opamEnv.ml | Process environment setup and handling, shell configuration
opamPinned.ml | Specific query and handling of pinned packages
opamUpdate.ml | Synchronisation and downloading of repositories and package sources
`src/stubs` | opam-stubs library
C stubs. This library is built on Windows-only and automatically pulled into opam-core if needed
opamInject.c | Code for process injection shared between opamWindows.c and opam-putenv.c
opamWindows.c | C stubs themselves
opamWin32Stubs.ml | OCaml `external` declarations for the stubs
`src/client` | opam-client library and exec
Actions on the opam root, switches, installations, and front-end
`opam-client` library
opamClientConfig.ml | Configuration options for this lib (record, global reference, setter, initialisation), plus helper for global setup
opamAction.ml | Handles concrete actions on packages, like installations and removals
opamSolution.ml | Interface with the solver, processing of full solutions through actions
opamConfigCommand.ml | Functions for the "opam config" subcommand
opamPinCommand.ml | Functions for the "opam pin" subcommand
opamRepositoryCommand.ml | Functions for the "opam repository" subcommand
opamSwitchCommand.ml | Functions for the "opam switch" subcommand
opamListCommand.ml | Functions for the "opam list" subcommand
opamInitDefaults.ml | Defines the built-in "opamrc" to use by default on "opam init"
opamClient.ml | High-level execution of the main user commands ("install", "upgrade", "remove"), and wrapper for Pin commands
opamAuxCommands.ml | Some command helpers and extra opam management functions
opamAdminRepoUpgrade.ml | Handles converting package repositories from the format of older opam versions to the current format
opamAdminCheck.ml | Implements the repository checks of the 'opam admin check' command.
opamGitVersion.mli | (generated) Current git version of opam
opamArg.ml | Command-line argument parsers and helpers
opamAdminCommand.ml | All sub-commands of the "opam admin" command
opamCommands.ml | Opam CLI commands and their handlers as Cmdliner terms
Main opam CLI
opamMain.ml | Main opam entry point
`src/tools` | Extra tools and utilities
Auxiliary standalone tools
opam_admin_top.ml | Tiny library for admin-scripts, included in opam-admin.top
opam-putenv.c | Tiny C tool used on Windows for cross-architecture process injection
opam_check.ml | Tiny tool used in internal checks ("make tests")
opam_installer.ml | Handles opam's ".install" files