Skip to main content

Simple app development around Gooey and argparse

Project description

simpleapp

simpleapp is a python module designed to make it easy to create simple applications for sharing with colleagues who may not have python installed, etc. The initial application area targetted is text processing and conversion. The aim is to enable a relatively weak python programmer (who may only use python occasionally) to be able to write some code to transform some data, but to not to have to worry too much about how to turn what is basically a single function into a full blow application.

The module uses the gooey module to provide a GUI for the command line options.

The two main areas where simpleapp helps is in providing a more sophisticated drop in replacement for argparse (sitting between argparse and gooey) and a pipeline function that can process data in a pipeline.

Here is a motivating example:

import simpleapp, codecs
from simpleapp.pipeline import Pipeline, textinfile, textoutfile

def process(txt, args):
    if args.reverse:
        res = txt.encode('raw_unicode_escape').decode('utf-8')
    else:
        res = txt.encode('utf-8').decode('raw_unicode_escape')
    return res

def main(argv=None):
    parser = simpleapp.ArgumentParser(prog="uniraw")
    parser.add_argument("infiles",nargs="+",help="Input file")
    parser.add_argument("-o","--outfile",help="Output file")
    parser.add_argument("-r","--reverse",action="store_true",help="Expand out Unicode chars")
    args = parser.parse_args(argv)

    Pipeline(args, textinfile, process, textoutfile, defaultext="_output")

if __name__ == "__main__":
    main()

Running this without command line options will bring up a GUI where a user may select multiple files and output them to a directory (or default them to have _output appended to the filename). If all the required command line options (infiles in this case) are given on the command line, no GUI is presented and the app can run file -> file rather than file -> directory for the single input file case. Likewise if the program is run with the -h command line option then help is printed to the terminal.

Having written such an application, it is then possible, using pyinstaller, to bundle the application as a .exe on Windows for users who do not want to install python or use a command line. For example:

pyinstaller -w -F uniraw.py

Will result in a 30+ MB. This seems a lot, but in the modern world, it will be barely noticeable!

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

simpleapp-0.1.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simpleapp-0.1.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file simpleapp-0.1.1.tar.gz.

File metadata

  • Download URL: simpleapp-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for simpleapp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3b3895bd618574ba694c111a0b5edcda045bbd5f687ea6ecfcc23dcf268b81d2
MD5 e4d94f88a14baf09f7b791e312b5ab57
BLAKE2b-256 29ff9f2502e30dfc4939ffee7f81f832d5265ad871fa07e1de51e49c37afa870

See more details on using hashes here.

File details

Details for the file simpleapp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: simpleapp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for simpleapp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f43262b2b3be340d5efbecb701614fd4eaf26792f03debe7b936dc4c953043ca
MD5 0581d83953154b68191752736683cce9
BLAKE2b-256 d92eb9c380534e376d0caf77f5db3aac5786f4fb6b9b7e5dba07f1ebbc115925

See more details on using hashes here.

Supported by

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