tgrep-deployv
Install tgrep (trigram-indexed grep, up to 52x faster than ripgrep on large trees) and build its index for Odoo instances inside containers following the Vauxoo layout:
/home/odoo/instance/odoo
/home/odoo/instance/extra_addons/*
This tool only runs inside such a container (or SSH session) as user odoo; it refuses to start
when /home/odoo/instance/odoo/odoo-bin is missing. It always indexes the real instance path,
never an rsync/copy, so the paths tgrep prints are the files people then open and edit.
Install
pip install tgrep-deployv
Usage
tgrep-deployv
That single command:
-
Installs
tgrepunder~/.local/binwhen it is not onPATH: downloads the release asset built for this platform from GitHub (newest stable release,v1.0.4as the floor), verifies it against the publishedchecksums.txtand extracts the binary. Nocurl | bash, no cargo, no root.TGREP_VERSIONpins a release;TGREP_DOWNLOAD_URLpoints at a mirror. -
Picks the module list, in this order:
--modules-filegiven: the modules listed there (see below).- Database reachable through
odoo-bin shell: only installed modules fromir.module.module(notest_*addon modules, keeping backend unit tests inside real modules), listed bylist_installed_modules.pywhich is fed to the shell. - Neither: every addon module found on disk.
-
Renders
/home/odoo/instance/.ignore(Odoo coreodoo/odoocomplete + selected modules, droppingi18n,static/lib, minified assets, caches and.git). tgrep reads.ignorefiles with gitignore syntax both when indexing and when searching, so a plaintgrep PATTERN /home/odoo/instancesees exactly the same scope with no extra flag. -
Runs
tgrep index /home/odoo/instance, which writes the trigram index to/home/odoo/instance/.tgrepwith bounded memory (external merge sort), and printstgrep status. -
Validates the scope: no
test_*addon modules in it, no missing and no extra module roots compared to the expected module list, and every file in scope carrying one of the configured extensions (SOURCE_GLOBS:.py .xml .js .scss .css .csv .sql .rst .md .html .json .yml .yaml .txt .cfg .toml .sh); anything else means.ignoredid not apply. Counts per extension are logged, unexpected ones marked(!):extensions_configured=.cfg,.css,.csv,.html,.js,.json,.md,.py,.rst,.scss,.sh,.sql,.toml,.txt,.xml,.yaml,.yml extensions_indexed=6 files=12057 extension .py files=4949 extension .xml files=3276 extension .po files=39 (!) unexpected_extensions=1 files=39 (not in SOURCE_GLOBS: .po)
Both checks read
tgrep --files, the list of files tgrep would search under the root.
Translations are the one text format deliberately left out: every module ships one .po per
language, so they multiply the same strings by ~80 without adding anything to grep for from here.
Then search as usual, with the ripgrep flags you already know:
tgrep "def _compute_amount" /home/odoo/instance
tgrep -l "inherit_id=\"sale.view_order_form\"" /home/odoo/instance
tgrep-deployv --serve # keep the index hot and watched; searches answer in milliseconds
Options
--repo-path PATH instance root to index (default: /home/odoo/instance)
--mode MODE auto (default), installed, or all
--modules-file PATH ir.module.module export listing the modules to index
--force rebuild the index from scratch (tgrep index --force)
--serve start "tgrep serve" detached afterwards (log in .tgrep/serve.log)
--skip-install do not install tgrep when missing
--skip-validate do not validate the index scope afterwards
Indexing the modules installed in production
A local docker container only installs the modules of the main app, while production usually has
more modules installed by hand. Export ir.module.module from production and pass the file, so
the index covers the same code production runs:
tgrep-deployv --modules-file modules_installed.csv
The file is an ir.module.module export, either a csv or one module name per line
(# comments and blank lines are ignored):
name,state
sale,installed
purchase,uninstalled
- With a
statecolumn (state/status), only theinstalledrows are used. - Without one, the file is assumed to be already filtered to the installed modules.
- Column headers may be the technical names (
name,state) or the exported labels (Technical Name,Status); a headerless file is read asname[,state]. - Modules listed but missing on disk are reported as
not_on_diskand skipped; they simply are not in this container's repos.
Development
tox -e py-multi # tests in parallel (the integration test needs tgrep on PATH, else it skips)
tox -e lint # pre-commit checks
tox -e build # release rehearsal (sdist+wheel, twine check, install smoke test)
CHANGES
v0.1.1
- [FIX] indexer: install assets missing from checksums.txt with a warning
- [ADD] tgrep-deployv: install tgrep and index Odoo instances inside Vauxoo containers
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tgrep_deployv-0.1.1.tar.gz.
File metadata
- Download URL: tgrep_deployv-0.1.1.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
370ec37cff26e4b7409171ce005d6579fa350f85a53af72c7f418c5748a0e9f5
|
|
| MD5 |
a3bcc74868a035fd981ebdcc4edd0d2a
|
|
| BLAKE2b-256 |
81eeedcb9b24d2c6bc93a904066845040275c27b4db65e21acb383778e2c357b
|
File details
Details for the file tgrep_deployv-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tgrep_deployv-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
353b3df31e9a4dc3622932aa6110c3217a071def5a3f9a81cc8c15d49bb3c47d
|
|
| MD5 |
b3cc918c69b12f11cb7b1eda377a9a7e
|
|
| BLAKE2b-256 |
85ccfb0e4bb9dead66d4ae62b353f7667d2af2e4af86248e68b0ed55c1a2f217
|