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.5.tar.gz (21.9 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.5-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odoo_addons_parser-0.5.tar.gz
  • Upload date:
  • Size: 21.9 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.5.tar.gz
Algorithm Hash digest
SHA256 3df7eea7b0cdd14dbe6a731e7d780730e26d0e2c797c9d70bfbdeea420282af1
MD5 fbeb326e552b084a80b8e83be711ea47
BLAKE2b-256 10710d78e4eb201cccb0c7ca4ea83b80e235d95e036baf2bbbf7c1ada3c3f317

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_parser-0.5.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.5-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addons_parser-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 60b9c623748693b7bf80dafaba9fc1ed3895ecd103a8fc324bab121907aabea7
MD5 173a80d42a10602bef648c61f5038519
BLAKE2b-256 2169c2009ed70ebe19d2a59acd6a6ba7c08215b28c5060d0227ef67962c513a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoo_addons_parser-0.5-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