unit-tests-generator 0.1.0__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 (28) hide show
  1. unit_tests_generator-0.1.0/LICENSE +21 -0
  2. unit_tests_generator-0.1.0/PKG-INFO +236 -0
  3. unit_tests_generator-0.1.0/README.md +212 -0
  4. unit_tests_generator-0.1.0/pyproject.toml +85 -0
  5. unit_tests_generator-0.1.0/setup.cfg +4 -0
  6. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/PKG-INFO +236 -0
  7. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/SOURCES.txt +26 -0
  8. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/dependency_links.txt +1 -0
  9. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/entry_points.txt +2 -0
  10. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/requires.txt +7 -0
  11. unit_tests_generator-0.1.0/src/unit_tests_generator.egg-info/top_level.txt +1 -0
  12. unit_tests_generator-0.1.0/src/utgen/__init__.py +0 -0
  13. unit_tests_generator-0.1.0/src/utgen/config/__init__.py +0 -0
  14. unit_tests_generator-0.1.0/src/utgen/config/params.py +1 -0
  15. unit_tests_generator-0.1.0/src/utgen/constants.py +1 -0
  16. unit_tests_generator-0.1.0/src/utgen/logger.py +87 -0
  17. unit_tests_generator-0.1.0/src/utgen/main.py +43 -0
  18. unit_tests_generator-0.1.0/src/utgen/pipeline.py +84 -0
  19. unit_tests_generator-0.1.0/src/utgen/raggraph/__init__.py +0 -0
  20. unit_tests_generator-0.1.0/src/utgen/raggraph/parser.py +235 -0
  21. unit_tests_generator-0.1.0/src/utgen/raggraph/utils.py +201 -0
  22. unit_tests_generator-0.1.0/src/utgen/raggraph/walker.py +70 -0
  23. unit_tests_generator-0.1.0/src/utgen/test_generation_crew/__init__.py +0 -0
  24. unit_tests_generator-0.1.0/src/utgen/test_generation_crew/crew.py +98 -0
  25. unit_tests_generator-0.1.0/src/utgen/test_generation_crew/guardrails.py +99 -0
  26. unit_tests_generator-0.1.0/src/utgen/test_generation_crew/llm_config.py +24 -0
  27. unit_tests_generator-0.1.0/src/utgen/test_generation_crew/schemas.py +26 -0
  28. unit_tests_generator-0.1.0/src/utgen/validation.py +82 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ArnauFabregat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: unit-tests-generator
