Skip to content

Instantly share code, notes, and snippets.

@michaelkarrer81
Last active September 22, 2022 14:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaelkarrer81/0aae391cac56c851d00b110e557da167 to your computer and use it in GitHub Desktop.
Save michaelkarrer81/0aae391cac56c851d00b110e557da167 to your computer and use it in GitHub Desktop.
[doodba tools] doodba tools and commands #doodba #odoo #docker #invoke #pre-commit

Invoke

Invoke is a Python task execution tool & library. Following the lead of most Unix CLI applications, it offers a traditional flag-based style of command-line parsing, deriving flag names and value types from task signatures (optionally, of course!). Like many of its predecessors, it offers advanced features as well – namespacing, task aliasing, before/after hooks, parallel execution and more.

Get more information at pyinvoke.org

# List all tasks invoke can find in the current direktory (from tasks.py)
invoke --list
# Only show commands that would be executed by called task(s) (dry run)
invoke -e -R img-pull
# run a task with debug output and echoing the commands
invoke -d -e img-pull

pre-commit

A multi-language package manager for pre-commit git hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. Get more information at pre-commit.com Github repository at github.com/pre-commit/pre-commit. To use pre-commit hooks for your python project you need to create a configuration file first and then install all the hooks in the configuration file via pre-commit install.

exclude: |
  # NOT INSTALLABLE ADDONS
  # END NOT INSTALLABLE ADDONS
  (?x)
  # Files and folders generated by bots, to avoid loops
  /static/description/index\.html$|
  # Library files can have extraneous formatting (even minimized)
  /static/(src/)?lib/|
  # You don't usually want a bot to modify your legal texts
  (LICENSE.*|COPYING.*)
default_language_version:
  python: python3
  node: "14.14.0"
repos:
  - repo: local
    hooks:
      - id: forbidden-files
        name: forbidden files
        entry: found forbidden files; remove them
        language: fail
        files: "\\.rej$"
  - repo: https://github.com/oca/maintainer-tools
    rev: b9c963d
    hooks:
      # update the NOT INSTALLABLE ADDONS section above
      - id: oca-update-pre-commit-excluded-addons
        args:
          - --addons-dir
          - odoo/custom/src/private
...
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
[michaelkarrer@~/odoo-new-setup/install_doodba/doodba_subproject_by_copier (master +)]$ git commit -m "First commit of doodba scaffolding test project"
[INFO] Initializing environment for https://github.com/oca/maintainer-tools.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/timothycrosley/isort.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:@prettier/plugin-xml@0.12.0,prettier@2.1.2.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://gitlab.com/pycqa/flake8.
[INFO] Initializing environment for https://gitlab.com/pycqa/flake8:flake8-bugbear==20.1.4.
[INFO] Initializing environment for https://github.com/pycqa/pylint.
[INFO] Initializing environment for https://github.com/pycqa/pylint:isort==4.3.21,pylint-odoo==3.6.0.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint:eslint@7.8.1.
[INFO] Installing environment for https://github.com/oca/maintainer-tools.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment