clisync


Nameclisync JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://clisync.surge.sh
SummaryGenerate click commands from your project
upload_time2024-03-14 17:46:49
maintainer
docs_urlNone
authorEdward Laurence
requires_python
license
keywords pip requirements imports
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CliSync

A python package to sync module and command line tools.

- [CliSync](#clisync)
  - [Installation](#installation)
  - [Usage](#usage)
    - [Include all class methods](#include-all-class-methods)
    - [Specify the method to include](#specify-the-method-to-include)
  - [Distribution on pypi](#distribution-on-pypi)
  - [Changelog](#changelog)

## Installation

```bash
pip install clisync
```

## Usage
This package is used to create a command line tool from a module. The command line tool is created using the `click` package.

It is intended for a specific use case with singleton classes. The static methods of the class are included in the command line tool.

A working and complete demo is available in the [demo](demo) directory. A readme file is available to explain how to install and use the demo.

### Include all class methods

```python
class Object():

    @staticmethod
    def create(a: int, b: str, c: Optional[float] = 1.0) -> str:
        """
        This is a docstring for the create method.
        """
        return f'{a} {b} {c}'
```

```python
from clisync import CliSync
cli = CliSync(module='my_module', cls='Object', requires_decorator=False)
```

The `cli` is a `click.MultiCommand` object that can be used to create a command line tool.

### Specify the method to include

Use the decorator `@clisync.include` to include a method in the command line tool.

```python
import clisync
class Object():

    @staticmethod
    @clisync.include
    def method():
        """
        This method is included because of the decorator.
        """
        pass
```

```python
from clisync import CliSync
cli = CliSync(module='my_module', cls='Object')
```

## Distribution on pypi

> Make sure the version number is updated in the [__init__.py](clisync/__init__.py) file and in the [setup.py](setup.py) file.

The distribution on done with continuous integration using github actions. The secret `PYPI_API_TOKEN` is set in the repository settings.

Then, to trigger the release, we need to create a tag with the version number. The release will be automatically created and the package will be uploaded to pypi.

For example, to release version 1.0.0, we need to do the following:

```bash
git tag v1.0.0
git push origin v1.0.0
``` 

You can also create a release with a new tag in the github interface.

## Changelog

- 1.2.0: Add the set up script for auto-complete using the `setup_autocomplete` function.
- 1.1.0: Add the possibility to exclude methods from the command line tool using the decorator `@clisync.exclude()`.
- 1.0.0: Initial release

            

Raw data

            {
    "_id": null,
    "home_page": "https://clisync.surge.sh",
    "name": "clisync",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pip requirements imports",
    "author": "Edward Laurence",
    "author_email": "edwardl@hectiq.ai",
    "download_url": "https://files.pythonhosted.org/packages/80/5f/d2eaaddd4ee880c0621484b0b29da46c755957b5e46506891abf65db8c8c/clisync-1.2.0.tar.gz",
    "platform": null,
    "description": "# CliSync\n\nA python package to sync module and command line tools.\n\n- [CliSync](#clisync)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Include all class methods](#include-all-class-methods)\n    - [Specify the method to include](#specify-the-method-to-include)\n  - [Distribution on pypi](#distribution-on-pypi)\n  - [Changelog](#changelog)\n\n## Installation\n\n```bash\npip install clisync\n```\n\n## Usage\nThis package is used to create a command line tool from a module. The command line tool is created using the `click` package.\n\nIt is intended for a specific use case with singleton classes. The static methods of the class are included in the command line tool.\n\nA working and complete demo is available in the [demo](demo) directory. A readme file is available to explain how to install and use the demo.\n\n### Include all class methods\n\n```python\nclass Object():\n\n    @staticmethod\n    def create(a: int, b: str, c: Optional[float] = 1.0) -> str:\n        \"\"\"\n        This is a docstring for the create method.\n        \"\"\"\n        return f'{a} {b} {c}'\n```\n\n```python\nfrom clisync import CliSync\ncli = CliSync(module='my_module', cls='Object', requires_decorator=False)\n```\n\nThe `cli` is a `click.MultiCommand` object that can be used to create a command line tool.\n\n### Specify the method to include\n\nUse the decorator `@clisync.include` to include a method in the command line tool.\n\n```python\nimport clisync\nclass Object():\n\n    @staticmethod\n    @clisync.include\n    def method():\n        \"\"\"\n        This method is included because of the decorator.\n        \"\"\"\n        pass\n```\n\n```python\nfrom clisync import CliSync\ncli = CliSync(module='my_module', cls='Object')\n```\n\n## Distribution on pypi\n\n> Make sure the version number is updated in the [__init__.py](clisync/__init__.py) file and in the [setup.py](setup.py) file.\n\nThe distribution on done with continuous integration using github actions. The secret `PYPI_API_TOKEN` is set in the repository settings.\n\nThen, to trigger the release, we need to create a tag with the version number. The release will be automatically created and the package will be uploaded to pypi.\n\nFor example, to release version 1.0.0, we need to do the following:\n\n```bash\ngit tag v1.0.0\ngit push origin v1.0.0\n``` \n\nYou can also create a release with a new tag in the github interface.\n\n## Changelog\n\n- 1.2.0: Add the set up script for auto-complete using the `setup_autocomplete` function.\n- 1.1.0: Add the possibility to exclude methods from the command line tool using the decorator `@clisync.exclude()`.\n- 1.0.0: Initial release\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Generate click commands from your project",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://clisync.surge.sh"
    },
    "split_keywords": [
        "pip",
        "requirements",
        "imports"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c12281b6a463a451b45c57f015cad5be523d924a386edd95d53ce71cb087d95c",
                "md5": "3f165d396fd4982c60cc6442d580c297",
                "sha256": "73725d89df4f767ee6c74a1e28ab38e43860aaba5aa382818f7b33e319c9600c"
            },
            "downloads": -1,
            "filename": "clisync-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f165d396fd4982c60cc6442d580c297",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7050,
            "upload_time": "2024-03-14T17:46:48",
            "upload_time_iso_8601": "2024-03-14T17:46:48.506679Z",
            "url": "https://files.pythonhosted.org/packages/c1/22/81b6a463a451b45c57f015cad5be523d924a386edd95d53ce71cb087d95c/clisync-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "805fd2eaaddd4ee880c0621484b0b29da46c755957b5e46506891abf65db8c8c",
                "md5": "d6c84e148942b1f358a374980d3b3b4b",
                "sha256": "a963cd793c200b57f68bfe8f3a59c07898cb2bc68691b36f6bd68cc6e302b974"
            },
            "downloads": -1,
            "filename": "clisync-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d6c84e148942b1f358a374980d3b3b4b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9808,
            "upload_time": "2024-03-14T17:46:49",
            "upload_time_iso_8601": "2024-03-14T17:46:49.393040Z",
            "url": "https://files.pythonhosted.org/packages/80/5f/d2eaaddd4ee880c0621484b0b29da46c755957b5e46506891abf65db8c8c/clisync-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 17:46:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "clisync"
}
        
Elapsed time: 0.20185s