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.3.tar.gz (21.2 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.3-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odoo_addons_parser-0.3.tar.gz
  • Upload date:
  • Size: 21.2 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.3.tar.gz
Algorithm Hash digest
SHA256 ab9db376a9b6a0741a522d8575f893847a072e108f78dfd115b31f0e69fe30f4
MD5 65bca4d2ab13e2b3505922f8bf9bfdf7
BLAKE2b-256 d66b6af65e1d95762132d9340466583c927b2bd22b4c47cdb2102a28fb2257dd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for odoo_addons_parser-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bef1528f4961b068b67631f8e4b5d33d75fa08e85afde45405b93aef4b29e4d5
MD5 ab08051569c78faccc06ec22080d5917
BLAKE2b-256 c0aaa40863fb3603e920ee08b10d5186c332165c581af5554b049632313528cc

See more details on using hashes here.

Provenance

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