8000 GitHub - lkubb/salt-tool-pipx-formula: Manage standalone python programs with pipx and Salt. Provides execution and state module for Salt.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lkubb/salt-tool-pipx-formula

Repository files navigation

Pipx Formula

Manages Pipx in the user environment.

Applying tool_pipx will make sure pipx is configured as specified.

Execution and state module

This formula provides a custom execution module and state to manage packages installed with Pipx. The functions are self-explanatory, please see the source code or the rendered docs at :ref:`em_pipx` and :ref:`sm_pipx`.

  • Especially on MacOS + Homebrew, after brew upgraded its Python, all installed packages will be broken. A workaround is to issue pipx reinstall-all. It might make sense to depend on a different, more stable python, e.g. pipx reinstall-all --python /usr/bin/python3.

This formula

The general configuration structure is in line with all other formulae from the tool suite, for details see :ref:`toolsuite`. An example pillar is provided, see :ref:`pillar.example`. Note that you do not need to specify everything by pillar. Often, it's much easier and less resource-heavy to use the parameters/<grain>/<value>.yaml files for non-sensitive settings. The underlying logic is explained in :ref:`map.jinja`.

User-specific

The following shows an example of tool_pipx per-user configuration. If provided by pillar, namespace it to tool_global:users and/or tool_pipx:users. For the parameters YAML file variant, it needs to be nested under a values parent key. The YAML files are expected to be found in

  1. salt://tool_pipx/parameters/<grain>/<value>.yaml or
  2. salt://tool_global/parameters/<grain>/<value>.yaml.
user:

    # Force the usage of XDG directories for this user.
  xdg: true

    # Put shell completions into this directory, relative to user home.
  completions: '.config/zsh/completions'

    # Persist environment variables used by this formula for this
    # user to this file (will be appended to a file relative to $HOME)
  persistenv: '.config/zsh/zshenv'

    # Add runcom hooks specific to this formula to this file
    # for this user (will be appended to a file relative to $HOME)
  rchook: '.config/zsh/zshrc'

    # This user's configuration for this formula. Will be overridden by
    # user-specific configuration in `tool_pipx:users`.
    # Set this to `false` to disable configuration for this user.
  pipx:
      # packages to install with pipx (convenience)
    packages:
      - cookiecutter
      - cruft
      - poetry

Formula-specific

tool_pipx:

    # Specify an explicit version (works on most Linux distributions) or
    # keep the packages updated to their latest version on subsequent runs
    # by leaving version empty or setting it to 'latest'
    # (again for Linux, brew does that anyways).
  version: latest
  install_method: pkg

    # Default formula configuration for all users.
  defaults:
    packages: default value for all users

The following states are found in this formula:

Meta-state.

Performs all operations described in this formula according to the specified configuration.

Installs the Pipx package only.

Ensures Pipx adheres to the XDG spec as best as possible for all managed users. Has a dependency on tool_pipx.package.

Install Pipx completions into user's rchook file.

Mind that for zsh, the position of the line loading the completions matters. It needs to be placed before autoload -U bashcompinit && bashcompinit, but after compinit.

Meta-state.

Undoes everything performed in the tool_pipx meta-state in reverse order.

Removes Pipx XDG compatibility crutches for all managed users.

Removes pipx completions for all managed users.

Contributing to this repo

Commit messages

Commit message formatting is significant.

Please see How to contribute for more details.

pre-commit

pre-commit is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes. First install the pre-commit package manager using the appropriate method, then run bin/install-hooks and now pre-commit will run automatically on each git commit.

$ bin/install-hooks
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg

State documentation

There is a script that semi-autodocuments available states: bin/slsdoc.

If a .sls file begins with a Jinja comment, it will dump that into the docs. It can be configured differently depending on the formula. See the script source code for details currently.

This means if you feel a state should be documented, make sure to write a comment explaining it.

About

Manage standalone python programs with pipx and Salt. Provides execution and state module for Salt.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0