Skip to main content

Turn click CLI's into QT applications

Project description

Welcome to clickqt

License: MIT GitHub Workflow Status Documentation Status

This is currently under active development between myself and a group of students

What is clickqt?

clickqt is a python package which turns click's CLIs into Qt-GUIs. Effectively, it turns

Usage: example_cli greet [OPTIONS]

Options:
  --userinfo <TEXT INTEGER DATETIME>...
  --help                          Show this message and exit.

into

test

Installation

The Python package clickqt can be installed from PyPI:

python -m pip install clickqt

Development installation

If you want to contribute to the development of clickqt, we recommend the following editable installation from this repository:

git clone git@github.com:dokempf/clickqt.git
cd clickqt
python -m pip install --editable .[tests]

Having done so, the test suite can be run using pytest:

python -m pytest

Usage

test

clickqt is designed to allow two ways of usage:

External

To use clickqt externally, you can run the entry point created by installing clickqt, called clickqtfy. There are two ways to use this entry point:

  • clickqtfy ENTRYPOINT
    

This way works if you have an installed entry point.

  • clickqtfy ENTRYPOINT FUNCNAME
    

In cases where there is no installed entry point, you can use this method instead, providing a path/filename for ENTRYPOINT and a function name within that file for FUNCNAME.

Wrapper with Entry Point

You can create entry points for clickqt in two steps:

  • Create the control for the GUI as a variable (in a file named somefile.py in the top-level directory of package somepackage):
    from clickqt import qt_gui_from_click
    import click
    
    @click.command(...)
    def foo(...):
      pass
    
    ui_handle = qt_gui_from_click(foo)
    
  • Then reference ui_handle in the gui_scripts section of your pyproject.toml file like this:
    [project.gui-scripts]
    gui = "somepackage.somefile:ui_handle"
    

After installing, you can run this entry point by typing gui in your console, create a desktop shortcut linked to it, etc..

Limitations

Currently clickqt only supports the built-in features from click. This means that any user defined behaviour (e.g., custom ParamTypes / Commands / Contexts) will propably not work as expected. Furthermore, clickqt handles envvar options diffently from click. In particular clickqt always splits the envvar whereas click does this dependent on the ParamType. Future releases will take these issues into account.

Acknowledgments

This repository was set up using the SSC Cookiecutter for Python Packages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clickqt-0.1.0.tar.gz (215.9 kB view details)

Uploaded Source

File details

Details for the file clickqt-0.1.0.tar.gz.

File metadata

  • Download URL: clickqt-0.1.0.tar.gz
  • Upload date:
  • Size: 215.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for clickqt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 08fd460d70797be8e5799225532a0c5c46f3dc0eee6da2efeeab47402f92ae4d
MD5 f7e554c99390541fc3d075970886eec4
BLAKE2b-256 f8f5ee1aff554ea30b563630a8cae3154a8e54ef49042f6177b97cbb2aec3a20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page