Metadata-Version: 2.4
Name: pycli2
Version: 0.1.13
Summary: Python library to auto parse command line args from function typing.
Author-email: Osvald Lindholm <osvald.lindholm@gmail.com>
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/Olindholm/pycli2
Project-URL: Source, https://github.com/Olindholm/pycli2.git
Keywords: cli,command,line,arg,interface,parse,typing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: pydantic<3,>=2.1; python_version <= "3.12"
Requires-Dist: pydantic<3,>=2.8; python_version == "3.13"
Requires-Dist: pydantic<3,>=2.12; python_version >= "3.14"
Provides-Extra: dev
Requires-Dist: pytest==8.4.2; extra == "dev"
Requires-Dist: pytest-asyncio==1.2.0; extra == "dev"
Requires-Dist: ruff==0.14.4; extra == "dev"
Requires-Dist: pytest-ruff==0.5; extra == "dev"
Requires-Dist: mypy==1.18.2; extra == "dev"
Requires-Dist: pytest-mypy==1.0.1; extra == "dev"
Requires-Dist: types-setuptools==80.9.0.20250822; extra == "dev"
Requires-Dist: setuptools==80.9.0; extra == "dev"
Requires-Dist: semver==3.0.4; extra == "dev"
Requires-Dist: sphinx==8.1.3; extra == "dev"
Requires-Dist: sphinx-rtd-theme==3.0.2; extra == "dev"
Requires-Dist: autoapi==2.0.1; extra == "dev"
Requires-Dist: myst-parser==4.0.1; extra == "dev"
Requires-Dist: ipython==8.37.0; extra == "dev"
Dynamic: license-file

# PyCLI2

Python library to auto parse command line args from function typing.

# Overview

This package simplfies the creation of CLI apps, by analysing the typing of python functions and
parsing command line arguments.

# Installation

The python package, both wheel and source distribution is available at
[PyPI pycli2 project](https://pypi.org/project/pycli2/). Install using your python package manager
of choice. E.g. [pip](https://pip.pypa.io/en/stable/installation/) or
[uv](https://docs.astral.sh/uv/).
```sh
uv pip install pycli2
```

# Usage

The package comes with a demo CLI, which the source can be view at
[src/pycli2/\_\_main\_\_.py](src/pycli2/__main__.py). It can be accessed by running
```sh
python -m pycli --help
```

In order to make your own CLI, simply import `pycli2` and use the `pycli2.run` function.
Provide it with functions, and it'll automatically create a CLI app from the function
typing and function docstring.

```python
import pycli2

if __name__ == "__main__":
    # This will expose firstfunc, secondfunc, and thirdfunc to the CLI.
    pycli2.run(
        firstfunc,
        secondfunc,
        thirdfunc,
    )
```

# Contributing

...

## Install locally

Install in edit mode, with dev dependendencies using your python package manager of choice.
E.g. [pip](https://pip.pypa.io/en/stable/installation/) or [uv](https://docs.astral.sh/uv/).
```sh
uv pip install -e .[dev]
```

## Build

Build a distribution by setting the `PYTHON_PACKAGE` environment variable to the version and run

```sh
uv build
```

The documentation can also be built using the [Sphinx](https://www.sphinx-doc.org).

```sh
sphinx-build -M html docs/ dist/
```

# License

This project is licensed under the [GNU General Public License v3.0 only](LICENSE.md).
