Shell helper utilities for python


Keywords
markdown, python
License
MIT
Install
pip install gripe==2024.2.24.1.31

Documentation

gripe    
Opinionated extensions for the `grip` utility.

The grip utility provides rendering/serving local markdown files written in github-flavored markdown. Gripe extends it, allowing for serving more types of local files, as well as intelligent management for multiple `grip` daemons.


Overview

The gripe library provides extensions for grip.

The grip utility provides rendering/serving local markdown files written in github-flavored markdown.

Gripe extends it, allowing for serving more types of local files, as well as intelligent management for multiple grip daemons without thinking about server-port collisions.


Features

Support for Multiple Projects

Working with multiple projects simultaneously is supported. This works by managing multiple daemons with a per-project port. See CLI Usage for more information.


Installation

See pypi for available releases.

$ pip install gripe

Usage (CLI)

The gripe library publishes a small CLI tool.

Listing Servers

# or `gripe ls` or `python -mgripe ls`
$ gripe list 
{"local": [], "foreign": []}

Starting and Stopping Servers

# or `python -mgripe start`
$ gripe start
INFO gripe Trying to serve files                        
DEBUG gripe Starting gripe for this project..
DEBUG gripe Used ports: []                             
INFO gripe starting server with command:
INFO gripe 'flask --app gripe:app run --port 6149 >> .tmp.gripe.log 2>&1 &'

# startup example for a 2nd server over the same project: server start is NO-OP
$ gripe start
INFO gripe Trying to serve files                     
INFO gripe 1 copies of gripe are already started     
INFO gripe gripe @ pid `10059` is already serving this project
INFO gripe Skipping startup.

# startup example for 2nd server over 2nd project: new port allocated automatically
$ gripe start
INFO gripe trying to serve files
INFO gripe 1 copies of gripe are already started
INFO gripe No gripes are serving this project.
DEBUG  gripe Starting gripe for this project..
DEBUG  gripe Used ports: [6149]
DEBUG gripe server port @ 6149, using next available @ 6150
INFO gripe starting server with command:
INFO gripe   'flask --app gripe:app run --port 6150 >> .tmp.gripe.log 2>&1 &'

$ gripe stop
INFO gripe gripe @ {'pid': 10059, 'cwd':'...', 'port': 6149} started here
INFO gripe killing it..

Usage (API)

Listing Servers

>>> import gripe 
>>> gripe.list()
{"local": [], "foreign": []}

Starting and Stopping Servers

>>> import gripe 

>>> servers = gripe.start(); print(servers)
{ "local": [
    { "pid": 93867, 
      "cwd": "...", 
      "port": 6149 }
  ], 
  "foreign": []
}

>>> gripe.stop(grips=servers['local'])
{
 "killed": 
   [ { "pid": 93867, 
       "cwd": "...", 
       "port": 6149 } ]
}