Package: pip-split-requirements
pip-split-requirementsSplit a pip requirement files according to regular expression patterns rules.Table of Contentspip-split-requirementsInstallationQuick startCLI UsageConfiguration in pyproject.tomlUsage as a pre-commit hookLicenseInstallationpipx install pip-split-requirementsQuick startAssume the followingrequirements.txt:--find-links wheelhouse
pkga
git+https://github.com/some/project
pkgbRunningpip-split-requirements -g slow:git requirements.txtWill createrequirementsgroup-slow.txt:--find-links wheelhouse
git+https://github.com/some/projectandrequirementsgroup-other.txt:--find-links wheelhouse
pkga
pkgbCLI UsageUsage: pip-split-requirements [OPTIONS] REQUIREMENTS_FILE...

  Split a pip requirements file into multiple files according to patterns.

  Patterns are regular expressions against which requirement lines are
  searched to determine if they belong to a group. Group specs are evaluated
  in order, and the first match determines in which group the line goes.

  Comment lines are ignored.

  Option lines are emitted in all groups.

Arguments:
  REQUIREMENTS_FILE...  The requirements files to split. If not specified,
                        they are read from pyproject.toml.

Options:
  -g, --group-spec TEXT           Group specifications in form name:pattern.
  -p, --prefix TEXT               Each requirements group file will be named
                                  {prefix}-{group_name}.txt. The prefix can
                                  contain path separators, to generate files
                                  into a chosen directory.  [default:
                                  requirementsgroup]
  --default-group / --no-default-group
                                  Automatically append a group named 'other',
                                  matching all lines not matched by other
                                  groups.  [default: default-group]
  --remove-empty / --no-remove-empty
                                  Remove empty requirements group files.
                                  [default: no-remove-empty]
  -r, --project-root DIRECTORY    The project root directory. The generated
                                  requirements files will be relative to this
                                  directory. Default options and arguments are
                                  read from pyproject.toml in this directory.
                                  [default: .]
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help                          Show this message and exit.Configuration in pyproject.tomlpip-split-requirementscan be configured usingpyproject.toml. The following values are read from thetool.pip-split_requirementssection:group_specs: list of stringsprefix: stringdefault_group: booleanremove_empty: booleanrequirements_files: list of stringsCommand line options and argument have precedence overpyproject.tomlvalues.The following example configuration splitrequirements.txtandrequirements-test.txtinto a group namedvcswith requirements containing the wordgit+httpsorgit+sshand another group with everything else, asbuild/reqgroup-*.txt.[tool.pip-split-requirements]prefix="build/reqgroup"group_specs=["vcs:git.(https|ssh)"]requirements_files=["requirements.txt","requirements-test.txt"]Usage as a pre-commit hookThe following section of.pre-commit-config.yamlwill runpip-split-requirementsaccording using the configuration inpyproject.toml. This pre-commit hook runs when
eitherpyproject.toml,.pre-commit-config.yaml, or any file matching the pattern.*requirement.*\.txtchange.-repo:https://github.com/sbidoul/pip-split-requirementsrev:v0.7.0hooks:-id:pip-split-requirementsLicensepip-split-requirementsis distributed under the terms of theMITlicense.