File size: 2,951 Bytes
a00fee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Contributing to Multilingual-ABSA

Thanks for taking the time to contribute! This document outlines the workflow,
tooling, and conventions for building and shipping changes to this repository.

## Table of Contents

- [Development Setup](#development-setup)
- [Project Layout](#project-layout)
- [Quality Gates](#quality-gates)
- [Workflow](#workflow)
- [Conventions](#conventions)
- [Commit Guidelines](#commit-guidelines)

## Development Setup

```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
```

Install the pre-commit hooks (optional but recommended):

```bash
pre-commit install
```

## Project Layout

```
api/            # FastAPI REST service (routes, middleware, services, tasks, models, schemas)
src/absa/       # Core ML library (data, models, evaluation, training, utils) β€” src-layout
frontend/       # Streamlit dashboard
scripts/        # Operational/one-off utility scripts
notebooks/      # Exploration & Colab training notebooks
tests/          # Pytest suite (api/, web/, unit/)
docs/           # Project documentation
docker/         # Container definitions & compose files
monitoring/     # Prometheus / Grafana configuration
data/           # Datasets (DVC-tracked)
models/         # Model artifacts (DVC-tracked)
```

## Quality Gates

Every change must pass all of the following before being merged:

```bash
make lint        # ruff check api src/absa tests
make typecheck   # mypy api src/absa
make security    # bandit -r api src/absa
make test        # pytest
```

## Workflow

1. **Fork** the repository and create a branch from `main`:

   ```bash
   git checkout -b feature/<description>
   ```

2. Make focused, atomic changes β€” see [Commit Guidelines](#commit-guidelines).

3. Run the [quality gates](#quality-gates) locally.

4. Open a pull request describing **what** changed, **why**, and how you
   verified it. Reference any related issues.

## Conventions

- **Python** β€” target 3.10+. Format/lint is enforced by `ruff` (120-char lines,
  `E`, `F`, `I`, `N`, `W` rule set). Type hints are checked by `mypy`.
- **Imports** β€” absolute imports only (`from absa.data import ...`,
  `from api.routes import ...`); never rely on `sys.path` hacks in library code.
- **Models vs. schemas** β€” SQLAlchemy ORM models live in `api/models/`;
  Pydantic request/response models live in `api/schemas/`.
- **Secrets** β€” never commit `.env` or real credentials. Add any new required
  environment variables to `.env.example`.
- **Data** β€” datasets and model weights are versioned with DVC, not git.
  Update `dvc.yaml` when preprocessing stages change.

## Commit Guidelines

- Keep commits small, focused, and logically independent.
- Use the imperative mood: "Add batch status endpoint", not "Added endpoint".
- Prefix with the area when it aids scanning, e.g. `api:`, `frontend:`,
  `data:`, `docs:`.
- Do not bundle unrelated changes (e.g. formatting + feature) in one commit.