Skip to content

main to feat#145

Open
DeepKnowledge1 wants to merge 2 commits into
feat/auto-asset-downloadfrom
main
Open

main to feat#145
DeepKnowledge1 wants to merge 2 commits into
feat/auto-asset-downloadfrom
main

Conversation

@DeepKnowledge1
Copy link
Copy Markdown
Owner

🔗 Related Issue

Fixes #

📝 Description

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📖 Documentation update
  • 🏗️ Infrastructure / CI/CD update

🧪 Hardware & Matrix Testing

I have successfully built and tested this code using uv on:

  • anomavision[cpu] (Standard/Edge)
  • anomavision[cu121] (CUDA 12.1)
  • anomavision[cu124] (CUDA 12.4)
  • anomavision[cu118] (CUDA 11.8)

Host OS used for testing:

  • Linux / Ubuntu
  • Windows (Native or WSL2)
  • macOS

✅ Developer Checklist

  • My code follows the core style guidelines of this project (Ruff/Black formatting).
  • I have run uv run pytest and all unit tests pass locally.
  • Lockfile Guard: If I added or modified a dependency in pyproject.toml, I have run uv lock --python 3.10 and committed the updated uv.lock file.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the documentation accordingly (if applicable).

📸 Screenshots / Visual Proof (Optional)

DeepKnowledge1 and others added 2 commits May 5, 2026 20:59
#144)

## Problem

The `GitStatusChecker` was instantiated and executed at **module level**
in `train.py`:

```python
# Ran on every import — even for --help
checker = GitStatusChecker()
checker.check_status()
```

This caused two issues:

1. **Docker crash** — `git fetch` fails inside containers that have no
git remote, no SSH keys, or no `git` binary. Because `subprocess.run`
uses `check=True`, it raises `CalledProcessError` and kills the process
before training starts.
2. **Import side effect** — any code that imports `anomavision.train`
(including `cli.py` building the argument parser for `--help`) would
trigger a network call unconditionally.

## Fix

Moved the git check inside `main()` with two additional guards:
- Only runs if actually inside a git repository (`checker.is_repo()`)
- Wrapped in `try/except` so a git failure never blocks training

```python
try:
    checker = GitStatusChecker()
    if checker.is_repo():
        checker.check_status()
except Exception:
    pass  # Never block training over a git check
```

## Impact

- Fixes CLI commands not being accessible in Docker (related to
#<issue_number>)
- No change to training behavior
- Git status check still runs when training locally inside a valid repo

## Testing

- [ ] `anomavision train --help` works inside Docker without errors
- [ ] `anomavision train --config config.yml` runs successfully
- [ ] Git status check still prints when running locally in a valid repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant