[tox]
envlist = lint,core,deep,train-dep,train-pos,prompt,agent,langdetect,tts

[testenv:lint]
basepython = python3.10
deps =
    ruff>=0.9.0
commands =
    ruff check underthesea/

[testenv:core]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    python -m unittest discover tests.pipeline.sent_tokenize
    python -m unittest discover tests.pipeline.text_normalize
    python -m unittest discover tests.pipeline.word_tokenize
    python -m unittest discover tests.pipeline.pos_tag
    python -m unittest discover tests.pipeline.chunking
    python -m unittest tests.pipeline.ner.test_ner
    python -m unittest discover tests.dictionary
    python -m unittest discover tests.feature_engineering
    python tests/test_data_fetcher.py
    python -m unittest discover tests.corpus

    ; classification module
    python -m unittest tests.pipeline.classification.test_bank
    python -m unittest tests.pipeline.classification.test_general

    ; sentiment module
    ; (disable these tests for now due to sklearn 1.6.0 version issues)
    ; (will re-enable after fixing the issues)
    ; python -m unittest discover tests.pipeline.sentiment
    python -m unittest tests.pipeline.sentiment.test_bank

    ; command lines
    ; underthesea list-data
    ; underthesea list-data --all
    ; underthesea list-model
    ; underthesea download-data VNTC

[testenv:deep]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    ; Modules with deep learning
    pip install -e .[deep]

    ; transforms module (GitHub issue #714)
    python -m unittest discover tests.transforms

    ; ner module
    python -m unittest tests.pipeline.ner.test_ner_deep

    ; translate module
    python -m unittest discover tests.pipeline.translate

    ; dependency_parse module
    python -m unittest tests.pipeline.dependency_parse.test_dependency_parse

[testenv:train-dep]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    ; Install deep learning dependencies
    pip install -e .[deep]

    ; Test dependency parser training (PyTorch v2 compatibility)
    python -m unittest tests.pipeline.dependency_parse.test_train

    ; Test ParserTrainer (GH-392)
    python -m unittest tests.trainers.test_parser_trainer

[testenv:train-pos]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    ; Install base dependencies (CRF-based, no deep learning required)
    pip install -e .

    ; Install seqeval for training evaluation
    pip install seqeval

    ; Build underthesea_core Rust extension
    pip install maturin
    maturin develop -m extensions/underthesea_core/Cargo.toml

    ; Test POS training pipeline (GH-423)
    python -m unittest tests.trainers.test_crf_pos_training

    ; Test POSTrainer
    python -m unittest tests.trainers.test_pos_trainer

[testenv:prompt]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea
    OPENAI_API_KEY = {env:OPENAI_API_KEY:}

commands =
    ; Modules with prompt
    pip install -e .[prompt]

    ; prompt module
    python -m unittest tests.pipeline.classification.test_prompt

[testenv:agent]
basepython = python3.10
deps =
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea
    OPENAI_API_KEY = {env:OPENAI_API_KEY:}

commands =
    pip install -e .[agent]
    python -m unittest discover tests.agent

[testenv:langdetect]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    pip install -e .

    ; lang_detect module
    python -m unittest tests.pipeline.lang_detect.test_lang_detect

[testenv:tts]
basepython = python3.10
deps=
    pip>=20.3

setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/underthesea

commands =
    ; install dependencies for tts module
    pip install -e .[voice]

    ; tts module tests (JAX API compatibility)
    python -m unittest discover tests.pipeline.tts