Skip to main content

CliSync

A python package to sync module and command line tools.

Installation

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 directory. A readme file is available to explain how to install and use the demo.

Include all class methods

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}'
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.

import clisync
class Object():

    @staticmethod
    @clisync.include
    def method():
        """
        This method is included because of the decorator.
        """
        pass
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 file and in the 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:

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

Release files for clisync 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clisync 1.3.2
File Size Uploaded
clisync-1.3.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clisync 1.3.2
File Interpreter ABI Platform
clisync-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / clisync-1.3.2.tar.gz

Download URL clisync-1.3.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
77cb678b72cb1d86909b92c26cde9b3dab2a7a169ab3b33d270b129697f3dec5
BLAKE2b-256 checksum
How to use checksums
9694695828228eee7a9da944538f152238de79dbb0ec55cf16318e68ec167ef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / clisync-1.3.2-py3-none-any.whl

Download URL clisync-1.3.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98ae926439b409671fb1f5afab5544df0bc5819c2b809bf9b75cc2b1e18cad1c
BLAKE2b-256 checksum
How to use checksums
1091168333f75e8a5747b51cdffc3277da72e63ebec6ba495a07e1bb2f5e7d43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page