odoo-addons-parser 0.5__tar.gz → 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.
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/PKG-INFO +86 -88
- odoo_addons_parser-0.7/README.md +112 -0
- odoo_addons_parser-0.7/odoo_addons_parser/code.py +495 -0
- odoo_addons_parser-0.7/odoo_addons_parser/data_csv.py +92 -0
- odoo_addons_parser-0.7/odoo_addons_parser/data_xml.py +417 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/module.py +78 -16
- odoo_addons_parser-0.7/odoo_addons_parser/tests/common.py +408 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/repo/module_test/__manifest__.py +9 -2
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/data/res_partner.xml +18 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/demo/res_partner.xml +10 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/repo/module_test/models/res_partner.py +28 -1
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/reports/reports.xml +37 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/reports/templates.xml +14 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/security/ir.model.access.csv +2 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/tests/test.xml +10 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/views/assets.xml +12 -0
- odoo_addons_parser-0.7/odoo_addons_parser/tests/repo/module_test/views/res_partner.xml +52 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/test_module.py +35 -2
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/test_odoo.py +6 -4
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/test_repository.py +6 -3
- odoo_addons_parser-0.7/odoo_addons_parser/tests/test_treesitter_utils.py +635 -0
- odoo_addons_parser-0.7/odoo_addons_parser/treesitter_utils.py +403 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser.egg-info/PKG-INFO +86 -88
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser.egg-info/SOURCES.txt +11 -0
- odoo_addons_parser-0.7/odoo_addons_parser.egg-info/requires.txt +7 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/pyproject.toml +12 -0
- odoo_addons_parser-0.5/README.md +0 -126
- odoo_addons_parser-0.5/odoo_addons_parser/code.py +0 -375
- odoo_addons_parser-0.5/odoo_addons_parser/tests/common.py +0 -107
- odoo_addons_parser-0.5/odoo_addons_parser/tests/repo/module_test/views/res_partner.xml +0 -18
- odoo_addons_parser-0.5/odoo_addons_parser.egg-info/requires.txt +0 -5
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/.github/workflows/pre-commit.yml +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/.github/workflows/publish.yml +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/.github/workflows/test.yml +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/.gitignore +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/.pre-commit-config.yaml +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/LICENSE +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/MANIFEST.in +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/__init__.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/odoo.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/repository.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/__init__.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/repo/module_test/__init__.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/repo/module_test/models/__init__.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser/tests/repo/module_test/models/res_users.py +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser.egg-info/dependency_links.txt +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/odoo_addons_parser.egg-info/top_level.txt +0 -0
- {odoo_addons_parser-0.5 → odoo_addons_parser-0.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: odoo-addons-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Summary: Collect data from Odoo module folders.
|
|
5
5
|
Author: Sébastien Alix
|
|
6
6
|
License: GNU LESSER GENERAL PUBLIC LICENSE
|
|
@@ -173,36 +173,64 @@ Project-URL: homepage, https://github.com/sebalix/odoo-addons-parser
|
|
|
173
173
|
Project-URL: documentation, https://github.com/sebalix/odoo-addons-parser
|
|
174
174
|
Project-URL: repository, https://github.com/sebalix/odoo-addons-parser
|
|
175
175
|
Keywords: odoo,oca,analyze,parser,collect,modules,addons
|
|
176
|
+
Classifier: Intended Audience :: Developers
|
|
176
177
|
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
178
|
+
Classifier: Operating System :: OS Independent
|
|
179
|
+
Classifier: Programming Language :: Python
|
|
177
180
|
Classifier: Programming Language :: Python :: 3
|
|
181
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
182
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
183
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
184
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
185
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
186
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
187
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
178
188
|
Classifier: Framework :: Odoo
|
|
179
189
|
Requires-Python: >=3.9
|
|
180
190
|
Description-Content-Type: text/markdown
|
|
181
191
|
License-File: LICENSE
|
|
182
192
|
Requires-Dist: pygount<1.7.0
|
|
193
|
+
Requires-Dist: tree-sitter>=0.20.0
|
|
194
|
+
Requires-Dist: tree-sitter-python>=0.20.0
|
|
183
195
|
Provides-Extra: test
|
|
184
196
|
Requires-Dist: pytest; extra == "test"
|
|
185
197
|
Requires-Dist: coverage; extra == "test"
|
|
186
198
|
Dynamic: license-file
|
|
187
199
|
|
|
200
|
+
# odoo-addons-parser
|
|
201
|
+
|
|
202
|
+
[](https://pypi.org/project/odoo-addons-parser)
|
|
203
|
+
[](https://pypi.org/project/odoo-addons-parser)
|
|
188
204
|
[](https://github.com/sebalix/odoo-addons-parser/actions/workflows/pre-commit.yml?query=branch%3Amain)
|
|
189
205
|
[](https://github.com/sebalix/odoo-addons-parser/actions/workflows/test.yml?query=branch%3Amain)
|
|
190
|
-
[](https://pypi.org/project/odoo-addons-parser/)
|
|
191
206
|
|
|
192
|
-
|
|
207
|
+
Python package to collect and analyze data from Odoo module folders without requiring an Odoo runtime. It performs static file analysis to extract useful information from Odoo modules.
|
|
208
|
+
|
|
209
|
+
## Features
|
|
210
|
+
|
|
211
|
+
- **Static Analysis**: Doesn't rely on any Odoo runtime; performs static files analysis
|
|
212
|
+
- **Code Statistics**: Count lines of code (Python, XML, JavaScript, and CSS)
|
|
213
|
+
- **Manifest Parsing**: Extract useful data from manifest files (authors, dependencies, etc.)
|
|
214
|
+
- **Model Extraction**: Extract Odoo models information (with fields and methods)
|
|
215
|
+
- **Data Extraction**: Extract data from XML and CSV files
|
|
216
|
+
- **Flexible Scanning**: Scan individual modules, repositories, or entire Odoo source code
|
|
193
217
|
|
|
194
|
-
|
|
218
|
+
## Installation
|
|
195
219
|
|
|
196
|
-
|
|
220
|
+
```bash
|
|
221
|
+
uv pip install odoo-addons-parser
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Or with pip:
|
|
225
|
+
```bash
|
|
226
|
+
pip install odoo-addons-parser
|
|
227
|
+
```
|
|
197
228
|
|
|
198
|
-
|
|
199
|
-
- count the number of lines of code (Python, XML, JavaScript and CSS by default)
|
|
200
|
-
- read the manifest file (to get useful data like authors or dependencies)
|
|
201
|
-
- extract Odoo models info (fields, methods...)
|
|
229
|
+
## Usage
|
|
202
230
|
|
|
203
|
-
|
|
231
|
+
### ModuleParser
|
|
204
232
|
|
|
205
|
-
|
|
233
|
+
Parse a single Odoo module:
|
|
206
234
|
|
|
207
235
|
```python
|
|
208
236
|
from odoo_addons_parser import ModuleParser
|
|
@@ -211,103 +239,73 @@ from pprint import pprint as pp
|
|
|
211
239
|
mod = ModuleParser("/path/to/OCA/server-tools/server_environment")
|
|
212
240
|
pp(mod.to_dict())
|
|
213
241
|
```
|
|
214
|
-
|
|
242
|
+
|
|
243
|
+
Example output:
|
|
244
|
+
|
|
215
245
|
```python
|
|
216
|
-
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
246
|
+
{
|
|
247
|
+
'code': {'CSS': 0, 'JavaScript': 0, 'Python': 541, 'XML': 21},
|
|
248
|
+
'manifest': {
|
|
249
|
+
'author': 'Camptocamp,Odoo Community Association (OCA)',
|
|
250
|
+
'category': 'Tools',
|
|
251
|
+
'data': ['security/ir.model.access.csv', 'security/res_groups.xml', 'serv_config.xml'],
|
|
252
|
+
'depends': ['base', 'base_sparse_field'],
|
|
253
|
+
'installable': True,
|
|
254
|
+
'license': 'GPL-3 or any later version',
|
|
255
|
+
'name': 'server configuration environment files',
|
|
256
|
+
'summary': 'move some configurations out of the database',
|
|
257
|
+
'version': '14.0.1.0.0',
|
|
258
|
+
'website': 'https://github.com/OCA/server-env'
|
|
259
|
+
},
|
|
260
|
+
'models': ...,
|
|
261
|
+
'name': 'server_environment'
|
|
262
|
+
}
|
|
231
263
|
```
|
|
232
264
|
|
|
233
|
-
|
|
265
|
+
### RepositoryParser
|
|
234
266
|
|
|
235
|
-
|
|
236
|
-
(also named *addons path*):
|
|
267
|
+
Parse a whole repository of addons:
|
|
237
268
|
|
|
238
269
|
```python
|
|
239
270
|
from odoo_addons_parser import RepositoryParser
|
|
271
|
+
|
|
240
272
|
repo = RepositoryParser("/path/to/OCA/server-tools")
|
|
241
273
|
pp(repo.to_dict())
|
|
242
274
|
```
|
|
243
|
-
=>
|
|
244
|
-
```python
|
|
245
|
-
{'data_encryption': {'code': {'CSS': 0,
|
|
246
|
-
'JavaScript': 0,
|
|
247
|
-
'Python': 187,
|
|
248
|
-
'XML': 0},
|
|
249
|
-
'manifest': {'application': False,
|
|
250
|
-
'author': 'Akretion, Odoo Community '
|
|
251
|
-
'Association (OCA)',
|
|
252
|
-
'category': 'Tools',
|
|
253
|
-
'data': ['security/ir.model.access.csv'],
|
|
254
|
-
'depends': ['base'],
|
|
255
|
-
'development_status': 'Alpha',
|
|
256
|
-
'external_dependencies': {'python': ['cryptography']},
|
|
257
|
-
'installable': True,
|
|
258
|
-
'license': 'AGPL-3',
|
|
259
|
-
'name': 'Encryption data',
|
|
260
|
-
'summary': 'Store accounts and credentials '
|
|
261
|
-
'encrypted by environment',
|
|
262
|
-
'version': '14.0.1.0.0',
|
|
263
|
-
'website': 'https://github.com/OCA/server-env'},
|
|
264
|
-
'models': ...,
|
|
265
|
-
'name': 'data_encryption'},
|
|
266
|
-
'mail_environment': {'code': {'CSS': 0,
|
|
267
|
-
'JavaScript': 0,
|
|
268
|
-
'Python': 43,
|
|
269
|
-
'XML': 0},
|
|
270
|
-
'manifest': {'author': 'Camptocamp, Odoo Community '
|
|
271
|
-
'Association (OCA)',
|
|
272
|
-
'category': 'Tools',
|
|
273
|
-
'depends': ['fetchmail',
|
|
274
|
-
'server_environment'],
|
|
275
|
-
'license': 'AGPL-3',
|
|
276
|
-
'name': 'Mail configuration with '
|
|
277
|
-
'server_environment',
|
|
278
|
-
'summary': 'Configure mail servers with '
|
|
279
|
-
'server_environment_files',
|
|
280
|
-
'version': '14.0.1.0.0',
|
|
281
|
-
'website': 'https://github.com/OCA/server-env'},
|
|
282
|
-
'models': ...,
|
|
283
|
-
'name': 'mail_environment'},
|
|
284
|
-
[...]
|
|
285
|
-
```
|
|
286
275
|
|
|
287
|
-
|
|
276
|
+
### OdooParser
|
|
288
277
|
|
|
289
|
-
|
|
290
|
-
(the one we clone from https://github.com/odoo/odoo). It'll parse the content
|
|
291
|
-
of `./odoo/addons`, `./addons` and Odoo base classes such as `BaseModel`,
|
|
292
|
-
`Model` and `TransientModel`:
|
|
278
|
+
Parse the Odoo source code repository:
|
|
293
279
|
|
|
294
280
|
```python
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
["
|
|
300
|
-
|
|
301
|
-
|
|
281
|
+
from odoo_addons_parser import OdooParser
|
|
282
|
+
|
|
283
|
+
odoo = OdooParser("/path/to/odoo/odoo")
|
|
284
|
+
data = odoo.to_dict()
|
|
285
|
+
list(data["__odoo__"]["models"])
|
|
286
|
+
# ["BaseModel", "Model", "TransientModel"]
|
|
287
|
+
"res.partner" in data["base"]["models"]
|
|
288
|
+
# True
|
|
302
289
|
```
|
|
303
290
|
|
|
304
291
|
## Parameters
|
|
305
292
|
|
|
306
|
-
|
|
307
|
-
`scan_models` parameters, available on all classes:
|
|
293
|
+
You can disable specific features using parameters:
|
|
308
294
|
|
|
309
295
|
```python
|
|
296
|
+
# Disable code statistics
|
|
310
297
|
repo = RepositoryParser("path/to/addons_path", code_stats=False)
|
|
298
|
+
|
|
299
|
+
# Disable model scanning
|
|
311
300
|
mod = ModuleParser("path/to/addons_path/module", scan_models=False)
|
|
312
|
-
|
|
301
|
+
|
|
302
|
+
# Disable data scanning
|
|
303
|
+
mod = ModuleParser("path/to/addons_path/module", scan_data=False)
|
|
304
|
+
|
|
305
|
+
# Disable all
|
|
306
|
+
odoo = OdooParser("/path/to/odoo/odoo", code_stats=False, scan_models=False, scan_data=False)
|
|
313
307
|
```
|
|
308
|
+
|
|
309
|
+
## License
|
|
310
|
+
|
|
311
|
+
This project is licensed under the LGPL-3.0 License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# odoo-addons-parser
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/odoo-addons-parser)
|
|
4
|
+
[](https://pypi.org/project/odoo-addons-parser)
|
|
5
|
+
[](https://github.com/sebalix/odoo-addons-parser/actions/workflows/pre-commit.yml?query=branch%3Amain)
|
|
6
|
+
[](https://github.com/sebalix/odoo-addons-parser/actions/workflows/test.yml?query=branch%3Amain)
|
|
7
|
+
|
|
8
|
+
Python package to collect and analyze data from Odoo module folders without requiring an Odoo runtime. It performs static file analysis to extract useful information from Odoo modules.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Static Analysis**: Doesn't rely on any Odoo runtime; performs static files analysis
|
|
13
|
+
- **Code Statistics**: Count lines of code (Python, XML, JavaScript, and CSS)
|
|
14
|
+
- **Manifest Parsing**: Extract useful data from manifest files (authors, dependencies, etc.)
|
|
15
|
+
- **Model Extraction**: Extract Odoo models information (with fields and methods)
|
|
16
|
+
- **Data Extraction**: Extract data from XML and CSV files
|
|
17
|
+
- **Flexible Scanning**: Scan individual modules, repositories, or entire Odoo source code
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv pip install odoo-addons-parser
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or with pip:
|
|
26
|
+
```bash
|
|
27
|
+
pip install odoo-addons-parser
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### ModuleParser
|
|
33
|
+
|
|
34
|
+
Parse a single Odoo module:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from odoo_addons_parser import ModuleParser
|
|
38
|
+
from pprint import pprint as pp
|
|
39
|
+
|
|
40
|
+
mod = ModuleParser("/path/to/OCA/server-tools/server_environment")
|
|
41
|
+
pp(mod.to_dict())
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Example output:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
{
|
|
48
|
+
'code': {'CSS': 0, 'JavaScript': 0, 'Python': 541, 'XML': 21},
|
|
49
|
+
'manifest': {
|
|
50
|
+
'author': 'Camptocamp,Odoo Community Association (OCA)',
|
|
51
|
+
'category': 'Tools',
|
|
52
|
+
'data': ['security/ir.model.access.csv', 'security/res_groups.xml', 'serv_config.xml'],
|
|
53
|
+
'depends': ['base', 'base_sparse_field'],
|
|
54
|
+
'installable': True,
|
|
55
|
+
'license': 'GPL-3 or any later version',
|
|
56
|
+
'name': 'server configuration environment files',
|
|
57
|
+
'summary': 'move some configurations out of the database',
|
|
58
|
+
'version': '14.0.1.0.0',
|
|
59
|
+
'website': 'https://github.com/OCA/server-env'
|
|
60
|
+
},
|
|
61
|
+
'models': ...,
|
|
62
|
+
'name': 'server_environment'
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### RepositoryParser
|
|
67
|
+
|
|
68
|
+
Parse a whole repository of addons:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from odoo_addons_parser import RepositoryParser
|
|
72
|
+
|
|
73
|
+
repo = RepositoryParser("/path/to/OCA/server-tools")
|
|
74
|
+
pp(repo.to_dict())
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### OdooParser
|
|
78
|
+
|
|
79
|
+
Parse the Odoo source code repository:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from odoo_addons_parser import OdooParser
|
|
83
|
+
|
|
84
|
+
odoo = OdooParser("/path/to/odoo/odoo")
|
|
85
|
+
data = odoo.to_dict()
|
|
86
|
+
list(data["__odoo__"]["models"])
|
|
87
|
+
# ["BaseModel", "Model", "TransientModel"]
|
|
88
|
+
"res.partner" in data["base"]["models"]
|
|
89
|
+
# True
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Parameters
|
|
93
|
+
|
|
94
|
+
You can disable specific features using parameters:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Disable code statistics
|
|
98
|
+
repo = RepositoryParser("path/to/addons_path", code_stats=False)
|
|
99
|
+
|
|
100
|
+
# Disable model scanning
|
|
101
|
+
mod = ModuleParser("path/to/addons_path/module", scan_models=False)
|
|
102
|
+
|
|
103
|
+
# Disable data scanning
|
|
104
|
+
mod = ModuleParser("path/to/addons_path/module", scan_data=False)
|
|
105
|
+
|
|
106
|
+
# Disable all
|
|
107
|
+
odoo = OdooParser("/path/to/odoo/odoo", code_stats=False, scan_models=False, scan_data=False)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
This project is licensed under the LGPL-3.0 License - see the [LICENSE](LICENSE) file for details.
|