Metadata-Version: 2.1
Name: simpleapp
Version: 0.1
Summary: Simple app development around Gooey and argparse
Author-email: Martin Hosken <fonts@sil.org>
License: MIT License
        
        Copyright (c) 2024 SIL Global
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Home-Page, https://github.com/silnrsi/python-simpleapp
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3.8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: gooey==1.0.8.1
Provides-Extra: git

# 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!



