Command line interface#

pyproject2conda#

pyproject2conda Usage: pyproject2conda [OPTIONS] COMMAND [ARGS]... Extract conda ``environment.yaml`` and pip ``requirement.txt`` files from  ``pyproject.toml`` Note that all subcommands can be called with shortest possible match. Also,  you can call with any of ``pyproject2conda``, ``p2c``, ``python -m pyproject2conda``. For example, .. code-block:: console         # these are equivalent         $ pyproject2conda yaml ...         $ p2c y ...         $ python -m pyproject2conda yaml ... ╭─ Options ────────────────────────────────────────────────────────────────────╮ --version-v --columns<int>Column width in terminal.  Set          ``COLUMNS`` environment variable to     this value                              [env var: P2C_COLUMNS]                  --install-completionInstall completion for the current      shell.                                  --show-completionShow completion for the current shell,  to copy it or customize the             installation.                           --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ list              List available extras.                                   yaml              Create yaml file from dependencies and                   optional-dependencies.                                   requirements      Create requirements.txt for pip dependencies.  Note that all requirements are normalized using                    ``packaging.requirements.Requirement``                   project           Create multiple environment files from                   ``pyproject.toml`` specification.                        conda-requirementsCreate requirement files for conda and pip.              json              Create json representation.                              ╰──────────────────────────────────────────────────────────────────────────────╯

list#

list Usage: pyproject2conda list [OPTIONS] List available extras. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input pyproject.toml file   [default: (pyproject.toml)] --verbose-v<int>Pass ``-v/--verbose`` for verbose output.  Pass multiple times to set verbosity level.          --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

yaml#

