Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Contributing to Viyog

Thank you for your interest in contributing to **Viyog**. Contributions of all kinds are welcome, including:

* New scoring variants or robustness improvements
* Additional evaluation metrics
* Bug fixes
* Performance optimizations
* Documentation enhancements
* Unit tests and CI improvements

For significant architectural or API changes, please open an issue first to discuss your proposal before submitting a pull request.

---

## Development Setup

Viyog uses **uv** for dependency management and environment reproducibility.

### 1. Install `uv`

If not already installed:

```bash
pip install uv
```

Recommended installation:

```bash
curl -Ls https://astral.sh/uv/install.sh | sh
```

---

### 2. Clone the Repository

```bash
git clone <your-fork-url>
cd viyog_repo
```

---

### 3. Create and Sync the Environment

```bash
uv sync
```

This will:

* Create a virtual environment
* Install all project dependencies
* Respect the `uv.lock` file for reproducible installs

To activate the environment:

```bash
source .venv/bin/activate
```

---

## Development Workflow

1. Fork the repository

2. Sync your fork with the latest `main` branch

3. Create a feature branch:

```bash
git checkout -b feature/my-change
```

4. Make your changes

5. Commit with clear, descriptive messages

6. Push to your fork

7. Open a Pull Request (PR)

**Do not open pull requests directly from `main`.**

---

## Code Style & Linting

This project uses:

* **Ruff** for linting
* **pre-commit** for automated formatting and checks

Configuration is stored in:

```
.pre-commit-config.yaml
```

### Install Pre-commit Hooks

```bash
uv run pre-commit install
```

Hooks will run automatically on every commit.

To run manually:

```bash
uv run pre-commit run --all-files
```

All linting and formatting checks must pass before merging.

---

## Testing

Run tests with:

```bash
uv run pytest
```

If you add or modify functionality:

* Include unit tests
* Ensure all tests pass
* Verify tensor shapes and device handling
* Avoid introducing gradients (Viyog is inference-only)
* Ensure CPU and CUDA behavior remain consistent (if applicable)

Pull requests without appropriate test coverage may be requested to add tests before review.

---

## Pull Request Guidelines

Before submitting a PR, ensure:

* Code passes linting and formatting checks
* All tests pass
* New functionality includes tests
* Public API changes are documented
* The README is updated if behavior changes

PR descriptions should clearly explain:

* What was changed
* Why the change was made
* Any trade-offs or limitations

---

## Reporting Issues

When opening an issue, please include:

* Python version
* PyTorch version
* Operating system
* Minimal reproducible example
* Expected vs. actual behavior
* Full error traceback (if applicable)

Incomplete reports may delay resolution.

---

## Design & API Stability

* Keep changes focused and minimal
* Write clear docstrings for new functionality
* Avoid breaking existing public APIs without prior discussion
* Maintain inference-only guarantees
* Preserve backward compatibility whenever possible

---

## Security

If you discover a security vulnerability, do **not** open a public issue. Instead, contact the maintainers privately with detailed information.

---

## License

By contributing to Viyog, you agree that your contributions will be licensed under the *MIT** used by this project.
9 changes: 9 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v1.1.0
_src_path: gh:mjun0812/python-copier-template
author_email: singh052001aman@gmail.com
author_name: Aman Singh
description: A simple tool to seperate Out of distribution and Adversarial Attack
package_name: viyog
project_name: viyog
python_version: '3.10'
62 changes: 62 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "python-devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}",
"PYTHONUNBUFFERED": "1",
"PYTHONDONTWRITEBYTECODE": "1",
"UV_CACHE_DIR": "/home/vscode/.cache/uv",
"UV_LINK_MODE": "copy",
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv",
"UV_COMPILE_BYTECODE": "1",
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude"
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true
},
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "curl,wget,git,jq,ca-certificates,build-essential,ripgrep,fd-find"
},
"ghcr.io/va-h/devcontainers-features/uv:1": {
"shellAutocompletion": true
},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
},
"runArgs": [
"--init",
"--rm"
],
"hostRequirements": {
"gpu": "optional"
},
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python"
},
"extensions": [
"ms-python.python",
"charliermarsh.ruff",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"ms-toolsai.jupyter",
"yzhang.markdown-all-in-one"
]
}
},
"remoteUser": "vscode",
"containerUser": "vscode",
"initializeCommand": "mkdir -p ${localEnv:HOME}/.claude ${localEnv:HOME}/.codex && touch ${localEnv:HOME}/.claude/CLAUDE.md ${localEnv:HOME}/.codex/config.toml",
"mounts": [
"source=shell_history-${devcontainerId},target=/shell_history,type=volume",
"source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind",
"source=${localEnv:HOME}/.claude/CLAUDE.md,target=/home/vscode/.claude/CLAUDE.md,type=bind",
"source=${localEnv:HOME}/.codex,target=/home/vscode/.codex,type=bind",
"source=${localEnv:HOME}/.codex/config.toml,target=/home/vscode/.codex/config.toml,type=bind"
],
"postCreateCommand": "npm install -g @openai/codex@latest && uv sync",
"postStartCommand": "uv run pre-commit install"
}
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Format
run: uvx ruff format . --check --diff

- name: Lint
run: uvx ruff check --output-format=github .
Loading