Skip to content

The GruntWurk for Python (gwpycore) library -- a practical, non-intrusive framework for desktop, command-line, and mobile apps. It's especially intended to ease starting and contributing to open-source projects.

License

gruntwurk/gwpycore

Repository files navigation

GruntWurk Core Library for Python

GruntWurk logo

This is the GruntWurk for Python Library — a practical, non-intrusive framework for desktop and (presumably) mobile apps. By "non-intrusive," we mean that nothing is forced. This library plays nice with other frameworks. You are free to pick and choose the library elements that suit your needs and ignore the rest. For example, you don’t have to use Python’s built-in argParser library to process your command line interface, but if you do, then gwpycore has helpers for that.

This library is divided into several sections:

Project site

https://github.com/gruntwurk/gwpycore

Issues

https://github.com/gruntwurk/gwpycore/issues/

Authors

Craig Jones (polyglot-jones)

License

BSD-3-clause

Python versions

3.6 or above

The GruntWurk Family of Libraries/Projects

  • gwpycore — Classes and functions that augment fundamental features of Python. ← You Are Here

  • kivygw — Extensions/helpers for the Kivy GUI framework.

  • reportlabgw — Extensions/helpers for the ReportLab PDF framework.

  • general-tools — BASH script tools/libraries for building Linux boxes (e.g. RaspberryPi boxes; virtual machines via Vagrant), a reference library of cheat sheets, and more.

  • vscode-python — a Visual Studio Code plugin with 100’s of commands and snippets for working with plain Python as well as these "GruntWurk for Python" enhancements.

  • sublime_gruntwurk_python — a SublimeText 4 plugin with commands and snippets for working with plain Python as well as these "GruntWurk for Python" enhancements.

The GruntWurk Mission

The GruntWurk mission is to support open-source Python projects by making it easy for potential new contributors to jump on board. As the name implies, we aim to take the grunt-work out of project development, hiding away the complexities so that contributors can immediately get down to business. The shorter the learning curve, the easier it is for contributors to join in. See further details.

Features

This gwpycore package offers support for headless apps (command-Line only tools) as well as GUI apps (using the GUI framework of your choice).

General Application Support

  • Command-line support — building on the standard argparse library.

  • Config file support — building on the standard configparser library.

  • Advanced logging — building on the standard logging library.

  • Advanced exception handling — with coordinated exit-code support.

General GUI Support (regardless of the actual GUI framework used)

  • Skin Asset Management (app color schemes)

  • Syntax Asset Management (syntax highlighting color schemes)

  • KeyMap Asset Management

  • Icon Asset Management (plus SVG colorizing support)

  • (Incubating) Font Asset Management

  • (Incubating) Image Asset Management

Data Classes

  • Abstract base classes for a simple in-memory "database" (a dictionary of objects that are persisted to disk as a text file, e.g. CSV or fixed field).

  • Classic Tree Structure (Nodes)

Colors

  • A NamedColor enum with 500+ standard colors and easy ways to manipulate them. (Works seamlessly with GWConfigParser.)

Dates and Times

  • date_from_vague_parts()

  • interpret_date_range("YESTERDAY")

  • from_month_name()

  • timestamp() — A simple string with the current date/time (e.g. to add it to a file name).

Strings

  • strip_blank_lines()

  • rstrip_special() — A version of str.rstrip() that’s not as aggressive.

  • leading_spaces_count() — (Used by tab-to-spaces converter code, for example.)

  • normalize_name() — Replaces all non-alphanumeric characters with underscores.

Numeric Functions

  • next_in_range()

Windows Specific

  • fonts.py — Installing a TTF or OTF font in Windows.

  • winodws_behavior.py — disableWindowTracking().

  • winodws_printing.py — view_pdf(), print_pdf().

Kivy (GUI) Support

  • A standard set of dialog boxes (inform_user, ask_user_yes_no, …​)

  • Theme support (skins, images, icons, keymaps, fonts, syntax)

  • Kivy Widgets

    • BackgroundColor — A composable widget that sets the background of another widget.

    • GWCamera — A subclass of Kivy’s Camera widget that is automatically configeured by our CameraInfo() singleton.

    • CropTool — A widget for zooming/panning/cropping an image.

    • EnumDropDown — A subclass of Kivy’s Spinner widget that is automatically populated by an enum class.

ReportLab Support

  • So far, just a helper for registering TTF fonts.

(Incubating) “Cookie-cutter” templates will be provided to jump-start your application projects.

Tip
In the mean time, see general_example.py in the examples folder.
Note
FYI, this gwpycore project itself, being a “library” as opposed to an “application,” was bootstrapped using pyscaffold.

See also our vscode-python project and our sublime_grunwurk_python project — plugins for Visual Studio Code and SublimeText, respectively.

Be Aware

Note
This library was developed in Python 3.8 on Windows 10. Everything should work in Python 3.6 and/or on non-Windows boxes, but no guarantees either way.

Documentation

For the User (App Developer):

For any Possible Contributor to this Library:


About

The GruntWurk for Python (gwpycore) library -- a practical, non-intrusive framework for desktop, command-line, and mobile apps. It's especially intended to ease starting and contributing to open-source projects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published