Code-style guide and reference patterns for DL/CV research at the ЛИСАД laboratory (NADEZHDA / SOFIA CVGL projects). Files: - Стандарт написания кода для DL CV исследований (CVGL).md - Правила написания Python-кода (Gin-Config Strict Pattern).md - REQUIREMENTS_GIN_STYLE.md - Gin-Config Strict Pattern Reference Examples.md - Переход от argparse и dataclass к gin-config.md - gin-parse.md - Рекомендуемые gin-config категории.md - config_loader_reference.py - README.md (this commit) - .gitignore (Python artifacts)
49 lines
2.0 KiB
Markdown
49 lines
2.0 KiB
Markdown
# style_code_lisad
|
|
|
|
Code-style guide and reference patterns for DL/CV research at the **ЛИСАД laboratory** (CVGL projects: NADEZHDA / SOFIA).
|
|
|
|
## Contents
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `Стандарт написания кода для DL CV исследований (CVGL).md` | Master coding standard for the lab |
|
|
| `Правила написания Python-кода (Gin-Config Strict Pattern).md` | Quick-reference rule sheet |
|
|
| `REQUIREMENTS_GIN_STYLE.md` | Detailed gin-config requirements |
|
|
| `Gin-Config Strict Pattern Reference Examples.md` | Annotated example files |
|
|
| `Переход от argparse и dataclass к gin-config.md` | Migration guide |
|
|
| `gin-parse.md` | Notes on gin parsing semantics |
|
|
| `Рекомендуемые gin-config категории.md` | Suggested groupings of gin-configurable classes |
|
|
| `config_loader_reference.py` | Reference implementation of `get_*_cfg()` loader pattern |
|
|
|
|
## Core principles
|
|
|
|
1. **Configuration via `gin-config`** (no `argparse`, no `dataclass`).
|
|
2. `@gin.configurable` on **classes only** — all defaults live in `__init__`.
|
|
3. Loader pattern: `get_<name>_cfg(path: str) -> Instance` that calls
|
|
`gin.parse_config_file(path)` then constructs the class.
|
|
4. Pass configs **explicitly** via constructor arguments, never via global
|
|
gin state.
|
|
5. Strict typing on all public APIs, Google-style docstrings, English code.
|
|
|
|
See the full standard in `Стандарт написания кода...md`.
|
|
|
|
## Layout for derived projects
|
|
|
|
```
|
|
project_root/
|
|
├── in/
|
|
│ └── config_files/ # one .gin file per config class
|
|
├── src/
|
|
│ ├── conf/ # config classes + get_*_cfg() loaders
|
|
│ ├── augmentor/ # business logic (or other domain modules)
|
|
│ └── ...
|
|
├── tests/
|
|
└── README.md
|
|
```
|
|
|
|
## License & usage
|
|
|
|
Internal lab reference. Apply when writing new CVGL research code (e.g.
|
|
`code_sofia_v71/` should follow this standard — current dataclass-based
|
|
config is a known deviation that will be migrated in a separate refactor).
|