> This page is for version 0.3.0.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.

# nemo_gym.utils.gym_commit

The git commit of the nemo-gym that is running.

## Module Contents

### Functions

| Name                                                                            | Description                                                                                     |
| ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [`_git`](#nemo_gym-utils-gym_commit-_git)                                       | -                                                                                               |
| [`_git_install_commit`](#nemo_gym-utils-gym_commit-_git_install_commit)         | The commit recorded in the distribution's PEP 610 `direct_url.json`, or None.                   |
| [`_source_checkout_commit`](#nemo_gym-utils-gym_commit-_source_checkout_commit) | HEAD of the git checkout `package_dir` is tracked in, `-dirty` when it has uncommitted changes. |
| [`_unknown_commit`](#nemo_gym-utils-gym_commit-_unknown_commit)                 | -                                                                                               |
| [`installed_gym_commit`](#nemo_gym-utils-gym_commit-installed_gym_commit)       | Return the git commit of the nemo-gym that is running, or None when it cannot be determined.    |

### Data

[`_PACKAGE_DIR`](#nemo_gym-utils-gym_commit-_PACKAGE_DIR)

[`logger`](#nemo_gym-utils-gym_commit-logger)

### API

```python
nemo_gym.utils.gym_commit._git(
    directory: pathlib.Path,
    args: str = ()
) -> subprocess.CompletedProcess
```

```python
nemo_gym.utils.gym_commit._git_install_commit() -> str | None
```

The commit recorded in the distribution's PEP 610 `direct_url.json`, or None.

```python
nemo_gym.utils.gym_commit._source_checkout_commit(
    package_dir: pathlib.Path
) -> str | None
```

HEAD of the git checkout `package_dir` is tracked in, `-dirty` when it has uncommitted changes.

```python
nemo_gym.utils.gym_commit._unknown_commit(
    reason: str,
    args: object = ()
) -> None
```

```python
nemo_gym.utils.gym_commit.installed_gym_commit() -> str | None
```

Return the git commit of the nemo-gym that is running, or None when it cannot be determined.

A git install (`pip install git+...`) records its commit in the distribution
metadata. Otherwise the running package's own source tree is asked: a git
checkout reports its HEAD, suffixed `-dirty` when it has uncommitted changes.

```python
nemo_gym.utils.gym_commit._PACKAGE_DIR = Path(__file__).resolve().parents[1]
```

```python
nemo_gym.utils.gym_commit.logger = logging.getLogger(__name__)
```