AIUnitTest 0.0.4__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiunittest-0.0.7/.flake8 +34 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/dependabot.yml +2 -2
- aiunittest-0.0.7/.github/instructions/general.instructions.md +112 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/workflows/ci.yml +17 -15
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/workflows/release.yml +25 -24
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.gitignore +3 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.pre-commit-config.yaml +24 -17
- aiunittest-0.0.7/GEMINI.md +86 -0
- aiunittest-0.0.7/Makefile +207 -0
- {aiunittest-0.0.4/src/AIUnitTest.egg-info → aiunittest-0.0.7}/PKG-INFO +97 -16
- {aiunittest-0.0.4 → aiunittest-0.0.7}/README.md +56 -0
- aiunittest-0.0.7/USAGE.md +76 -0
- aiunittest-0.0.7/docs/initial.md +82 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/pyproject.toml +76 -24
- aiunittest-0.0.7/requirements.txt +30 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/reset_fake_project.py +3 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7/src/AIUnitTest.egg-info}/PKG-INFO +97 -16
- aiunittest-0.0.7/src/AIUnitTest.egg-info/SOURCES.txt +120 -0
- aiunittest-0.0.7/src/AIUnitTest.egg-info/entry_points.txt +2 -0
- aiunittest-0.0.7/src/AIUnitTest.egg-info/requires.txt +45 -0
- aiunittest-0.0.7/src/ai_unit_test/__init__.py +1 -0
- aiunittest-0.0.7/src/ai_unit_test/__main__.py +23 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/src/ai_unit_test/_version.py +16 -3
- aiunittest-0.0.7/src/ai_unit_test/cli.py +168 -0
- aiunittest-0.0.7/src/ai_unit_test/core/__init__.py +57 -0
- aiunittest-0.0.7/src/ai_unit_test/core/cli_manager.py +34 -0
- aiunittest-0.0.7/src/ai_unit_test/core/exceptions.py +55 -0
- aiunittest-0.0.7/src/ai_unit_test/core/factories/__init__.py +9 -0
- aiunittest-0.0.7/src/ai_unit_test/core/factories/index_factory.py +182 -0
- aiunittest-0.0.7/src/ai_unit_test/core/factories/llm_factory.py +141 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/__init__.py +6 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/__init__.py +7 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/faiss_organizer.py +405 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/memory_organizer.py +140 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/sklearn_organizer.py +408 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/__init__.py +4 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/huggingface_connector.py +388 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/mock_connector.py +139 -0
- aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/openai_connector.py +397 -0
- aiunittest-0.0.7/src/ai_unit_test/core/interfaces/__init__.py +15 -0
- aiunittest-0.0.7/src/ai_unit_test/core/interfaces/index_organizer.py +125 -0
- aiunittest-0.0.7/src/ai_unit_test/core/interfaces/llm_connector.py +146 -0
- aiunittest-0.0.7/src/ai_unit_test/core/system_orchestrator.py +176 -0
- aiunittest-0.0.7/src/ai_unit_test/coverage_helper.py +61 -0
- aiunittest-0.0.7/src/ai_unit_test/file_helper.py +80 -0
- aiunittest-0.0.7/src/ai_unit_test/main.py +66 -0
- aiunittest-0.0.7/src/ai_unit_test/services/__init__.py +18 -0
- aiunittest-0.0.7/src/ai_unit_test/services/base_service.py +25 -0
- aiunittest-0.0.7/src/ai_unit_test/services/configuration_service.py +203 -0
- aiunittest-0.0.7/src/ai_unit_test/services/orchestration_service.py +410 -0
- aiunittest-0.0.7/src/ai_unit_test/services/processing_service.py +391 -0
- aiunittest-0.0.7/tests/behaviors/__init__.py +1 -0
- aiunittest-0.0.7/tests/behaviors/test_processing_service_behaviors.py +117 -0
- aiunittest-0.0.7/tests/conftest.py +203 -0
- aiunittest-0.0.7/tests/contracts/test_index_backend_contracts.py +66 -0
- aiunittest-0.0.7/tests/contracts/test_llm_provider_contracts.py +71 -0
- aiunittest-0.0.7/tests/fake_project/pyproject.toml +27 -0
- aiunittest-0.0.7/tests/fake_project/src/__init__.py +1 -0
- aiunittest-0.0.7/tests/fake_project/src/calculator.py +49 -0
- aiunittest-0.0.7/tests/fake_project/src/data_structures.py +148 -0
- aiunittest-0.0.7/tests/fake_project/src/string_utils.py +50 -0
- aiunittest-0.0.7/tests/integration/test_backend_switching.py +46 -0
- aiunittest-0.0.7/tests/integration/test_provider_switching.py +40 -0
- aiunittest-0.0.7/tests/migration/test_backward_compatibility.py +91 -0
- aiunittest-0.0.7/tests/performance/test_cli_performance.py +69 -0
- aiunittest-0.0.7/tests/performance/test_memory_usage.py +37 -0
- aiunittest-0.0.7/tests/performance/test_search_performance.py +40 -0
- aiunittest-0.0.7/tests/unit/cli/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/cli/test_cli.py +112 -0
- aiunittest-0.0.7/tests/unit/cli/test_cli_commands.py +1 -0
- aiunittest-0.0.7/tests/unit/cli/test_cli_coverage.py +151 -0
- aiunittest-0.0.7/tests/unit/cli/test_main_orchestration.py +1 -0
- aiunittest-0.0.7/tests/unit/core/factories/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/core/factories/test_index_factory.py +230 -0
- aiunittest-0.0.7/tests/unit/core/factories/test_llm_factory.py +176 -0
- aiunittest-0.0.7/tests/unit/core/implementations/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/core/implementations/indexing/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_faiss_organizer.py +253 -0
- aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_memory_organizer.py +178 -0
- aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_sklearn_organizer.py +146 -0
- aiunittest-0.0.7/tests/unit/core/implementations/llm/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/core/implementations/llm/test_huggingface_connector.py +124 -0
- aiunittest-0.0.7/tests/unit/core/implementations/llm/test_mock_connector.py +124 -0
- aiunittest-0.0.7/tests/unit/core/implementations/llm/test_openai_connector.py +246 -0
- aiunittest-0.0.7/tests/unit/core/interfaces/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/core/interfaces/test_index_organizer.py +250 -0
- aiunittest-0.0.7/tests/unit/core/interfaces/test_llm_connector.py +281 -0
- aiunittest-0.0.7/tests/unit/core/test_cli_manager.py +81 -0
- aiunittest-0.0.7/tests/unit/core/test_system_orchestrator.py +113 -0
- aiunittest-0.0.7/tests/unit/fixtures/__init__.py +1 -0
- {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/create_fake_coverage.py +2 -0
- aiunittest-0.0.7/tests/unit/fixtures/dummy_source.py +6 -0
- aiunittest-0.0.7/tests/unit/helpers/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/helpers/test_coverage_helper.py +516 -0
- aiunittest-0.0.7/tests/unit/helpers/test_file_helper.py +352 -0
- aiunittest-0.0.7/tests/unit/main/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/main/test_dummy_source.py +6 -0
- aiunittest-0.0.7/tests/unit/main/test_main.py +185 -0
- aiunittest-0.0.7/tests/unit/main/test_main_module.py +55 -0
- aiunittest-0.0.7/tests/unit/services/__init__.py +1 -0
- aiunittest-0.0.7/tests/unit/services/test_base_service.py +44 -0
- aiunittest-0.0.7/tests/unit/services/test_configuration_service.py +204 -0
- aiunittest-0.0.7/tests/unit/services/test_orchestration_service.py +189 -0
- aiunittest-0.0.7/tests/unit/services/test_processing_service.py +511 -0
- aiunittest-0.0.7/tests/unit/services/test_test_processing_service.py +1 -0
- aiunittest-0.0.4/.flake8 +0 -7
- aiunittest-0.0.4/USAGE.md +0 -33
- aiunittest-0.0.4/docs/initial.md +0 -88
- aiunittest-0.0.4/requirements.txt +0 -16
- aiunittest-0.0.4/src/AIUnitTest.egg-info/SOURCES.txt +0 -50
- aiunittest-0.0.4/src/AIUnitTest.egg-info/entry_points.txt +0 -2
- aiunittest-0.0.4/src/AIUnitTest.egg-info/requires.txt +0 -17
- aiunittest-0.0.4/src/ai_unit_test/__init__.py +0 -0
- aiunittest-0.0.4/src/ai_unit_test/cli.py +0 -289
- aiunittest-0.0.4/src/ai_unit_test/coverage_helper.py +0 -30
- aiunittest-0.0.4/src/ai_unit_test/file_helper.py +0 -112
- aiunittest-0.0.4/src/ai_unit_test/llm.py +0 -93
- aiunittest-0.0.4/src/ai_unit_test/main.py +0 -28
- aiunittest-0.0.4/tests/fake_project/pyproject.toml +0 -14
- aiunittest-0.0.4/tests/fake_project/src/__init__.py +0 -0
- aiunittest-0.0.4/tests/unit/conftest.py +0 -16
- aiunittest-0.0.4/tests/unit/dummy_source.py +0 -2
- aiunittest-0.0.4/tests/unit/test_cli.py +0 -367
- aiunittest-0.0.4/tests/unit/test_coverage_helper.py +0 -53
- aiunittest-0.0.4/tests/unit/test_dummy_source.py +0 -2
- aiunittest-0.0.4/tests/unit/test_file_helper.py +0 -247
- aiunittest-0.0.4/tests/unit/test_llm.py +0 -83
- aiunittest-0.0.4/tests/unit/test_main.py +0 -22
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/documentation.yml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/pull_request_template.md +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/.markdownlint.yml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/CONTRIBUTING.md +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/LICENSE +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/conda/meta.yaml +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/setup.cfg +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/src/AIUnitTest.egg-info/dependency_links.txt +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/src/AIUnitTest.egg-info/top_level.txt +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/src/ai_unit_test/py.typed +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/tests/fake_project/src/simple_math.py +0 -0
- {aiunittest-0.0.4 → aiunittest-0.0.7}/tests/fake_project/tests/test_simple_math.py +0 -0
- {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/fake.coverage +0 -0
- {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/fake_pyproject.toml +0 -0
aiunittest-0.0.7/.flake8
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
statistics=true
|
|
3
|
+
count=True
|
|
4
|
+
max-line-length = 120
|
|
5
|
+
extend-select = B, ANN, D, C4, E, PT
|
|
6
|
+
max-complexity = 10
|
|
7
|
+
# E203: whitespace before ':' (Black's conflict)
|
|
8
|
+
# W503: line break before binary operator (Black's conflict)
|
|
9
|
+
# ANN101: missing-type-self - Modern type checkers, such as MyPy, are capable of inferring the type of self automatically. This makes explicit annotation of self redundant in most cases.
|
|
10
|
+
extend-ignore = E203,W503,ANN101
|
|
11
|
+
exclude =
|
|
12
|
+
env,
|
|
13
|
+
.venv,
|
|
14
|
+
venv,
|
|
15
|
+
build,
|
|
16
|
+
dist,
|
|
17
|
+
__pycache__,
|
|
18
|
+
assets,
|
|
19
|
+
tests/fake_project,
|
|
20
|
+
src/ai_unit_test/_version.py,
|
|
21
|
+
.pytest_cache,
|
|
22
|
+
htmlcov,
|
|
23
|
+
.ai_unit_test_cache,
|
|
24
|
+
.git
|
|
25
|
+
|
|
26
|
+
# F401: imported but unused (comum em __init__.py para re-exports)
|
|
27
|
+
per-file-ignores =
|
|
28
|
+
__init__.py:F401
|
|
29
|
+
tests/fake_project/**: D100,D103
|
|
30
|
+
|
|
31
|
+
[flake8-annotations]
|
|
32
|
+
suppress-none-returning = true
|
|
33
|
+
suppress-dummy-args = true
|
|
34
|
+
allow-untyped-defs = true
|
|
@@ -3,7 +3,7 @@ updates:
|
|
|
3
3
|
- package-ecosystem: "pip"
|
|
4
4
|
directory: "/"
|
|
5
5
|
schedule:
|
|
6
|
-
interval: "weekly"
|
|
6
|
+
interval: "weekly" # update frequency (daily/weekly/monthly)
|
|
7
7
|
commit-message:
|
|
8
8
|
prefix: "chore"
|
|
9
9
|
include: "scope"
|
|
@@ -11,7 +11,7 @@ updates:
|
|
|
11
11
|
groups:
|
|
12
12
|
python-deps:
|
|
13
13
|
patterns:
|
|
14
|
-
- "*"
|
|
14
|
+
- "*" # group all dependencies into a single PR
|
|
15
15
|
- package-ecosystem: "github-actions"
|
|
16
16
|
directory: "/"
|
|
17
17
|
schedule:
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# AIUnitTest – Copilot & Developer Instructions
|
|
6
|
+
|
|
7
|
+
## Running Tests
|
|
8
|
+
|
|
9
|
+
1. **Activate the virtual environment:**
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
source env/bin/activate
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Install dependencies (if needed):**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
make install-dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. **Run tests:**
|
|
22
|
+
|
|
23
|
+
- All unit tests (default):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
make test
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Only unit tests:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
make test-unit
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- Unit tests with coverage report:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
make test-unit-cov
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Coverage HTML report: `htmlcov/index.html`
|
|
42
|
+
|
|
43
|
+
- Integration tests:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
make test-integration
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- All tests (including slow):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
make test-all
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Fast tests (excluding slow):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
make test-fast
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Watch mode (auto re-run on file change):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
make test-watch
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- Using global pytest (not recommended):
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
make test-simple
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> **Note:** All test commands require the virtual environment to be active and dependencies installed.
|
|
74
|
+
|
|
75
|
+
## Project Structure
|
|
76
|
+
|
|
77
|
+
- **Source code:** `src/ai_unit_test/`
|
|
78
|
+
- **Tests:** `tests/`
|
|
79
|
+
- **Configs:** `pyproject.toml`, `requirements.txt`
|
|
80
|
+
- **Docs:** `README.md`, `docs/`
|
|
81
|
+
|
|
82
|
+
## Coding Conventions
|
|
83
|
+
|
|
84
|
+
- Use descriptive names for functions and variables.
|
|
85
|
+
- Cover normal and edge cases in tests.
|
|
86
|
+
- Follow mypy standards (see: mypy-lang.org/) and configured `flake8`/`bandit` rules.
|
|
87
|
+
- Never skip pre-commit hooks.
|
|
88
|
+
- Always run commands inside the project environment (`source env/bin/activate`).
|
|
89
|
+
- Follow clean code best practices.
|
|
90
|
+
|
|
91
|
+
## Quick Onboarding
|
|
92
|
+
|
|
93
|
+
- Clone the repo and enter the project folder.
|
|
94
|
+
|
|
95
|
+
- Create and activate the virtual environment:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python3 -m venv env
|
|
99
|
+
source env/bin/activate
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- Install all dependencies:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
make install-dev
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- Run tests and check code quality before committing.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
If you have questions, check the documentation or ask your team!
|
|
@@ -8,12 +8,14 @@ jobs:
|
|
|
8
8
|
setup:
|
|
9
9
|
name: Setup & Lint
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
11
13
|
|
|
12
14
|
steps:
|
|
13
15
|
- uses: actions/checkout@v5
|
|
14
16
|
|
|
15
17
|
- name: Setup Python 3.13 (with pip cache)
|
|
16
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v6
|
|
17
19
|
with:
|
|
18
20
|
python-version: "3.13"
|
|
19
21
|
cache: pip # ativa cache de dependencies pip :contentReference[oaicite:1]{index=1}
|
|
@@ -27,11 +29,8 @@ jobs:
|
|
|
27
29
|
restore-keys: |
|
|
28
30
|
precommit-${{ runner.os }}-
|
|
29
31
|
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: pip install -r requirements.txt
|
|
32
|
-
|
|
33
32
|
- name: Install project
|
|
34
|
-
run: pip install -e .
|
|
33
|
+
run: pip install -e .[all,dev]
|
|
35
34
|
|
|
36
35
|
- name: Run pre-commit hooks
|
|
37
36
|
run: pre-commit run --show-diff-on-failure --all-files
|
|
@@ -46,20 +45,21 @@ jobs:
|
|
|
46
45
|
steps:
|
|
47
46
|
- uses: actions/checkout@v5
|
|
48
47
|
|
|
49
|
-
- uses: actions/setup-python@
|
|
48
|
+
- uses: actions/setup-python@v6
|
|
50
49
|
with:
|
|
51
50
|
python-version: "3.13"
|
|
52
51
|
cache: pip
|
|
53
52
|
|
|
54
|
-
- name: Install dependencies
|
|
55
|
-
run: pip install -r requirements.txt
|
|
56
|
-
|
|
57
53
|
- name: Install project
|
|
58
|
-
run: pip install -e .
|
|
54
|
+
run: pip install -e .[all,dev]
|
|
59
55
|
|
|
60
|
-
- name: Run
|
|
56
|
+
- name: Run all tests (without coverage)
|
|
61
57
|
run: |
|
|
62
|
-
pytest --
|
|
58
|
+
pytest tests --tb=short --no-cov
|
|
59
|
+
|
|
60
|
+
- name: Run unit tests with coverage
|
|
61
|
+
run: |
|
|
62
|
+
pytest tests/unit --cov=src --cov-report=xml --cov-fail-under=70
|
|
63
63
|
|
|
64
64
|
- name: Upload coverage report
|
|
65
65
|
uses: actions/upload-artifact@v4
|
|
@@ -82,7 +82,7 @@ jobs:
|
|
|
82
82
|
pull-requests: write
|
|
83
83
|
steps:
|
|
84
84
|
- uses: actions/checkout@v5
|
|
85
|
-
- uses: actions/setup-python@
|
|
85
|
+
- uses: actions/setup-python@v6
|
|
86
86
|
with:
|
|
87
87
|
python-version: "3.13"
|
|
88
88
|
cache: pip
|
|
@@ -90,10 +90,12 @@ jobs:
|
|
|
90
90
|
run: pip install -r requirements.txt
|
|
91
91
|
|
|
92
92
|
- name: Install project
|
|
93
|
-
run: pip install -e .
|
|
93
|
+
run: pip install -e .[all,dev]
|
|
94
94
|
|
|
95
95
|
- name: Run tests
|
|
96
|
-
run:
|
|
96
|
+
run: |
|
|
97
|
+
pytest tests --tb=short --no-cov
|
|
98
|
+
pytest tests/unit --cov=src --cov-report=term-missing --cov-fail-under=70
|
|
97
99
|
|
|
98
100
|
- name: Add label for dependencies
|
|
99
101
|
id: fetch-metadata
|
|
@@ -44,16 +44,8 @@ jobs:
|
|
|
44
44
|
git tag -a ${{ steps.get_next_version.outputs.NEXT_VERSION }} -m "Release ${{ steps.get_next_version.outputs.NEXT_VERSION }}"
|
|
45
45
|
git push origin ${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
46
46
|
|
|
47
|
-
- name: Create GitHub Release
|
|
48
|
-
uses: ncipollo/release-action@v1
|
|
49
|
-
with:
|
|
50
|
-
tag: ${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
51
|
-
name: Release ${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
52
|
-
generateReleaseNotes: true
|
|
53
|
-
artifacts: "dist/*"
|
|
54
|
-
|
|
55
47
|
- name: Set up Python
|
|
56
|
-
uses: actions/setup-python@
|
|
48
|
+
uses: actions/setup-python@v6
|
|
57
49
|
with:
|
|
58
50
|
python-version: "3.9"
|
|
59
51
|
|
|
@@ -65,21 +57,30 @@ jobs:
|
|
|
65
57
|
- name: Build package
|
|
66
58
|
run: python -m build
|
|
67
59
|
|
|
60
|
+
- name: Create GitHub Release
|
|
61
|
+
uses: ncipollo/release-action@v1
|
|
62
|
+
with:
|
|
63
|
+
tag: ${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
64
|
+
name: Release ${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
65
|
+
generateReleaseNotes: true
|
|
66
|
+
artifacts: "dist/*"
|
|
67
|
+
|
|
68
68
|
- name: Publish to PyPI
|
|
69
|
-
uses: pypa/gh-action-pypi-publish@
|
|
69
|
+
uses: pypa/gh-action-pypi-publish@v1.13.0
|
|
70
70
|
|
|
71
|
-
- name: Set up Conda
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
# - name: Set up Conda
|
|
72
|
+
# uses: conda-incubator/setup-miniconda@v3
|
|
73
|
+
# with:
|
|
74
|
+
# python-version: 3.9
|
|
75
|
+
# auto-update-conda: true
|
|
76
|
+
# auto-activate-base: false
|
|
77
77
|
|
|
78
|
-
- name: Build and upload Conda package
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
# - name: Build and upload Conda package
|
|
79
|
+
# shell: bash -l {0}
|
|
80
|
+
# run: |
|
|
81
|
+
# conda install -c conda-forge conda-build anaconda-client -y
|
|
82
|
+
# conda install -c conda-forge --file conda/meta.yaml --yes
|
|
83
|
+
# export GIT_TAG=${{ steps.get_next_version.outputs.NEXT_VERSION }}
|
|
84
|
+
# conda build conda --output-folder conda-dist
|
|
85
|
+
# anaconda login --with-token ${{ secrets.CONDA_TOKEN }}
|
|
86
|
+
# anaconda upload conda-dist/**/*.tar.bz2 --label main --skip-existing
|
|
@@ -3,7 +3,7 @@ default_install_hook_types:
|
|
|
3
3
|
- commit-msg
|
|
4
4
|
repos:
|
|
5
5
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
-
rev:
|
|
6
|
+
rev: v6.0.0
|
|
7
7
|
hooks:
|
|
8
8
|
- id: check-yaml
|
|
9
9
|
args: ["--unsafe"]
|
|
@@ -17,36 +17,36 @@ repos:
|
|
|
17
17
|
args: ["--maxkb=500"] # por ex. limites de 500 KB
|
|
18
18
|
|
|
19
19
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
20
|
-
rev: v4.
|
|
20
|
+
rev: v4.3.0
|
|
21
21
|
hooks:
|
|
22
22
|
- id: conventional-pre-commit
|
|
23
23
|
stages:
|
|
24
24
|
- commit-msg
|
|
25
25
|
|
|
26
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
27
|
+
rev: v3.21.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: pyupgrade
|
|
30
|
+
args: ["--py313-plus"]
|
|
31
|
+
|
|
26
32
|
- repo: https://github.com/pycqa/isort
|
|
27
|
-
rev:
|
|
33
|
+
rev: 7.0.0
|
|
28
34
|
hooks:
|
|
29
35
|
- id: isort
|
|
30
36
|
|
|
31
37
|
- repo: https://github.com/psf/black
|
|
32
|
-
rev: 25.
|
|
38
|
+
rev: 25.9.0
|
|
33
39
|
hooks:
|
|
34
40
|
- id: black
|
|
35
41
|
args: ["--config", "pyproject.toml"]
|
|
36
42
|
|
|
37
|
-
- repo: https://github.com/asottile/pyupgrade
|
|
38
|
-
rev: v3.20.0
|
|
39
|
-
hooks:
|
|
40
|
-
- id: pyupgrade
|
|
41
|
-
args: ["--py3-plus", "--py313-plus"]
|
|
42
|
-
|
|
43
43
|
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
44
44
|
rev: v0.18.1
|
|
45
45
|
hooks:
|
|
46
|
-
|
|
46
|
+
- id: markdownlint-cli2
|
|
47
47
|
|
|
48
48
|
- repo: https://github.com/adamchainz/blacken-docs
|
|
49
|
-
rev: 1.
|
|
49
|
+
rev: 1.20.0
|
|
50
50
|
hooks:
|
|
51
51
|
- id: blacken-docs
|
|
52
52
|
additional_dependencies:
|
|
@@ -56,7 +56,15 @@ repos:
|
|
|
56
56
|
rev: 7.3.0
|
|
57
57
|
hooks:
|
|
58
58
|
- id: flake8
|
|
59
|
-
additional_dependencies:
|
|
59
|
+
additional_dependencies:
|
|
60
|
+
[
|
|
61
|
+
flake8-bugbear,
|
|
62
|
+
flake8-annotations,
|
|
63
|
+
flake8-docstrings,
|
|
64
|
+
flake8-comprehensions,
|
|
65
|
+
flake8-eradicate,
|
|
66
|
+
flake8-pytest-style,
|
|
67
|
+
]
|
|
60
68
|
args: ["--config", ".flake8"]
|
|
61
69
|
|
|
62
70
|
- repo: https://github.com/PyCQA/bandit
|
|
@@ -69,12 +77,11 @@ repos:
|
|
|
69
77
|
- "pre-commit"
|
|
70
78
|
|
|
71
79
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
72
|
-
rev: v1.
|
|
80
|
+
rev: v1.18.2
|
|
73
81
|
hooks:
|
|
74
82
|
- id: mypy
|
|
75
83
|
entry: mypy --config-file pyproject.toml
|
|
76
84
|
language: python
|
|
77
85
|
require_serial: true
|
|
78
|
-
additional_dependencies:
|
|
79
|
-
|
|
80
|
-
PYTHONPATH: src
|
|
86
|
+
additional_dependencies:
|
|
87
|
+
["typer", "openai", "coverage", "pytest", "faiss-cpu", "scikit-learn"]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
# Gemini CLI Instructions
|
|
3
|
+
|
|
4
|
+
## How to run the tests
|
|
5
|
+
|
|
6
|
+
- **Always activate the project virtual environment first:**
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
source env/bin/activate
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- **To run all unit tests (default):**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
make test
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- **To run only unit tests:**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
make test-unit
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- **To run unit tests with coverage report:**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
make test-unit-cov
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- The HTML coverage report will be generated at `htmlcov/index.html`.
|
|
31
|
+
|
|
32
|
+
- **To run integration tests:**
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
make test-integration
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- **To run all tests (including slow ones):**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
make test-all
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **To run only fast tests (excluding slow ones):**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
make test-fast
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **To run tests in watch mode (auto re-run on file change):**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
make test-watch
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- **If you want to run tests using the global pytest (not recommended):**
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
make test-simple
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **Tip:** All test commands require the virtual environment to be active and dependencies installed.
|
|
63
|
+
If you see errors about missing dependencies, run:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
make install-dev
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **Test files are located in the `tests/` folder.**
|
|
70
|
+
|
|
71
|
+
## Project Structure
|
|
72
|
+
|
|
73
|
+
- Source code: `src/ai_unit_test/`
|
|
74
|
+
- Tests: `tests/`
|
|
75
|
+
- Configurations: `pyproject.toml`, `requirements.txt`
|
|
76
|
+
- Documentation: `README.md`, `docs/`
|
|
77
|
+
|
|
78
|
+
## Conventions
|
|
79
|
+
|
|
80
|
+
- Follow mypy standards for Python according to the configured flake8 and bandit rules.
|
|
81
|
+
- Use descriptive names for functions and variables.
|
|
82
|
+
- Tests must cover normal and edge cases.
|
|
83
|
+
- Never skip pre-commit.
|
|
84
|
+
- Always run commands inside the project env (`source env/bin/activate`).
|
|
85
|
+
- Follow clean code best practices.
|
|
86
|
+
- Always think as much as necessary.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Makefile for AIUnitTest
|
|
2
|
+
# ======================
|
|
3
|
+
|
|
4
|
+
# Variables
|
|
5
|
+
PYTHON := python3
|
|
6
|
+
PIP := pip
|
|
7
|
+
VENV_BIN := env/bin
|
|
8
|
+
PYTEST := $(VENV_BIN)/pytest
|
|
9
|
+
BLACK := $(VENV_BIN)/black
|
|
10
|
+
ISORT := $(VENV_BIN)/isort
|
|
11
|
+
FLAKE8 := $(VENV_BIN)/flake8
|
|
12
|
+
MYPY := $(VENV_BIN)/mypy
|
|
13
|
+
COVERAGE := $(VENV_BIN)/coverage
|
|
14
|
+
PRE_COMMIT := $(VENV_BIN)/pre-commit
|
|
15
|
+
|
|
16
|
+
# Directories
|
|
17
|
+
SRC_DIR := src
|
|
18
|
+
TEST_DIR := tests
|
|
19
|
+
VENV_DIR := env
|
|
20
|
+
|
|
21
|
+
# Configurations
|
|
22
|
+
.PHONY: help install install-dev test test-unit test-integration lint format type-check \
|
|
23
|
+
coverage clean build publish pre-commit setup-dev run-app activate-env \
|
|
24
|
+
test-fast test-all check-all docs reset-fake-project
|
|
25
|
+
|
|
26
|
+
# Default target
|
|
27
|
+
.DEFAULT_GOAL := help
|
|
28
|
+
|
|
29
|
+
# Check if virtual environment exists
|
|
30
|
+
check-venv:
|
|
31
|
+
@if [ ! -f $(VENV_BIN)/python ]; then \
|
|
32
|
+
echo "❌ Virtual environment not found at $(VENV_DIR)"; \
|
|
33
|
+
echo "Run 'make create-venv' to create or activate existing virtual environment"; \
|
|
34
|
+
exit 1; \
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
help: ## Show this help message
|
|
38
|
+
@echo "Available commands:"
|
|
39
|
+
@echo
|
|
40
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
41
|
+
|
|
42
|
+
# Installation and setup
|
|
43
|
+
install: ## Install the project in development mode
|
|
44
|
+
$(PIP) install -e .
|
|
45
|
+
|
|
46
|
+
install-dev: ## Install development dependencies
|
|
47
|
+
$(PIP) install -e ".[dev]"
|
|
48
|
+
$(PIP) install -r requirements.txt
|
|
49
|
+
|
|
50
|
+
install-prod: ## Install production dependencies only
|
|
51
|
+
$(PIP) install -e .
|
|
52
|
+
|
|
53
|
+
setup-dev: install-dev ## Configure complete development environment
|
|
54
|
+
@if [ -f $(VENV_BIN)/pre-commit ]; then \
|
|
55
|
+
$(PRE_COMMIT) install; \
|
|
56
|
+
else \
|
|
57
|
+
echo "⚠️ pre-commit not found in virtual environment, trying global version"; \
|
|
58
|
+
pre-commit install || echo "❌ Error configuring pre-commit"; \
|
|
59
|
+
fi
|
|
60
|
+
@echo "✅ Development environment configured!"
|
|
61
|
+
|
|
62
|
+
# Virtual environment
|
|
63
|
+
create-venv: ## Create a new virtual environment
|
|
64
|
+
$(PYTHON) -m venv $(VENV_DIR)
|
|
65
|
+
@echo "✅ Virtual environment created at $(VENV_DIR)"
|
|
66
|
+
@echo "To activate: source $(VENV_DIR)/bin/activate"
|
|
67
|
+
|
|
68
|
+
activate-env: ## Show how to activate virtual environment
|
|
69
|
+
@echo "To activate the virtual environment, run:"
|
|
70
|
+
@echo "source $(VENV_DIR)/bin/activate"
|
|
71
|
+
|
|
72
|
+
# Tests
|
|
73
|
+
test: check-venv ## Run unit tests with coverage (default)
|
|
74
|
+
$(PYTEST) $(TEST_DIR)/unit -v
|
|
75
|
+
|
|
76
|
+
test-unit: check-venv ## Run unit tests only
|
|
77
|
+
$(PYTEST) $(TEST_DIR)/unit -v
|
|
78
|
+
|
|
79
|
+
test-unit-cov: check-venv ## Run unit tests with coverage
|
|
80
|
+
$(PYTEST) $(TEST_DIR)/unit --cov=$(SRC_DIR) --cov-report=html --cov-report=term-missing
|
|
81
|
+
|
|
82
|
+
test-integration: check-venv ## Run integration tests
|
|
83
|
+
$(PYTEST) $(TEST_DIR) -v -m "integration"
|
|
84
|
+
|
|
85
|
+
test-fast: check-venv ## Run fast tests (exclude slow tests)
|
|
86
|
+
$(PYTEST) $(TEST_DIR) -v -m "not slow"
|
|
87
|
+
|
|
88
|
+
test-all: check-venv ## Run all tests including slow ones
|
|
89
|
+
$(PYTEST) $(TEST_DIR) -v --tb=short
|
|
90
|
+
|
|
91
|
+
test-watch: check-venv ## Run tests in watch mode (re-run when files change)
|
|
92
|
+
$(PYTEST) $(TEST_DIR) -f
|
|
93
|
+
|
|
94
|
+
test-simple: ## Run tests using global pytest (fallback)
|
|
95
|
+
@if command -v pytest >/dev/null 2>&1; then \
|
|
96
|
+
pytest $(TEST_DIR) -v; \
|
|
97
|
+
else \
|
|
98
|
+
echo "❌ pytest not found. Run 'make install-dev' first"; \
|
|
99
|
+
exit 1; \
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# Code coverage
|
|
103
|
+
coverage: check-venv ## Generate coverage report
|
|
104
|
+
$(PYTEST) $(TEST_DIR)/unit --cov=$(SRC_DIR) --cov-report=html --cov-report=term-missing
|
|
105
|
+
@echo "📊 HTML coverage report generated at htmlcov/index.html"
|
|
106
|
+
|
|
107
|
+
coverage-xml: check-venv ## Generate XML coverage report
|
|
108
|
+
$(PYTEST) $(TEST_DIR)/unit --cov=$(SRC_DIR) --cov-report=xml
|
|
109
|
+
|
|
110
|
+
# Code quality
|
|
111
|
+
lint: check-venv ## Run linting with flake8
|
|
112
|
+
$(FLAKE8) $(SRC_DIR) $(TEST_DIR)
|
|
113
|
+
|
|
114
|
+
format: check-venv ## Format code with black and isort
|
|
115
|
+
$(BLACK) $(SRC_DIR) $(TEST_DIR)
|
|
116
|
+
$(ISORT) $(SRC_DIR) $(TEST_DIR)
|
|
117
|
+
|
|
118
|
+
format-check: check-venv ## Check formatting without modifying files
|
|
119
|
+
$(BLACK) --check $(SRC_DIR) $(TEST_DIR)
|
|
120
|
+
$(ISORT) --check-only $(SRC_DIR) $(TEST_DIR)
|
|
121
|
+
|
|
122
|
+
type-check: check-venv ## Run type checking with mypy
|
|
123
|
+
$(MYPY) $(SRC_DIR)
|
|
124
|
+
|
|
125
|
+
# Combined checks
|
|
126
|
+
check-all: format-check lint type-check test ## Run all quality checks
|
|
127
|
+
@echo "✅ All checks passed!"
|
|
128
|
+
|
|
129
|
+
pre-commit-run: ## Run pre-commit on all files
|
|
130
|
+
$(PRE_COMMIT) run --all-files
|
|
131
|
+
|
|
132
|
+
pre-commit-install: ## Install pre-commit hooks
|
|
133
|
+
$(PRE_COMMIT) install
|
|
134
|
+
|
|
135
|
+
# Build and publishing
|
|
136
|
+
build: clean ## Build the package
|
|
137
|
+
$(PYTHON) -m build
|
|
138
|
+
|
|
139
|
+
clean: ## Remove temporary and build files
|
|
140
|
+
rm -rf build/
|
|
141
|
+
rm -rf dist/
|
|
142
|
+
rm -rf *.egg-info/
|
|
143
|
+
rm -rf .pytest_cache/
|
|
144
|
+
rm -rf .coverage
|
|
145
|
+
rm -rf htmlcov/
|
|
146
|
+
rm -rf .mypy_cache/
|
|
147
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
148
|
+
find . -type f -name "*.pyc" -delete
|
|
149
|
+
|
|
150
|
+
publish-test: build ## Publish to TestPyPI
|
|
151
|
+
twine upload --repository testpypi dist/*
|
|
152
|
+
|
|
153
|
+
publish: build ## Publish to PyPI
|
|
154
|
+
twine upload dist/*
|
|
155
|
+
|
|
156
|
+
# Application execution
|
|
157
|
+
run-app: check-venv ## Run the main application
|
|
158
|
+
$(VENV_BIN)/ai-unit-test --help
|
|
159
|
+
|
|
160
|
+
run-cli: check-venv ## Run the CLI with example arguments
|
|
161
|
+
$(VENV_BIN)/ai-unit-test --help
|
|
162
|
+
|
|
163
|
+
# Project utilities
|
|
164
|
+
reset-fake-project: ## Reset fake project for testing
|
|
165
|
+
$(PYTHON) reset_fake_project.py
|
|
166
|
+
|
|
167
|
+
docs: ## Generate documentation (placeholder)
|
|
168
|
+
@echo "📚 Documentation will be implemented soon"
|
|
169
|
+
|
|
170
|
+
# Quick development commands
|
|
171
|
+
dev-install: create-venv activate-env install-dev setup-dev ## Complete setup for new developers
|
|
172
|
+
@echo "🚀 Development environment ready!"
|
|
173
|
+
@echo "Don't forget to activate the virtual environment: source $(VENV_DIR)/bin/activate"
|
|
174
|
+
|
|
175
|
+
quick-test: format lint test-fast ## Quick check before commit
|
|
176
|
+
@echo "✅ Quick check completed!"
|
|
177
|
+
|
|
178
|
+
full-check: format lint type-check coverage ## Complete verification
|
|
179
|
+
@echo "✅ Full check completed!"
|
|
180
|
+
|
|
181
|
+
# Debug and logs
|
|
182
|
+
show-logs: ## Show recent logs
|
|
183
|
+
@echo "📋 Available logs:"
|
|
184
|
+
@ls -la logs/ 2>/dev/null || echo "No logs found"
|
|
185
|
+
|
|
186
|
+
tail-logs: ## Follow logs in real time
|
|
187
|
+
tail -f logs/*.log 2>/dev/null || echo "No logs to follow"
|
|
188
|
+
|
|
189
|
+
# Project information
|
|
190
|
+
info: ## Show project information
|
|
191
|
+
@echo "📦 AIUnitTest - Project Information"
|
|
192
|
+
@echo "=================================="
|
|
193
|
+
@echo "Python: $(shell $(PYTHON) --version)"
|
|
194
|
+
@echo "Pip: $(shell $(PIP) --version)"
|
|
195
|
+
@echo "Current directory: $(shell pwd)"
|
|
196
|
+
@echo "Current branch: $(shell git branch --show-current 2>/dev/null || echo 'N/A')"
|
|
197
|
+
@echo "Last commit: $(shell git log -1 --format=%cd --date=short 2>/dev/null || echo 'N/A')"
|
|
198
|
+
|
|
199
|
+
# Special commands for CI/CD
|
|
200
|
+
ci-install: ## Installation for CI/CD
|
|
201
|
+
$(PIP) install -e ".[dev]"
|
|
202
|
+
|
|
203
|
+
ci-test: ## Tests for CI/CD
|
|
204
|
+
$(PYTEST) $(TEST_DIR) --cov=$(SRC_DIR) --cov-report=xml --cov-report=term
|
|
205
|
+
|
|
206
|
+
ci-check: ci-install format-check lint type-check ci-test ## Complete CI/CD verification
|
|
207
|
+
@echo "✅ CI/CD verification completed!"
|