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.
Files changed (145) hide show
  1. aiunittest-0.0.7/.flake8 +34 -0
  2. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/dependabot.yml +2 -2
  3. aiunittest-0.0.7/.github/instructions/general.instructions.md +112 -0
  4. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/workflows/ci.yml +17 -15
  5. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/workflows/release.yml +25 -24
  6. {aiunittest-0.0.4 → aiunittest-0.0.7}/.gitignore +3 -0
  7. {aiunittest-0.0.4 → aiunittest-0.0.7}/.pre-commit-config.yaml +24 -17
  8. aiunittest-0.0.7/GEMINI.md +86 -0
  9. aiunittest-0.0.7/Makefile +207 -0
  10. {aiunittest-0.0.4/src/AIUnitTest.egg-info → aiunittest-0.0.7}/PKG-INFO +97 -16
  11. {aiunittest-0.0.4 → aiunittest-0.0.7}/README.md +56 -0
  12. aiunittest-0.0.7/USAGE.md +76 -0
  13. aiunittest-0.0.7/docs/initial.md +82 -0
  14. {aiunittest-0.0.4 → aiunittest-0.0.7}/pyproject.toml +76 -24
  15. aiunittest-0.0.7/requirements.txt +30 -0
  16. {aiunittest-0.0.4 → aiunittest-0.0.7}/reset_fake_project.py +3 -0
  17. {aiunittest-0.0.4 → aiunittest-0.0.7/src/AIUnitTest.egg-info}/PKG-INFO +97 -16
  18. aiunittest-0.0.7/src/AIUnitTest.egg-info/SOURCES.txt +120 -0
  19. aiunittest-0.0.7/src/AIUnitTest.egg-info/entry_points.txt +2 -0
  20. aiunittest-0.0.7/src/AIUnitTest.egg-info/requires.txt +45 -0
  21. aiunittest-0.0.7/src/ai_unit_test/__init__.py +1 -0
  22. aiunittest-0.0.7/src/ai_unit_test/__main__.py +23 -0
  23. {aiunittest-0.0.4 → aiunittest-0.0.7}/src/ai_unit_test/_version.py +16 -3
  24. aiunittest-0.0.7/src/ai_unit_test/cli.py +168 -0
  25. aiunittest-0.0.7/src/ai_unit_test/core/__init__.py +57 -0
  26. aiunittest-0.0.7/src/ai_unit_test/core/cli_manager.py +34 -0
  27. aiunittest-0.0.7/src/ai_unit_test/core/exceptions.py +55 -0
  28. aiunittest-0.0.7/src/ai_unit_test/core/factories/__init__.py +9 -0
  29. aiunittest-0.0.7/src/ai_unit_test/core/factories/index_factory.py +182 -0
  30. aiunittest-0.0.7/src/ai_unit_test/core/factories/llm_factory.py +141 -0
  31. aiunittest-0.0.7/src/ai_unit_test/core/implementations/__init__.py +6 -0
  32. aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/__init__.py +7 -0
  33. aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/faiss_organizer.py +405 -0
  34. aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/memory_organizer.py +140 -0
  35. aiunittest-0.0.7/src/ai_unit_test/core/implementations/indexing/sklearn_organizer.py +408 -0
  36. aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/__init__.py +4 -0
  37. aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/huggingface_connector.py +388 -0
  38. aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/mock_connector.py +139 -0
  39. aiunittest-0.0.7/src/ai_unit_test/core/implementations/llm/openai_connector.py +397 -0
  40. aiunittest-0.0.7/src/ai_unit_test/core/interfaces/__init__.py +15 -0
  41. aiunittest-0.0.7/src/ai_unit_test/core/interfaces/index_organizer.py +125 -0
  42. aiunittest-0.0.7/src/ai_unit_test/core/interfaces/llm_connector.py +146 -0
  43. aiunittest-0.0.7/src/ai_unit_test/core/system_orchestrator.py +176 -0
  44. aiunittest-0.0.7/src/ai_unit_test/coverage_helper.py +61 -0
  45. aiunittest-0.0.7/src/ai_unit_test/file_helper.py +80 -0
  46. aiunittest-0.0.7/src/ai_unit_test/main.py +66 -0
  47. aiunittest-0.0.7/src/ai_unit_test/services/__init__.py +18 -0
  48. aiunittest-0.0.7/src/ai_unit_test/services/base_service.py +25 -0
  49. aiunittest-0.0.7/src/ai_unit_test/services/configuration_service.py +203 -0
  50. aiunittest-0.0.7/src/ai_unit_test/services/orchestration_service.py +410 -0
  51. aiunittest-0.0.7/src/ai_unit_test/services/processing_service.py +391 -0
  52. aiunittest-0.0.7/tests/behaviors/__init__.py +1 -0
  53. aiunittest-0.0.7/tests/behaviors/test_processing_service_behaviors.py +117 -0
  54. aiunittest-0.0.7/tests/conftest.py +203 -0
  55. aiunittest-0.0.7/tests/contracts/test_index_backend_contracts.py +66 -0
  56. aiunittest-0.0.7/tests/contracts/test_llm_provider_contracts.py +71 -0
  57. aiunittest-0.0.7/tests/fake_project/pyproject.toml +27 -0
  58. aiunittest-0.0.7/tests/fake_project/src/__init__.py +1 -0
  59. aiunittest-0.0.7/tests/fake_project/src/calculator.py +49 -0
  60. aiunittest-0.0.7/tests/fake_project/src/data_structures.py +148 -0
  61. aiunittest-0.0.7/tests/fake_project/src/string_utils.py +50 -0
  62. aiunittest-0.0.7/tests/integration/test_backend_switching.py +46 -0
  63. aiunittest-0.0.7/tests/integration/test_provider_switching.py +40 -0
  64. aiunittest-0.0.7/tests/migration/test_backward_compatibility.py +91 -0
  65. aiunittest-0.0.7/tests/performance/test_cli_performance.py +69 -0
  66. aiunittest-0.0.7/tests/performance/test_memory_usage.py +37 -0
  67. aiunittest-0.0.7/tests/performance/test_search_performance.py +40 -0
  68. aiunittest-0.0.7/tests/unit/cli/__init__.py +1 -0
  69. aiunittest-0.0.7/tests/unit/cli/test_cli.py +112 -0
  70. aiunittest-0.0.7/tests/unit/cli/test_cli_commands.py +1 -0
  71. aiunittest-0.0.7/tests/unit/cli/test_cli_coverage.py +151 -0
  72. aiunittest-0.0.7/tests/unit/cli/test_main_orchestration.py +1 -0
  73. aiunittest-0.0.7/tests/unit/core/factories/__init__.py +1 -0
  74. aiunittest-0.0.7/tests/unit/core/factories/test_index_factory.py +230 -0
  75. aiunittest-0.0.7/tests/unit/core/factories/test_llm_factory.py +176 -0
  76. aiunittest-0.0.7/tests/unit/core/implementations/__init__.py +1 -0
  77. aiunittest-0.0.7/tests/unit/core/implementations/indexing/__init__.py +1 -0
  78. aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_faiss_organizer.py +253 -0
  79. aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_memory_organizer.py +178 -0
  80. aiunittest-0.0.7/tests/unit/core/implementations/indexing/test_sklearn_organizer.py +146 -0
  81. aiunittest-0.0.7/tests/unit/core/implementations/llm/__init__.py +1 -0
  82. aiunittest-0.0.7/tests/unit/core/implementations/llm/test_huggingface_connector.py +124 -0
  83. aiunittest-0.0.7/tests/unit/core/implementations/llm/test_mock_connector.py +124 -0
  84. aiunittest-0.0.7/tests/unit/core/implementations/llm/test_openai_connector.py +246 -0
  85. aiunittest-0.0.7/tests/unit/core/interfaces/__init__.py +1 -0
  86. aiunittest-0.0.7/tests/unit/core/interfaces/test_index_organizer.py +250 -0
  87. aiunittest-0.0.7/tests/unit/core/interfaces/test_llm_connector.py +281 -0
  88. aiunittest-0.0.7/tests/unit/core/test_cli_manager.py +81 -0
  89. aiunittest-0.0.7/tests/unit/core/test_system_orchestrator.py +113 -0
  90. aiunittest-0.0.7/tests/unit/fixtures/__init__.py +1 -0
  91. {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/create_fake_coverage.py +2 -0
  92. aiunittest-0.0.7/tests/unit/fixtures/dummy_source.py +6 -0
  93. aiunittest-0.0.7/tests/unit/helpers/__init__.py +1 -0
  94. aiunittest-0.0.7/tests/unit/helpers/test_coverage_helper.py +516 -0
  95. aiunittest-0.0.7/tests/unit/helpers/test_file_helper.py +352 -0
  96. aiunittest-0.0.7/tests/unit/main/__init__.py +1 -0
  97. aiunittest-0.0.7/tests/unit/main/test_dummy_source.py +6 -0
  98. aiunittest-0.0.7/tests/unit/main/test_main.py +185 -0
  99. aiunittest-0.0.7/tests/unit/main/test_main_module.py +55 -0
  100. aiunittest-0.0.7/tests/unit/services/__init__.py +1 -0
  101. aiunittest-0.0.7/tests/unit/services/test_base_service.py +44 -0
  102. aiunittest-0.0.7/tests/unit/services/test_configuration_service.py +204 -0
  103. aiunittest-0.0.7/tests/unit/services/test_orchestration_service.py +189 -0
  104. aiunittest-0.0.7/tests/unit/services/test_processing_service.py +511 -0
  105. aiunittest-0.0.7/tests/unit/services/test_test_processing_service.py +1 -0
  106. aiunittest-0.0.4/.flake8 +0 -7
  107. aiunittest-0.0.4/USAGE.md +0 -33
  108. aiunittest-0.0.4/docs/initial.md +0 -88
  109. aiunittest-0.0.4/requirements.txt +0 -16
  110. aiunittest-0.0.4/src/AIUnitTest.egg-info/SOURCES.txt +0 -50
  111. aiunittest-0.0.4/src/AIUnitTest.egg-info/entry_points.txt +0 -2
  112. aiunittest-0.0.4/src/AIUnitTest.egg-info/requires.txt +0 -17
  113. aiunittest-0.0.4/src/ai_unit_test/__init__.py +0 -0
  114. aiunittest-0.0.4/src/ai_unit_test/cli.py +0 -289
  115. aiunittest-0.0.4/src/ai_unit_test/coverage_helper.py +0 -30
  116. aiunittest-0.0.4/src/ai_unit_test/file_helper.py +0 -112
  117. aiunittest-0.0.4/src/ai_unit_test/llm.py +0 -93
  118. aiunittest-0.0.4/src/ai_unit_test/main.py +0 -28
  119. aiunittest-0.0.4/tests/fake_project/pyproject.toml +0 -14
  120. aiunittest-0.0.4/tests/fake_project/src/__init__.py +0 -0
  121. aiunittest-0.0.4/tests/unit/conftest.py +0 -16
  122. aiunittest-0.0.4/tests/unit/dummy_source.py +0 -2
  123. aiunittest-0.0.4/tests/unit/test_cli.py +0 -367
  124. aiunittest-0.0.4/tests/unit/test_coverage_helper.py +0 -53
  125. aiunittest-0.0.4/tests/unit/test_dummy_source.py +0 -2
  126. aiunittest-0.0.4/tests/unit/test_file_helper.py +0 -247
  127. aiunittest-0.0.4/tests/unit/test_llm.py +0 -83
  128. aiunittest-0.0.4/tests/unit/test_main.py +0 -22
  129. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  130. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  131. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/documentation.yml +0 -0
  132. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  133. {aiunittest-0.0.4 → aiunittest-0.0.7}/.github/pull_request_template.md +0 -0
  134. {aiunittest-0.0.4 → aiunittest-0.0.7}/.markdownlint.yml +0 -0
  135. {aiunittest-0.0.4 → aiunittest-0.0.7}/CONTRIBUTING.md +0 -0
  136. {aiunittest-0.0.4 → aiunittest-0.0.7}/LICENSE +0 -0
  137. {aiunittest-0.0.4 → aiunittest-0.0.7}/conda/meta.yaml +0 -0
  138. {aiunittest-0.0.4 → aiunittest-0.0.7}/setup.cfg +0 -0
  139. {aiunittest-0.0.4 → aiunittest-0.0.7}/src/AIUnitTest.egg-info/dependency_links.txt +0 -0
  140. {aiunittest-0.0.4 → aiunittest-0.0.7}/src/AIUnitTest.egg-info/top_level.txt +0 -0
  141. {aiunittest-0.0.4 → aiunittest-0.0.7}/src/ai_unit_test/py.typed +0 -0
  142. {aiunittest-0.0.4 → aiunittest-0.0.7}/tests/fake_project/src/simple_math.py +0 -0
  143. {aiunittest-0.0.4 → aiunittest-0.0.7}/tests/fake_project/tests/test_simple_math.py +0 -0
  144. {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/fake.coverage +0 -0
  145. {aiunittest-0.0.4/tests/unit → aiunittest-0.0.7/tests/unit/fixtures}/fake_pyproject.toml +0 -0
@@ -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" # frequência de update (daily/weekly/monthly)
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
- - "*" # agrupar todas as dependências em um PR
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@v5
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@v5
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 pytest with coverage
56
+ - name: Run all tests (without coverage)
61
57
  run: |
62
- pytest --cov=src --cov-report=xml --cov-fail-under=80
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@v5
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: pytest
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@v5
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@release/v1
69
+ uses: pypa/gh-action-pypi-publish@v1.13.0
70
70
 
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
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
- shell: bash -l {0}
80
- run: |
81
- conda install -c conda-forge conda-build anaconda-client -y
82
- export GIT_TAG=${{ steps.get_next_version.outputs.NEXT_VERSION }}
83
- conda build conda --output-folder conda-dist
84
- anaconda login --with-token ${{ secrets.CONDA_TOKEN }}
85
- anaconda upload conda-dist/**/*.tar.bz2 --label main --skip-existing
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
@@ -208,3 +208,6 @@ __marimo__/
208
208
  tasks.md
209
209
  .vscode/settings.json
210
210
  src/ai_unit_test/_version.py
211
+ need_to_do/
212
+ valid_index_dir/*
213
+ data/faiss_index/*
@@ -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: v5.0.0
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.2.0
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: 6.0.1
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.1.0
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
- - id: markdownlint-cli2
46
+ - id: markdownlint-cli2
47
47
 
48
48
  - repo: https://github.com/adamchainz/blacken-docs
49
- rev: 1.19.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: [flake8-bugbear, flake8-annotations]
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.17.1
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: ["typer", "openai", "coverage", "pytest"]
79
- env:
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!"