Overview
Thesglang version command displays the current version of SGLang and the git revision (commit hash) of the installation.
Basic Usage
Arguments
This command takes no arguments or options.Output
The command displays two lines of information:- SGLang version: The semantic version number of the installed SGLang package
- Git revision: The first 7 characters of the git commit hash from which the package was built
Example Output
When Git Information is Unavailable
If the git information cannot be determined (e.g., when installed from a release package or in environments without git), the output will show:Use Cases
Version Verification
Check which version of SGLang is currently installed:Bug Reporting
When reporting issues, include the version information to help maintainers reproduce and diagnose problems:CI/CD Integration
Use in scripts to verify the correct version is installed:Version Comparison
Compare versions across different environments:Environment Variables
The git commit hash can be overridden using theSGLANG_GIT_COMMIT environment variable:
Implementation Details
The version command retrieves information from:- Version number: From
sglang.version.__version__ - Git revision:
- First checks the
SGLANG_GIT_COMMITenvironment variable - Falls back to running
git rev-parse HEADin the repository - Returns “N/A” if neither method succeeds
- First checks the
Exit Codes
The command always exits with status code0 (success), even when git information is unavailable.
Related Commands
- sglang serve - Launch the SGLang server
- sglang generate - Run inference on a multimodal model
Additional Resources
- Check the SGLang GitHub releases for version history
- Review the CHANGELOG for detailed version differences
