Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

NiceGooey

Turn your Python CLI program into a modern web-based UI

Screenshot of the UI displaying an example application

Based on Gooey and created using nicegui, NiceGooey transforms your CLI tool written with Python's argparse into a modern web UI with just a single line of code.

(NiceGooey is currently released as a Beta. It is functional and no major refactorings are planned, but some breaking changes and bug might happen.)

This project is published at Codeberg and mirrored to GitHub. It is available on PyPi as nicegooey.

Minimal example

Just importing and adding the annotation @nice_gooey_argparse_main(patch_argparse=True) to your main function is enough to start using NiceGooey.

from nicegooey.argparse import nice_gooey_argparse_main
import argparse

@nice_gooey_argparse_main(patch_argparse=True)
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--my-name", type=str, required=True)
    namespace = parser.parse_args()
    print(f"Hi, {namespace.my_name}")

Without using NiceGooey, this is a simple command line tool for which the call tool --my-name=Max would print Hi, Max to the terminal. With NiceGooey, this renders a web page with a text input and a submit button that shows "Hi, Max" in your browser.

Screenshot of the UI displaying an example application

More control by using NgArgumentParser

If the simple one-liner patch is not enough for you, a more type-safe and configurable version of NiceGooey can be used by using the NgArgumentParser class instead of argparse.ArgumentParser. See below for more info about nicegooey_config.

from nicegooey.argparse import nice_gooey_argparse_main, NgArgumentParser, NiceGooeyConfig
from nicegooey.argparse.ui_classes.actions.action_alternatives import store_action_slider


@nice_gooey_argparse_main(patch_argparse=False)
def main1(*args, **kwargs):
    parser = NgArgumentParser()
    my_name_action = parser.add_argument("--my-name", type=str, required=True)
    my_age_action = parser.add_argument("--my-age", type=int, required=True)
    parser.nicegooey_config = NiceGooeyConfig(
        root_card_class="max-w-4xl",  # don't take up the entire screen on wide desktops
        action_element_overrides={
            # Display the age as a slider instead of a number field.
            my_age_action: store_action_slider(min=0, max=100, step=1)
        }
    )
    namespace = parser.parse_args()
    print(f"Hi, {namespace.my_name}")

Screenshot of the UI displaying an example application

Configuring your application

By setting the nicegooey_config field of an NgArgumentParser instance, you can configure the style and behavior of your page.

NiceGooeyConfig

root_card_class
A space-separated list of Tailwind classes to be applied to the root of the argument UI. Especially useful to pass something like 'w-4xl' to limit the width on large screens.

action_config
A dict that maps parser action objects to ActionConfig classes. Use this to set configurations affecting individual actions.

ActionConfig

element_override
If set, this class is instantiated to display the widget for this element in the UI instead of the default. For example, use this to render a slider with min and max limits, instead of a numeric input field. Look at nicegooey.argparse.ui_classes.actions.action_alternatives for predefined options.

validation
A callable that is run when "Submit" is pressed. The value of the action is passed as the argument. If the function returns a string, the process is stopped and the string is shown as an error.

License

NiceGooey is published under LGPL. You are almost certainly allowed to use it for whatever your use case is, but are required to publish a copy of LGPL with it. This is covered by NiceGooey already, which shows a "License" button at the bottom of the page.

Artificial Intelligence

Generative AI and coding agents being a hot topic at the moment, especially in Open Source projects, this section is about disclosing any use of AI within this project, for anyone who is intersted:

  • There is no AI of any kind being called from the NiceGooey code itself.
  • Anthropic's Claude Code was used in some occasions of:
    • writing unit tests
    • creating showcase examples
    • refactorings on the implementation

Release files for nicegooey 1.0.0b2

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

Source distribution (sdist)

Source distribution for nicegooey 1.0.0b2
File Size Uploaded
nicegooey-1.0.0b2.tar.gz 38.6 kB Details

Built distribution (wheel)

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

Total release size: 85.9 kB

Release files / nicegooey-1.0.0b2.tar.gz

Download URL nicegooey-1.0.0b2.tar.gz
Size 38.6 kB
Tags Source
SHA-256 checksum
How to use checksums
caa77364438d9529420fc312c2071f478dd4b8db5e7f6782e2d8af024cd003f1
BLAKE2b-256 checksum
How to use checksums
8755baf3bd1113190c19ddb93aa56121d1acc9d1175491e9598037723eb112c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / nicegooey-1.0.0b2-py3-none-any.whl

Download URL nicegooey-1.0.0b2-py3-none-any.whl
Size 47.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19b0329818dd1450e169cba0b06d0ff91cedf3edf254007c44a050ede0a4d209
BLAKE2b-256 checksum
How to use checksums
21eaa6685e7223883498e830aa3e4f2ccbe6a77b164f4e609f85c648b3ea8518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.0.0b2 This release

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