yaml Usage: pyproject2conda yaml [OPTIONS] Create yaml file from dependencies and optional-dependencies. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input            pyproject.toml   file             [default:        (pyproject.toml… --extra-e<str>Include          dependencies     from extra       <extra> from     ``project.optio… table of         ``pyproject.tom… Can specify      multiple times   for multiple     extras. Use name ``extras`` for   specifying in    ``pyproject.tom… --group-g<str>Include          dependencies     from group       <group> from     ``dependency-gr… table of         ``pyproject.tom… Can specify      multiple times   for multiple     groups. Use name ``groups`` for   specifying in    ``pyproject.tom… --extra-or-group<str>Include          dependencies     from extra or    group of         ``pyproject.tom… Extras are       checked first,   followed by      groups.  The     first instance   of               ``extra-or-grou… found is used.   That is, if both ``extras`` and   ``groups``       contain          ``extra-or-grou… the extra will   be used. Use     name             ``extras-or-gro… for specifying   in               ``pyproject.tom… --channel-c<str>Conda channel.   Can specify.     Overrides        --output-o<path>File to output   results          --name-n<str>Name of conda    env              --python-include<str>If value passed, use this value   (exactly) in the output. So, for  example, pass    ``--python-incl… "python~=3.8"``. Special case is  the value        ``"infer"``.     This infers the  value of python  from             ``pyproject.tom… Note that        pep-440 should   be followed.     Compatible       release          specifier        ``"~="`` will be converted to     ``"="`` in yaml  output.          --python-version<str>Python version   to check         ``python_version <=> {python_version… lines against.   That is, this    version is used  to limit         packages in      resulting        output. For      example, if have a line like      ``a-package;     python_version < '3.9'``, Using   ``--python-vers… 3.10`` will not  include          ``a-package``,   while            ``--python-vers… 3.8`` will       include          ``a-package``.   --python-p<str>python version.  passing          ``--python {version}`` is   equivalent to    passing          ``--python-vers… --python-includ… if passed, this  overrides values of passed via    ``--python-vers… and              ``--python-incl… pass             ``--python="def… to include the   python version   (major.minor     only) from, in   order,           ``.python-versi… or               ``.python-versi… in the current   directory. pass  ``"lowest"`` or  ``"highest"`` to include the      lowest or        highest python   version,         respectively,    from             ``pyproject.tom… table. in        project mode,    you can pass     multiple python  version in       ``pyproject.tom… with, e.g.,      ``python =       ["3.8", "3.9",   ....]``, or      using ``python = "all"``, to      include all      python versions  extracted from   ``pyproject.tom… table.           --skip-packageDefault is to    include package  dependencies     from             ``project.depen… table of         ``pyproject.tom… Passing          ``--skip-packag… (or              ``skip_package = true`` in        ``tool.pyprojec… table of         ``pyproject.tom… will exclude the package          dependencies.    This is useful   to define        environments     that should      exclude base     dependencies     (like build,     etc) in          pyproject.toml.  --pip-onlyTreat all        requirements as  pip              requirements.    Use option       ``pip_only`` in  pyproject.toml   --header--no-headerIf True          (--header)       include header   line in output.  Default is to    include the      header for       output to a      file, and not to include header   when writing to  stdout.          --custom-command<str>Custom command   to place in      header.  Implies ``--header``.    --overwrite-w<check|skip|forcWhat to do if    e>output file      exists. (check): Create if        missing. If      output exists    and passed       ``--filename``   is newer,        recreate output, else skip.       (skip): If       output exists,   skip. (force):   force: force     recreate output. [default: force] --verbose-v<int>Pass             ``-v/--verbose`` for verbose      output.  Pass    multiple times   to set verbosity level.           --conda-dep,--dep-d<str>Additional conda dependencies.    --pip-dep,--req-r<str>Additional pip   requirements.    For example,     pass ``-r '-e .'`` to included editable version of current       package in       requirements     file.            --allow-empty--no-allow-emp…What to do if    there are no     package          requirements for an environment.  The default      (``--no-allow-e… is to raise an   error if the     specification    leads to no      requirements.    Passing          ``--allow-empty will lead to a   message being    printed, but no  environment file being created.   [default:        no-allow-empty]  --helpShow this        message and      exit.            ╰──────────────────────────────────────────────────────────────────────────────╯

requirements#

requirements Usage: pyproject2conda requirements [OPTIONS] Create requirements.txt for pip dependencies.  Note that all requirements are  normalized using ``packaging.requirements.Requirement`` ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input            pyproject.toml   file             [default:        (pyproject.toml… --extra-e<str>Include          dependencies     from extra       <extra> from     ``project.optio… table of         ``pyproject.tom… Can specify      multiple times   for multiple     extras. Use name ``extras`` for   specifying in    ``pyproject.tom… --group-g<str>Include          dependencies     from group       <group> from     ``dependency-gr… table of         ``pyproject.tom… Can specify      multiple times   for multiple     groups. Use name ``groups`` for   specifying in    ``pyproject.tom… --extra-or-group<str>Include          dependencies     from extra or    group of         ``pyproject.tom… Extras are       checked first,   followed by      groups.  The     first instance   of               ``extra-or-grou… found is used.   That is, if both ``extras`` and   ``groups``       contain          ``extra-or-grou… the extra will   be used. Use     name             ``extras-or-gro… for specifying   in               ``pyproject.tom… --output-o<path>File to output   results          --skip-packageDefault is to    include package  dependencies     from             ``project.depen… table of         ``pyproject.tom… Passing          ``--skip-packag… (or              ``skip_package = true`` in        ``tool.pyprojec… table of         ``pyproject.tom… will exclude the package          dependencies.    This is useful   to define        environments     that should      exclude base     dependencies     (like build,     etc) in          pyproject.toml.  --header--no-headerIf True          (--header)       include header   line in output.  Default is to    include the      header for       output to a      file, and not to include header   when writing to  stdout.          --custom-command<str>Custom command   to place in      header.  Implies ``--header``.    --overwrite-w<check|skip|forcWhat to do if    e>output file      exists. (check): Create if        missing. If      output exists    and passed       ``--filename``   is newer,        recreate output, else skip.       (skip): If       output exists,   skip. (force):   force: force     recreate output. [default: force] --verbose-v<int>Pass             ``-v/--verbose`` for verbose      output.  Pass    multiple times   to set verbosity level.           --pip-dep,--req-r<str>Additional pip   requirements.    For example,     pass ``-r '-e .'`` to included editable version of current       package in       requirements     file.            --allow-empty--no-allow-emptyWhat to do if    there are no     package          requirements for an environment.  The default      (``--no-allow-e… is to raise an   error if the     specification    leads to no      requirements.    Passing          ``--allow-empty will lead to a   message being    printed, but no  environment file being created.   [default:        no-allow-empty]  --helpShow this        message and      exit.            ╰──────────────────────────────────────────────────────────────────────────────╯

project#

project Usage: pyproject2conda project [OPTIONS] Create multiple environment files from ``pyproject.toml`` specification. Note that if you specify options in ``pyproject.toml``, the name is usually the same as the command line option. For cases where the option can take  multiple values, the config file option will be plural. For example, the command line option ``--group`` becomes the config file option ``groups = ...``.  Boolean options like ``--header/--no-header`` become ``header = true/false`` in the config  file. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input            pyproject.toml   file             [default:        (pyproject.toml… --envs<str>List of          environments to  build files for. Default to       building all     environments     --template<str>Template for     environments     that do not have a python         version.         Defaults to      ``{env}``.       --template-python<str>Template for     environments     that do have a   python version.  Defaults to      "py{py}-{env}".  For example,     with             ``--template-py… and              ``--python=3.8`` and environment  "dev", output    would be         "py38-dev"  *    {py} -> "38" *   {py_version} ->  "3.8" * {env} -> "dev"            --pip-dep,--req-r<str>Additional pip   requirements.    For example,     pass ``-r '-e .'`` to included editable version of current       package in       requirements     file.            --conda-dep,--dep-d<str>Additional conda dependencies.    --pip_deps-ext<str>Extension to use with             requirements     file output      created from     template.        Defaults to      ``".txt"``.      [default: .txt]  --yaml-ext<str>Extension to use with conda       environment.yaml file output      created from     template.        Defaults to      ``".yaml"``      [default: .yaml] --header--no-headerIf True          (--header)       include header   line in output.  Default is to    include the      header for       output to a      file, and not to include header   when writing to  stdout.          --custom-command<str>Custom command   to place in      header.  Implies ``--header``.    --overwrite-w<check|skip|forcWhat to do if    e>output file      exists. (check): Create if        missing. If      output exists    and passed       ``--filename``   is newer,        recreate output, else skip.       (skip): If       output exists,   skip. (force):   force: force     recreate output. [default: force] --verbose-v<int>Pass             ``-v/--verbose`` for verbose      output.  Pass    multiple times   to set verbosity level.           --dryIf passed, do a  dry run          --pip-onlyTreat all        requirements as  pip              requirements.    Use option       ``pip_only`` in  pyproject.toml   --allow-empty--no-allow-emp…What to do if    there are no     package          requirements for an environment.  The default      (``--no-allow-e… is to raise an   error if the     specification    leads to no      requirements.    Passing          ``--allow-empty will lead to a   message being    printed, but no  environment file being created.   --helpShow this        message and      exit.            ╰──────────────────────────────────────────────────────────────────────────────╯

conda-requirements#

conda-requirements Usage: pyproject2conda conda-requirements [OPTIONS] [path_conda] [path_pip] Create requirement files for conda and pip. These can be install with, for example, conda install --file {path_conda} pip install -r {path_pip} ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ path_conda<path> path_pip  <path> ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input pyproject.toml file   [default: (pyproject.toml)] --extra-e<str>Include dependencies from      extra <extra> from             ``project.optional-dependenci… table of ``pyproject.toml``.   Can specify multiple times for multiple extras. Use name      ``extras`` for specifying in   ``pyproject.toml``             --group-g<str>Include dependencies from      group <group> from             ``dependency-groups`` table of ``pyproject.toml``. Can        specify multiple times for     multiple groups. Use name      ``groups`` for specifying in   ``pyproject.toml``             --extra-or-group<str>Include dependencies from      extra or group of              ``pyproject.toml``. Extras are checked first, followed by     groups.  The first instance of ``extra-or-group`` found is    used. That is, if both         ``extras`` and ``groups``      contain ``extra-or-group``,    the extra will be used. Use    name ``extras-or-groups`` for  specifying in                  ``pyproject.toml``             --python-include<str>If value passed, use this      value (exactly) in the output. So, for example, pass          ``--python-include "python~=3.8"``. Special case  is the value ``"infer"``. This infers the value of python     from ``pyproject.toml`` Note   that pep-440 should be         followed. Compatible release   specifier ``"~="`` will be     converted to ``"="`` in yaml   output.                        --python-version<str>Python version to check        ``python_version <=> {python_version}`` lines       against. That is, this version is used to limit packages in   resulting output. For example, if have a line like            ``a-package; python_version <  '3.9'``, Using                 ``--python-version 3.10`` will not include ``a-package``,     while ``--python-version 3.8`` will include ``a-package``.    --python-p<str>python version. passing        ``--python {version}`` is      equivalent to passing          ``--python-version={version}   --python-include=python{versi… if passed, this overrides      values of passed via           ``--python-version`` and       ``--python-include``. pass     ``--python="default"`` to      include the python version     (major.minor only) from, in    order,                         ``.python-version-default`` or ``.python-version``file in the current directory. pass        ``"lowest"`` or ``"highest"``  to include the lowest or       highest python version,        respectively, from             ``pyproject.toml:project.clas… table. in project mode, you    can pass multiple python       version in ``pyproject.toml``  with, e.g., ``python = ["3.8", "3.9", ....]``, or using       ``python = "all"``, to include all python versions extracted  from                           ``pyproject.toml:project.clas… table.                         --channel-c<str>Conda channel.  Can specify.   Overrides                      --skip-packageDefault is to include package  dependencies from              ``project.dependencies`` table of ``pyproject.toml``. Passing ``--skip-package`` (or         ``skip_package = true`` in     ``tool.pyproject2conda.envs..… table of ``pyproject.toml``)   will exclude the package       dependencies. This is useful   to define environments that    should exclude base            dependencies (like build, etc) in pyproject.toml.             --prefix<path>set conda-output=prefix +      'conda.txt', pip-output=prefix + 'pip.txt'                    --prepend-channel --header--no-headerIf True (--header) include     header line in output. Default is to include the header for   output to a file, and not to   include header when writing to stdout.                        --custom-command<str>Custom command to place in     header.  Implies ``--header``. --conda-dep,--dep-d<str>Additional conda dependencies. --pip-dep,--req-r<str>Additional pip requirements.   For example, pass ``-r '-e .'`` to included editable      version of current package in  requirements file.             --verbose-v<int>Pass ``-v/--verbose`` for      verbose output.  Pass multiple times to set verbosity level.  --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

json#

json Usage: pyproject2conda json [OPTIONS] Create json representation. Keys are: "dependencies": conda dependencies. "pip": pip dependencies. "channels": conda channels. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --pyproject<path>input pyproject.toml file   [default: (pyproject.toml)] --extra-e<str>Include dependencies from     extra <extra> from            ``project.optional-dependenc… table of ``pyproject.toml``.  Can specify multiple times    for multiple extras. Use name ``extras`` for specifying in  ``pyproject.toml``            --group-g<str>Include dependencies from     group <group> from            ``dependency-groups`` table   of ``pyproject.toml``. Can    specify multiple times for    multiple groups. Use name     ``groups`` for specifying in  ``pyproject.toml``            --extra-or-group<str>Include dependencies from     extra or group of             ``pyproject.toml``. Extras    are checked first, followed   by groups.  The first         instance of                   ``extra-or-group`` found is   used. That is, if both        ``extras`` and ``groups``     contain ``extra-or-group``,   the extra will be used. Use   name ``extras-or-groups`` for specifying in                 ``pyproject.toml``            --python-include<str>If value passed, use this     value (exactly) in the        output. So, for example, pass ``--python-include "python~=3.8"``. Special case is the value ``"infer"``.     This infers the value of      python from                   ``pyproject.toml`` Note that  pep-440 should be followed.   Compatible release specifier  ``"~="`` will be converted to ``"="`` in yaml output.       --python-version<str>Python version to check       ``python_version <=> {python_version}`` lines      against. That is, this        version is used to limit      packages in resulting output. For example, if have a line   like ``a-package;             python_version < '3.9'``,     Using ``--python-version 3.10`` will not include       ``a-package``, while          ``--python-version 3.8`` will include ``a-package``.        --python-p<str>python version. passing       ``--python {version}`` is     equivalent to passing         ``--python-version={version}  --python-include=python{vers… if passed, this overrides     values of passed via          ``--python-version`` and      ``--python-include``. pass    ``--python="default"`` to     include the python version    (major.minor only) from, in   order,                        ``.python-version-default``   or ``.python-version``file in the current directory. pass   ``"lowest"`` or ``"highest"`` to include the lowest or      highest python version,       respectively, from            ``pyproject.toml:project.cla… table. in project mode, you   can pass multiple python      version in ``pyproject.toml`` with, e.g., ``python =        ["3.8", "3.9", ....]``, or    using ``python = "all"``, to  include all python versions   extracted from                ``pyproject.toml:project.cla… table.                        --channel-c<str>Conda channel.  Can specify.  Overrides                     --output-o<path>File to output results --skip-packageDefault is to include package dependencies from             ``project.dependencies``      table of ``pyproject.toml``.  Passing ``--skip-package``    (or ``skip_package = true``   in                            ``tool.pyproject2conda.envs.… table of ``pyproject.toml``)  will exclude the package      dependencies. This is useful  to define environments that   should exclude base           dependencies (like build,     etc) in pyproject.toml.       --conda-dep,--dep-d<str>Additional conda              dependencies.                 --pip-dep,--req-r<str>Additional pip requirements.  For example, pass ``-r '-e .'`` to included editable     version of current package in requirements file.            --verbose-v<int>Pass ``-v/--verbose`` for     verbose output.  Pass         multiple times to set         verbosity level.              --overwrite-w<check|skip|force>What to do if output file     exists. (check): Create if    missing. If output exists and passed ``--filename`` is      newer, recreate output, else  skip. (skip): If output       exists, skip. (force): force: force recreate output.        [default: force]              --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