Console script for pyproject2conda (cli)#

Functions:

main(version, ] = False, columns, ] = None)

Extract conda environment.yaml and pip requirement.txt files from pyproject.toml

create_list(pyproject_filename, ], verbose, ...)

List available extras.

yaml(pyproject_filename, ], extras, ...)

Create yaml file from dependencies and optional-dependencies.

requirements(pyproject_filename, ], extras, ...)

Create requirements.txt for pip dependencies.

project(pyproject_filename, ], envs, ...)

Create multiple environment files from pyproject.toml specification.

conda_requirements(pyproject_filename, ], ...)

Create requirement files for conda and pip.

to_json(pyproject_filename, ], extras, ...)

Create json representation.

pyproject2conda.cli.main(version: Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3bf59bd0>]=False, columns: Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3bf58b90>]=None) None[source]#

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,

# these are equivalent
$ pyproject2conda yaml ...
$ p2c y ...
$ python -m pyproject2conda yaml ...
pyproject2conda.cli.create_list(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None) None[source]#

List available extras.

pyproject2conda.cli.yaml(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], extras: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff16d0>] = None, groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1810>] = None, extras_or_groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1950>] = None, channels: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1a90>] = None, output: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f1f3cff1d10>] = None, name: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff1bd0>] = None, python_include: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2350>] = None, python_version: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2490>] = None, python: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff25d0>] = None, skip_package: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff20d0>] = False, pip_only: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff2210>] = False, header: ~typing.Annotated[bool | None, <typer.models.OptionInfo object at 0x7f1f3cff2710>] = None, custom_command: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2850>] = None, overwrite: ~typing.Annotated[~pyproject2conda._schema.Overwrite, <typer.models.OptionInfo object at 0x7f1f3cff1e50>] = Overwrite.force, verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None, conda_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2990>] = None, pip_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2ad0>] = None, allow_empty: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff3610>] = False) None[source]#

Create yaml file from dependencies and optional-dependencies.

pyproject2conda.cli.requirements(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], extras: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff16d0>] = None, groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1810>] = None, extras_or_groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1950>] = None, output: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f1f3cff1d10>] = None, skip_package: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff20d0>] = False, header: ~typing.Annotated[bool | None, <typer.models.OptionInfo object at 0x7f1f3cff2710>] = None, custom_command: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2850>] = None, overwrite: ~typing.Annotated[~pyproject2conda._schema.Overwrite, <typer.models.OptionInfo object at 0x7f1f3cff1e50>] = Overwrite.force, verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None, pip_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2ad0>] = None, allow_empty: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff3610>] = False) None[source]#

Create requirements.txt for pip dependencies. Note that all requirements are normalized using packaging.requirements.Requirement

pyproject2conda.cli.project(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], envs: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2c10>] = None, template: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2d50>] = None, template_python: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2e90>] = None, pip_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2ad0>] = None, conda_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2990>] = None, reqs_ext: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2fd0>] = '.txt', yaml_ext: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff3110>] = '.yaml', header: ~typing.Annotated[bool | None, <typer.models.OptionInfo object at 0x7f1f3cff2710>] = None, custom_command: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2850>] = None, overwrite: ~typing.Annotated[~pyproject2conda._schema.Overwrite, <typer.models.OptionInfo object at 0x7f1f3cff1e50>] = Overwrite.force, verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None, dry: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff3250>] = False, pip_only: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff2210>] = False, allow_empty: ~typing.Annotated[bool | None, <typer.models.OptionInfo object at 0x7f1f3cff3610>] = None) None[source]#

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.

pyproject2conda.cli.conda_requirements(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], path_conda: ~typing.Annotated[~pathlib.Path | None, <typer.models.ArgumentInfo object at 0x7f1f3bf5bc50>] = None, path_pip: ~typing.Annotated[~pathlib.Path | None, <typer.models.ArgumentInfo object at 0x7f1f3bf59310>] = None, extras: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff16d0>] = None, groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1810>] = None, extras_or_groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1950>] = None, python_include: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2350>] = None, python_version: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2490>] = None, python: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff25d0>] = None, channels: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1a90>] = None, skip_package: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff20d0>] = False, prefix: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f1f3cff3390>] = None, prepend_channel: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff34d0>] = False, header: ~typing.Annotated[bool | None, <typer.models.OptionInfo object at 0x7f1f3cff2710>] = None, custom_command: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2850>] = None, conda_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2990>] = None, pip_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2ad0>] = None, verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None) None[source]#

Create requirement files for conda and pip.

These can be install with, for example,

conda install –file {path_conda} pip install -r {path_pip}

pyproject2conda.cli.to_json(pyproject_filename: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f1f3cff1590>], extras: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff16d0>] = None, groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1810>] = None, extras_or_groups: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1950>] = None, python_include: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2350>] = None, python_version: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff2490>] = None, python: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f1f3cff25d0>] = None, channels: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff1a90>] = None, output: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f1f3cff1d10>] = None, skip_package: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f1f3cff20d0>] = False, conda_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2990>] = None, pip_deps: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f1f3cff2ad0>] = None, verbose: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f1f3cff1f90>] = None, overwrite: ~typing.Annotated[~pyproject2conda._schema.Overwrite, <typer.models.OptionInfo object at 0x7f1f3cff1e50>] = Overwrite.force) None[source]#

Create json representation.

Keys are: “dependencies”: conda dependencies. “pip”: pip dependencies. “channels”: conda channels.