Skip to main content

Collect data from Odoo module folders.

Project description

Pre-commit Status Tests Status Last version

odoo-addons-parser

Python package to collect data from Odoo module folders.

Features:

  • scan an Odoo repository, a folder of modules (repository) or a module only
  • count the number of lines of code (Python, XML, JavaScript and CSS by default)
  • read the manifest file (to get useful data like authors or dependencies)
  • extract Odoo models info (fields, methods...)

ModuleParser class

ModuleParser class aims to scan a module folder only:

from odoo_addons_parser import ModuleParser
from pprint import pprint as pp

mod = ModuleParser("/path/to/OCA/server-tools/server_environment")
pp(mod.to_dict())

=>

{'code': {'CSS': 0, 'JavaScript': 0, 'Python': 541, 'XML': 21},
 'manifest': {'author': 'Camptocamp,Odoo Community Association (OCA)',
              'category': 'Tools',
              'data': ['security/ir.model.access.csv',
                       'security/res_groups.xml',
                       'serv_config.xml'],
              'depends': ['base', 'base_sparse_field'],
              'installable': True,
              'license': 'GPL-3 or any later version',
              'name': 'server configuration environment files',
              'summary': 'move some configurations out of the database',
              'version': '14.0.1.0.0',
              'website': 'https://github.com/OCA/server-env'}},
 'models': ...
 'name': 'server_environment',

RepositoryParser class

RepositoryParser class aims to scan a whole repository of addons (also named addons path):

from odoo_addons_parser import RepositoryParser
repo = RepositoryParser("/path/to/OCA/server-tools")
pp(repo.to_dict())

=>

{'data_encryption': {'code': {'CSS': 0,
                              'JavaScript': 0,
                              'Python': 187,
                              'XML': 0},
                     'manifest': {'application': False,
                                  'author': 'Akretion, Odoo Community '
                                            'Association (OCA)',
                                  'category': 'Tools',
                                  'data': ['security/ir.model.access.csv'],
                                  'depends': ['base'],
                                  'development_status': 'Alpha',
                                  'external_dependencies': {'python': ['cryptography']},
                                  'installable': True,
                                  'license': 'AGPL-3',
                                  'name': 'Encryption data',
                                  'summary': 'Store accounts and credentials '
                                             'encrypted by environment',
                                  'version': '14.0.1.0.0',
                                  'website': 'https://github.com/OCA/server-env'},
                     'models': ...,
                     'name': 'data_encryption'},
 'mail_environment': {'code': {'CSS': 0,
                               'JavaScript': 0,
                               'Python': 43,
                               'XML': 0},
                      'manifest': {'author': 'Camptocamp, Odoo Community '
                                             'Association (OCA)',
                                   'category': 'Tools',
                                   'depends': ['fetchmail',
                                               'server_environment'],
                                   'license': 'AGPL-3',
                                   'name': 'Mail configuration with '
                                           'server_environment',
                                   'summary': 'Configure mail servers with '
                                              'server_environment_files',
                                   'version': '14.0.1.0.0',
                                   'website': 'https://github.com/OCA/server-env'},
                     'models': ...,
                     'name': 'mail_environment'},
[...]

OdooParser class

OdooParser special class aims to scan the Odoo source code repository (the one we clone from https://github.com/odoo/odoo). It'll parse the content of ./odoo/addons, ./addons and Odoo base classes such as BaseModel, Model and TransientModel:

>>> from odoo_addons_parser import OdooParser
>>> odoo = OdooParser("/path/to/odoo/odoo")
>>> data = odoo.to_dict()
>>> list(data["__odoo__"]["models"])
["BaseModel", "Model", "TransientModel"]
>>> "res.partner" in data["base"]["models"]
True

Parameters

Code stats or models scanning can be disabled thanks to code_stats and scan_models parameters, available on all classes:

repo = RepositoryParser("path/to/addons_path", code_stats=False)
mod = ModuleParser("path/to/addons_path/module", scan_models=False)
odoo = OdooParser("path/to/odoo/odoo", code_stats=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_addons_parser-0.4.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odoo_addons_parser-0.4-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file odoo_addons_parser-0.4.tar.gz.

File metadata

  • Download URL: odoo_addons_parser-0.4.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odoo_addons_parser-0.4.tar.gz
Algorithm Hash digest
SHA256 9bd4ebff2c16da1fdb34917fa322265ff5e156a56c8b22ffc4e88cb578e86c66
MD5 9427e1709738394ff316e2167def884e
BLAKE2b-256 c721011312b2eef195b227e559fdb2a217081ffd3829354989ae65779aaac8ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_parser-0.4.tar.gz:

Publisher: publish.yml on sebalix/odoo-addons-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file odoo_addons_parser-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addons_parser-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 31bb9ab169ff57c4f8ed8c8580122be6efdc00d3c27016681582c515e8d901e9
MD5 488aaefe01a1f7f06561efe2d6dd575b
BLAKE2b-256 4ab65dbf3d11346be208d6d1730e06d5f4995561c9885b1c0d3f7646df9ef294

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_parser-0.4-py3-none-any.whl:

Publisher: publish.yml on sebalix/odoo-addons-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page