3
+ Version: 0.1.0
4
+ Summary: Open source project to build a unit tests generator in Python.
5
+ Author: Arnau Fabregat
6
+ License: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Requires-Python: >=3.13
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: crewai[google-genai]>=1.10.1
17
+ Requires-Dist: litellm>=1.82.1
18
+ Requires-Dist: loguru>=0.7.3
19
+ Requires-Dist: networkx>=3.6.1
20
+ Requires-Dist: pytest>=9.0.2
21
+ Requires-Dist: pytest-cov>=7.0.0
22
+ Requires-Dist: typer>=0.23.1
23
+ Dynamic: license-file
24
+
25
+ # 🛡️ Unit-Tests-Generator
26
+ *Autonomous, RAG-Driven Test Engineering for Python.*
27
+
28
+ **Unit-Tests-Generator** is an intelligent agentic tool that automates the entire `pytest` lifecycle. Unlike static template generators, it leverages an in-memory knowledge graph of your codebase and RAG to produce context-aware, executable, and validated test suites.
29
+
30
+ The system operates through a multi-stage pipeline:
31
+ 1. **Codebase Graphing**: Maps your repository into an in-memory graph to understand cross-file dependencies and type definitions.
32
+
33
+ 2. **Contextual RAG**: Retrieves relevant context for the LLM, ensuring the generated tests understand your project's unique patterns.
34
+
35
+ 3. **Inference & Guardrails**: Generates test cases via LLM API, filtered through strict structural and security guardrails.
36
+
37
+ 4. **The "Sandbox" Validation**: Automatically executes the generated tests.
38
+
39
+ 5. **Persistence**: Only tests that pass execution and meet coverage criteria are committed to your `/tests` directory.
40
+
41
+ ## Quick Start
42
+ ```bash
43
+ # Install the package
44
+ pip install unit-tests-generator
45
+
46
+ # Generate tests using source and output paths
47
+ utgen -s src/ -t tests/
48
+ ```
49
+
50
+ ### Setting up your LLM
51
+ Required environment variables:
52
+ ```bash
53
+ # .env file
54
+ LLM_OPENROUTER_MODEL = ""
55
+ LLM_OPENROUTER_API_KEY = ""
56
+ ```
57
+ - Powered by CrewAI and OpenRouter: https://docs.crewai.com/en/concepts/llms#open-router.
58
+ - OpenRouter models: https://openrouter.ai/models.
59
+
60
+ ## Table of Contents
61
+ 1. [Usage](#usage)
62
+ 2. [Examples](#examples)
63
+ 3. [Graph structure](#graph-structure)
64
+ 4. [Code Quality & Documentation](#code-quality--documentation)
65
+ - [Pre-commit Hooks](#pre-commit-hooks)
66
+ - [Unit Testing](#unit-testing)
67
+ 5. [Virtual Environment](#virtual-environment)
68
+ - [Create a new virtualenv with the project's dependencies](#create-a-new-virtualenv-with-the-projects-dependencies)
69
+ - [Checking if the project's virtual environment is active](#checking-if-the-projects-virtual-environment-is-active)
70
+ - [Updating the project's dependencies](#updating-the-projects-dependencies)
71
+ 6. [LICENSE](#license)
72
+ 7. [TODO](#todo)
73
+
74
+ ## Usage
75
+ `utgen` is designed to be simple and terminal-first. Once installed, you can generate tests by pointing the tool to your source code and specifying an output directory.
76
+
77
+ ### CLI Arguments
78
+ | Flag | Shortcut | Description | Required | Default |
79
+ | :--- | :--- | :--- | :--- | :--- |
80
+ | `--src_path` | `-s` | Path to the directory containing your source code. | **Yes** | — |
81
+ | `--test_path` | `-t` | Path to the directory where generated tests will be saved. | **Yes** | — |
82
+ | `--graph_path` | `-g` | Path to the RAG-Graph data (enables advanced context). | No | `None` |
83
+ | `--help` | — | Show the help message and exit. | No | — |
84
+
85
+ ### Basic Command
86
+ Run a standard generation without a RAG-Graph:
87
+ ```bash
88
+ utgen -s src/ -t tests/
89
+ ```
90
+ ### Full Command
91
+ Enable RAG-Graph context for more accurate, context-aware test generation:
92
+ ```bash
93
+ utgen --src_path src/ --test_path tests/ --graph_path data/
94
+ ```
95
+
96
+ ## Examples
97
+ Upload `repo.graphml` to https://lite.gephi.org/.
98
+
99
+ - This repository:
100
+ - Code coverage:
101
+ - Example for repository https://github.com/ArnauFabregat/probability_estimation
102
+ ![Diagram](https://raw.githubusercontent.com/ArnauFabregat/unit-tests-generator/main/docs/probability-estimation-repo-graph.png)
103
+ - Code coverage:
104
+ - Example for repository
105
+ - Code coverage
106
+
107
+ ## Graph structure
108
+ To extract relevant context, the graph needs:
109
+
110
+ ### 🟢 Nodes for:
111
+ - Files
112
+ - Classes
113
+ - Functions
114
+ - Methods
115
+ - Nested functions
116
+
117
+ Fields:
118
+ - **id**: canonical ID (e.g., file::...::class::Calibrator / ...::method::Calibrator.fit)
119
+ - **type**: "file" | "class" | "method" | "function" | "nested_function"
120
+ - **name**: symbol name ("Calibrator", "fit", etc.)
121
+ - **file**: file path
122
+ - **signature**: normalized function/method signature "def fit(self, probs, y) -> None"
123
+ - **docstring**: (trimmed) docstring
124
+ - **source**: actual source code of the node
125
+
126
+ ### ➡️ Edges for:
127
+ - **defines** (file → symbol, function → nested function)
128
+ - **has_method** (class → method)
129
+ - **calls** (function/method → called symbol)
130
+ - **references** (function/method → referenced symbol)
131
+
132
+ Fields:
133
+ - **src**: source node id
134
+ - **dst**: destination node id
135
+ - **rel**: "defines" | "has_method" | "references" | "calls"
136
+
137
+ ### 🧠 Prompt template
138
+ TBD
139
+
140
+ ## Code Quality & Documentation
141
+ ### Pre-commit Hooks
142
+ ---
143
+ This project uses [pre-commit](https://pre-commit.com/) hooks to enforce code quality standards automatically before each commit. The following hooks are configured:
144
+
145
+ - **Formatting & File Integrity**: `trailing-whitespace`, `end-of-file-fixer`, `check-yaml`, `check-toml`
146
+ - **Code Linting & Formatting**: `ruff-check`, `ruff-format`
147
+ - **Type Checking**: `mypy`
148
+
149
+ Pre-commit hooks are automatically installed during virtual environment setup (`uv sync`).
150
+ - To run them for modified (staged) files:
151
+ ```bash
152
+ uv run pre-commit run
153
+ ```
154
+ - To run them for the entire repository:
155
+ ```bash
156
+ uv run pre-commit run --all-files
157
+ ```
158
+
159
+ ### Unit Testing
160
+ ---
161
+ Unit tests ensure code reliability and prevent regressions. Tests are written using pytest and should cover critical functionality.
162
+
163
+ To run all tests:
164
+ ```bash
165
+ uv run pytest
166
+ ```
167
+
168
+ To run tests with coverage:
169
+ ```bash
170
+ uv run pytest --cov
171
+ ```
172
+
173
+ ## Virtual Environment
174
+ ### Create a new virtualenv with the project's dependencies
175
+ ---
176
+ Install the project's virtual environment and set it as your project's Python interpreter.
177
+ This will also install the project's current dependencies.
178
+
179
+ Open a terminal in VSCode, then execute the following commands:
180
+
181
+ 1. Install [UV: Python package and project manager](https://docs.astral.sh/uv/getting-started/installation/):
182
+ * On Mac OSX / Linux: `curl -LsSf https://astral.sh/uv/install.sh | sh`
183
+ * On Windows [In Powershell]: `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`
184
+
185
+ 2. [optional] To create virtual environment from scratch with `uv`: [Working on projects](https://docs.astral.sh/uv/guides/projects/)
186
+
187
+ 3. If the environment already exists, install the virtual environment. It will be installed in the project's root, under a new directory named `.venv`:
188
+ * `uv sync`
189
+ * `uv sync --group dev --group dashboard --group test` to install all the dependency groups
190
+
191
+ 4. Activate the new virtual environment:
192
+ * On Mac OSX / Linux: `source .venv/bin/activate`
193
+ * On Windows [In Powershell]: `.venv\Scripts\activate`
194
+
195
+ 5. Configure / install pre-commit hooks:
196
+ * [Pre-commit](https://pre-commit.com/) is a tool that helps us keep the repository complying with certain formatting and style standards, using the `hooks` configured in the `.pre-commit-config.yaml` file.
197
+ * Previously installed with `uv sync`.
198
+
199
+ ### Checking if the project's virtual environment is active
200
+ ---
201
+ All commands listed here assume the project's virtual env is active.
202
+
203
+ To ensure so, execute the following command, and ensure it points to: `{project_root}/.venv/bin/python`:
204
+ * On Mac OSX / Linux: `which python`
205
+ * On Windows / Mac OSX / Linux: `python -c "import sys; import os; print(os.path.abspath(sys.executable))"`
206
+
207
+ If not active, execute the following to activate:
208
+ * On Mac OSX / Linux: `source .venv/bin/activate`
209
+ * On Windows [In Powershell]: `.venv\Scripts\activate`
210
+
211
+ Alternatively, you can also run any command using the prefix `uv run` and `uv` will make sure that it uses the virtual env's Python executable.
212
+
213
+ ### Updating the project's dependencies
214
+ ---
215
+ #### Adding new dependencies
216
+ ---
217
+ In order to avoid potential version conflicts, we should use uv's dependency manager to add new libraries additional to the project's current dependenies.
218
+ Open a terminal in VSCode and execute the following commands:
219
+
220
+ * `uv add {dependency}` e.g. `uv add pandas`
221
+
222
+ This command will update the project's files `pyproject.toml` and `uv.lock` automatically, which are the ones ensuring all developers and environments have the exact same dependencies.
223
+
224
+ #### Updating your virtual env with dependencies recently added or removed from the project
225
+ ---
226
+ Open a terminal in VSCode and execute the following command:
227
+ * `uv sync`
228
+
229
+ ## License
230
+ MIT. See [LICENSE](LICENSE) for more information.
231
+
232
+ ## TODO
233
+ - Study the possibility to run the tests in docker isolated environment for safety
234
+ - Add the remaining guardrails: not allow to write files from test_*.py
235
+ - Replace crewai by langgraph
236
+ - Publish to PyPI
@@ -0,0 +1,212 @@
1
+ # 🛡️ Unit-Tests-Generator
2
+ *Autonomous, RAG-Driven Test Engineering for Python.*
3
+
4
+ **Unit-Tests-Generator** is an intelligent agentic tool that automates the entire `pytest` lifecycle. Unlike static template generators, it leverages an in-memory knowledge graph of your codebase and RAG to produce context-aware, executable, and validated test suites.
5
+
6
+ The system operates through a multi-stage pipeline:
7
+ 1. **Codebase Graphing**: Maps your repository into an in-memory graph to understand cross-file dependencies and type definitions.
8
+
9
+ 2. **Contextual RAG**: Retrieves relevant context for the LLM, ensuring the generated tests understand your project's unique patterns.
10
+
11
+ 3. **Inference & Guardrails**: Generates test cases via LLM API, filtered through strict structural and security guardrails.
12
+
13
+ 4. **The "Sandbox" Validation**: Automatically executes the generated tests.
14
+
15
+ 5. **Persistence**: Only tests that pass execution and meet coverage criteria are committed to your `/tests` directory.
16
+
17
+ ## Quick Start
18
+ ```bash
19
+ # Install the package
20
+ pip install unit-tests-generator
21
+
22
+ # Generate tests using source and output paths
23
+ utgen -s src/ -t tests/
24
+ ```
25
+
26
+ ### Setting up your LLM
27
+ Required environment variables:
28
+ ```bash
29
+ # .env file
30
+ LLM_OPENROUTER_MODEL = ""
31
+ LLM_OPENROUTER_API_KEY = ""
32
+ ```
33
+ - Powered by CrewAI and OpenRouter: https://docs.crewai.com/en/concepts/llms#open-router.
34
+ - OpenRouter models: https://openrouter.ai/models.
35
+
36
+ ## Table of Contents
37
+ 1. [Usage](#usage)
38
+ 2. [Examples](#examples)
39
+ 3. [Graph structure](#graph-structure)
40
+ 4. [Code Quality & Documentation](#code-quality--documentation)
41
+ - [Pre-commit Hooks](#pre-commit-hooks)
42
+ - [Unit Testing](#unit-testing)
43
+ 5. [Virtual Environment](#virtual-environment)
44
+ - [Create a new virtualenv with the project's dependencies](#create-a-new-virtualenv-with-the-projects-dependencies)
45
+ - [Checking if the project's virtual environment is active](#checking-if-the-projects-virtual-environment-is-active)
46
+ - [Updating the project's dependencies](#updating-the-projects-dependencies)
47
+ 6. [LICENSE](#license)
48
+ 7. [TODO](#todo)
49
+
50
+ ## Usage
51
+ `utgen` is designed to be simple and terminal-first. Once installed, you can generate tests by pointing the tool to your source code and specifying an output directory.
52
+
53
+ ### CLI Arguments
54
+ | Flag | Shortcut | Description | Required | Default |
55
+ | :--- | :--- | :--- | :--- | :--- |
56
+ | `--src_path` | `-s` | Path to the directory containing your source code. | **Yes** | — |
57
+ | `--test_path` | `-t` | Path to the directory where generated tests will be saved. | **Yes** | — |
58
+ | `--graph_path` | `-g` | Path to the RAG-Graph data (enables advanced context). | No | `None` |
59
+ | `--help` | — | Show the help message and exit. | No | — |
60
+
61
+ ### Basic Command
62
+ Run a standard generation without a RAG-Graph:
63
+ ```bash
64
+ utgen -s src/ -t tests/
65
+ ```
66
+ ### Full Command
67
+ Enable RAG-Graph context for more accurate, context-aware test generation:
68
+ ```bash
69
+ utgen --src_path src/ --test_path tests/ --graph_path data/
70
+ ```
71
+
72
+ ## Examples
73
+ Upload `repo.graphml` to https://lite.gephi.org/.
74
+
75
+ - This repository:
76
+ - Code coverage:
77
+ - Example for repository https://github.com/ArnauFabregat/probability_estimation
78
+ ![Diagram](https://raw.githubusercontent.com/ArnauFabregat/unit-tests-generator/main/docs/probability-estimation-repo-graph.png)
79
+ - Code coverage:
80
+ - Example for repository
81
+ - Code coverage
82
+
83
+ ## Graph structure
84
+ To extract relevant context, the graph needs:
85
+
86
+ ### 🟢 Nodes for:
87
+ - Files
88
+ - Classes
89
+ - Functions
90
+ - Methods
91
+ - Nested functions
92
+
93
+ Fields:
94
+ - **id**: canonical ID (e.g., file::...::class::Calibrator / ...::method::Calibrator.fit)
95
+ - **type**: "file" | "class" | "method" | "function" | "nested_function"
96
+ - **name**: symbol name ("Calibrator", "fit", etc.)
97
+ - **file**: file path
98
+ - **signature**: normalized function/method signature "def fit(self, probs, y) -> None"
99
+ - **docstring**: (trimmed) docstring
100
+ - **source**: actual source code of the node
101
+
102
+ ### ➡️ Edges for:
103
+ - **defines** (file → symbol, function → nested function)
104
+ - **has_method** (class → method)
105
+ - **calls** (function/method → called symbol)
106
+ - **references** (function/method → referenced symbol)
107
+
108
+ Fields:
109
+ - **src**: source node id
110
+ - **dst**: destination node id
111
+ - **rel**: "defines" | "has_method" | "references" | "calls"
112
+
113
+ ### 🧠 Prompt template
114
+ TBD
115
+
116
+ ## Code Quality & Documentation
117
+ ### Pre-commit Hooks
118
+ ---
119
+ This project uses [pre-commit](https://pre-commit.com/) hooks to enforce code quality standards automatically before each commit. The following hooks are configured:
120
+
121
+ - **Formatting & File Integrity**: `trailing-whitespace`, `end-of-file-fixer`, `check-yaml`, `check-toml`
122
+ - **Code Linting & Formatting**: `ruff-check`, `ruff-format`
123
+ - **Type Checking**: `mypy`
124
+
125
+ Pre-commit hooks are automatically installed during virtual environment setup (`uv sync`).
126
+ - To run them for modified (staged) files:
127
+ ```bash
128
+ uv run pre-commit run
129
+ ```
130
+ - To run them for the entire repository:
131
+ ```bash
132
+ uv run pre-commit run --all-files
133
+ ```
134
+
135
+ ### Unit Testing
136
+ ---
137
+ Unit tests ensure code reliability and prevent regressions. Tests are written using pytest and should cover critical functionality.
138
+
139
+ To run all tests:
140
+ ```bash
141
+ uv run pytest
142
+ ```
143
+
144
+ To run tests with coverage:
145
+ ```bash
146
+ uv run pytest --cov
147
+ ```
148
+
149
+ ## Virtual Environment
150
+ ### Create a new virtualenv with the project's dependencies
151
+ ---
152
+ Install the project's virtual environment and set it as your project's Python interpreter.
153
+ This will also install the project's current dependencies.
154
+
155
+ Open a terminal in VSCode, then execute the following commands:
156
+
157
+ 1. Install [UV: Python package and project manager](https://docs.astral.sh/uv/getting-started/installation/):
158
+ * On Mac OSX / Linux: `curl -LsSf https://astral.sh/uv/install.sh | sh`
159
+ * On Windows [In Powershell]: `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`
160
+
161
+ 2. [optional] To create virtual environment from scratch with `uv`: [Working on projects](https://docs.astral.sh/uv/guides/projects/)
162
+
163
+ 3. If the environment already exists, install the virtual environment. It will be installed in the project's root, under a new directory named `.venv`:
164
+ * `uv sync`
165
+ * `uv sync --group dev --group dashboard --group test` to install all the dependency groups
166
+
167
+ 4. Activate the new virtual environment:
168
+ * On Mac OSX / Linux: `source .venv/bin/activate`
169
+ * On Windows [In Powershell]: `.venv\Scripts\activate`
170
+
171
+ 5. Configure / install pre-commit hooks:
172
+ * [Pre-commit](https://pre-commit.com/) is a tool that helps us keep the repository complying with certain formatting and style standards, using the `hooks` configured in the `.pre-commit-config.yaml` file.
173
+ * Previously installed with `uv sync`.
174
+
175
+ ### Checking if the project's virtual environment is active
176
+ ---
177
+ All commands listed here assume the project's virtual env is active.
178
+
179
+ To ensure so, execute the following command, and ensure it points to: `{project_root}/.venv/bin/python`:
180
+ * On Mac OSX / Linux: `which python`
181
+ * On Windows / Mac OSX / Linux: `python -c "import sys; import os; print(os.path.abspath(sys.executable))"`
182
+
183
+ If not active, execute the following to activate:
184
+ * On Mac OSX / Linux: `source .venv/bin/activate`
185
+ * On Windows [In Powershell]: `.venv\Scripts\activate`
186
+
187
+ Alternatively, you can also run any command using the prefix `uv run` and `uv` will make sure that it uses the virtual env's Python executable.
188
+
189
+ ### Updating the project's dependencies
190
+ ---
191
+ #### Adding new dependencies
192
+ ---
193
+ In order to avoid potential version conflicts, we should use uv's dependency manager to add new libraries additional to the project's current dependenies.
194
+ Open a terminal in VSCode and execute the following commands:
195
+
196
+ * `uv add {dependency}` e.g. `uv add pandas`
197
+
198
+ This command will update the project's files `pyproject.toml` and `uv.lock` automatically, which are the ones ensuring all developers and environments have the exact same dependencies.
199
+
200
+ #### Updating your virtual env with dependencies recently added or removed from the project
201
+ ---
202
+ Open a terminal in VSCode and execute the following command:
203
+ * `uv sync`
204
+
205
+ ## License
206
+ MIT. See [LICENSE](LICENSE) for more information.
207
+
208
+ ## TODO
209
+ - Study the possibility to run the tests in docker isolated environment for safety
210
+ - Add the remaining guardrails: not allow to write files from test_*.py
211
+ - Replace crewai by langgraph
212
+ - Publish to PyPI
@@ -0,0 +1,85 @@
1
+ [project]
2
+ name = "unit-tests-generator"
3
+ version = "0.1.0"
4
+ description = "Open source project to build a unit tests generator in Python."
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = {text = "MIT"}
8
+ authors = [
9
+ {name = "Arnau Fabregat"}
10
+ ]
11
+ dependencies = [
12
+ "crewai[google-genai]>=1.10.1",
13
+ "litellm>=1.82.1",
14
+ "loguru>=0.7.3",
15
+ "networkx>=3.6.1",
16
+ "pytest>=9.0.2",
17
+ "pytest-cov>=7.0.0",
18
+ "typer>=0.23.1",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Developers",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Operating System :: OS Independent",
26
+ "License :: OSI Approved :: MIT License",
27
+ ]
28
+
29
+ [dependency-groups]
30
+ # Tooling — not required to run your app
31
+ dev = [
32
+ "pre-commit>=3.7",
33
+ "ruff>=0.5",
34
+ "mypy>=1.8",
35
+ "ipykernel>=7.2.0",
36
+ ]
37
+
38
+ [build-system]
39
+ requires = ["setuptools>=64"]
40
+ build-backend = "setuptools.build_meta"
41
+
42
+ [tool.setuptools]
43
+ include-package-data = true
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+ include = ["utgen*"]
48
+
49
+ [tool.pytest.ini_options]
50
+ testpaths = ["tests"]
51
+ pythonpath = ["src"]
52
+
53
+ [tool.coverage.run]
54
+ omit = [
55
+ "tests/*",
56
+ "**/__init__.py",
57
+ ]
58
+
59
+ # Ruff configuration (https://docs.astral.sh/ruff/configuration/)
60
+ [tool.ruff]
61
+ line-length = 120
62
+ target-version = "py313"
63
+
64
+ [tool.ruff.lint]
65
+ # A solid default selection for apps:
66
+ # E/F: pycodestyle+pyflakes, B: bugbear, I: import sorting, UP: pyupgrade
67
+ select = ["E", "F", "B", "I", "UP"]
68
+ fixable = ["ALL"]
69
+
70
+ [tool.ruff.format]
71
+ # Ruff formatter is Black-like by default; you can keep defaults or tweak.
72
+ quote-style = "double"
73
+
74
+ # Mypy configuration
75
+ [tool.mypy]
76
+ python_version = "3.13"
77
+ warn_return_any = true
78
+ warn_unused_configs = true
79
+ disallow_untyped_defs = false
80
+ no_implicit_optional = true
81
+ ignore_missing_imports = true # This is pragmatic for apps early on; tighten later
82
+ files = ["src", "tests"] # Run mypy on these folders (when invoked without explicit paths)
83
+
84
+ [project.scripts]
85
+ utgen = "utgen.main:app"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+