Skip to content

Commit 866bb4c

Browse files
voorhsSamoed
andauthored
Basic documentation (#47)
Co-authored-by: Roman Solomatin <[email protected]>
1 parent 08d74a4 commit 866bb4c

File tree

105 files changed

+3926
-540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3926
-540
lines changed

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v4
8-
- uses: chartboost/ruff-action@v1
8+
- uses: astral-sh/ruff-action@v1

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ instance/
6969
.scrapy
7070

7171
# Sphinx documentation
72-
docs/_build/
72+
docs/build/
73+
docs/source/apiref
74+
docs/source/tutorials
7375

7476
# PyBuilder
7577
.pybuilder/

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"ruff.configuration": "pyproject.toml"
2+
"ruff.configuration": "pyproject.toml",
3+
"python.analysis.extraPaths": [
4+
"./docs/source"
5+
]
36
}

CONTRIBUTING.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,16 @@ embedder_batch_size: 32
8383
4. Запускаем с конфиг файлом config.yaml:
8484
```bash
8585
autointent --config-path FULL_PATH/test_config --config-name config
86-
```
86+
```
87+
88+
## Построение документации
89+
90+
Построить html версию в папке `docs/build`:
91+
```bash
92+
make docs
93+
```
94+
95+
Построить html версию и захостить локально:
96+
```bash
97+
make serve-docs
98+
```

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ poetry = poetry run
33

44
.PHONY: install
55
install:
6-
poetry install --with dev,test,lint,typing
6+
poetry install --with dev,test,lint,typing,docs
77

88
.PHONY: test
99
test:
@@ -22,5 +22,18 @@ lint:
2222
$(poetry) ruff format
2323
$(poetry) ruff check --fix
2424

25+
.PHONY: sync
26+
sync:
27+
poetry install --sync --with dev,test,lint,typing,docs
28+
29+
.PHONY: docs
30+
docs:
31+
$(poetry) sphinx-apidoc -e -E -f --remove-old -o docs/source/apiref autointent
32+
$(poetry) python -m sphinx build docs/source docs/build/html
33+
34+
.PHONY: serve-docs
35+
serve-docs: docs
36+
$(poetry) python -m http.server -d docs/build/html 8333
37+
2538
.PHONY: all
2639
all: lint

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,3 @@ Prediction:
377377
- `prediction_recall`
378378
- `prediction_roc_auc`
379379

380-
## Roadmap
381-
382-
| Version | Description |
383-
| ------- | --------------------------------------------------------- |
384-
| v0.0.x | Python API, CLI API, Greedy optimization |
385-
| v0.1.x | Web UI for logging, Bayes optimization, data augmentation |
386-
| v0.2.x | Optimization presets, improved efficiency |

autointent/configs/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from .inference_cli import InferenceConfig
2+
from .inference_pipeline import InferencePipelineConfig
3+
from .node import InferenceNodeConfig, NodeOptimizerConfig
4+
from .optimization_cli import (
5+
AugmentationConfig,
6+
DataConfig,
7+
EmbedderConfig,
8+
LoggingConfig,
9+
OptimizationConfig,
10+
TaskConfig,
11+
VectorIndexConfig,
12+
)
13+
from .pipeline_optimizer import PipelineOptimizerConfig
14+
15+
__all__ = [
16+
"AugmentationConfig",
17+
"DataConfig",
18+
"EmbedderConfig",
19+
"InferenceConfig",
20+
"InferenceNodeConfig",
21+
"InferencePipelineConfig",
22+
"LoggingConfig",
23+
"NodeOptimizerConfig",
24+
"OptimizationConfig",
25+
"PipelineOptimizerConfig",
26+
"TaskConfig",
27+
"VectorIndexConfig",
28+
]

autointent/configs/inference_cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Inference CLI configuration module."""
2+
13
from dataclasses import dataclass
24

35
from hydra.core.config_store import ConfigStore
@@ -7,11 +9,18 @@
79

810
@dataclass
911
class InferenceConfig:
12+
"""Configuration for the inference process."""
13+
1014
data_path: str
15+
"""Path to the file containing the data for prediction"""
1116
source_dir: str
17+
"""Path to the directory containing the inference config"""
1218
output_path: str
19+
"""Path to the file where the predictions will be saved"""
1320
log_level: LogLevel = LogLevel.ERROR
21+
"""Logging level"""
1422
with_metadata: bool = False
23+
"""Whether to save metadata along with the predictions"""
1524

1625

1726
cs = ConfigStore.instance()

autointent/configs/inference_pipeline.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Configuration for the inference pipeline."""
2+
13
from dataclasses import dataclass
24

35
from omegaconf import MISSING
@@ -7,5 +9,8 @@
79

810
@dataclass
911
class InferencePipelineConfig:
12+
"""Configuration for the inference pipeline."""
13+
1014
nodes: list[InferenceNodeConfig] = MISSING
15+
"""List of nodes in the inference pipeline"""
1116
_target_: str = "autointent.pipeline.InferencePipeline"

autointent/configs/name.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Random name generator."""
2+
13
import random
24
from datetime import datetime
35

@@ -340,12 +342,23 @@
340342

341343

342344
def generate_name() -> str:
345+
"""
346+
Generate a random name for a run.
347+
348+
:return: Random name
349+
"""
343350
adjective = random.choice(adjectives)
344351
noun = random.choice(nouns)
345352
return f"{adjective}_{noun}"
346353

347354

348355
def get_run_name(run_name: str | None = None) -> str:
356+
"""
357+
Get a run name.
358+
359+
:param run_name: Run name. If None, generate a random name
360+
:return: Run name with a timestamp
361+
"""
349362
if run_name is None:
350363
run_name = generate_name()
351364
return f"{run_name}_{datetime.now().strftime('%m-%d-%Y_%H-%M-%S')}" # noqa: DTZ005

0 commit comments

Comments
 (0)