Skip to main content

auto generate a mini rst doc (code block + svg) from a test-file

Project description

Installation

$ pip3 install minidoc

License

  • MIT

Quickstart

  • pip3 install minidoc

  • make a workdir, such as “TEST”

    mkdir TEST
    cd TEST
  • edit your code.tst.py as below:

    cat code.tst.py
/docs/images/code.tst.py.00.png
run cmd minidoc ,
will auto exec the code in code.tst.py,
and auto save the terminal screen-shot(or recording)
and auto generate a .rst doc-file
minidoc
tree
TEST# tree
.
├── code.tst.py
├── images------------------------------->generated svgs
│   ├── __getitem__.svg
│   └── __init__.svg
└── Usage.rst---------------------------->generated .rst

1 directory, 4 files
TEST#
/docs/images/code.tst.py.11.png /docs/images/code.tst.py.2.png
  • open generated .rst to check it

/docs/images/code.tst.py.3.png
  • minidoc -h

    TEST# minidoc -h
    usage: minidoc [-h] [-tst TEST_FILE] [-codec CODEC] [-still STILL_FRAMES]
                   [-rows ROWNUMS] [-dst DST_DIR] [-title TITLE] [-tbot TITLE_BOT]
                   [-ebot ENTRY_BOT]
    
    optional arguments:
      -h,                   --help                       show this help message and exit
      -tst    TEST_FILE,    --test_file TEST_FILE        .tst.py file name,default = "code.tst.py"
      -codec  CODEC,        --codec CODEC                .tst.py file codec,default = "utf-8"
      -still  STILL_FRAMES, --still_frames STILL_FRAMES  generate screen shot,default = True (which means still image but not recording)
      -rows   ROWNUMS,      --rownums ROWNUMS            screen height,default = 30
      -dst    DST_DIR,      --dst_dir DST_DIR            destination svg dir, default ="./images"
      -title  TITLE,        --title TITLE                parent title, default = "Usage"
      -tbot   TITLE_BOT,    --title_bot TITLE_BOT        parent title bottom char, default = '='
      -ebot   ENTRY_BOT,    --entry_bot ENTRY_BOT        entry title bottom char, default = '-'

Usage

  • from code

    In progressing.....
  • from cmdline

    # screen shot
    root@# minidoc -tst code.rst.py -dst ./images
    
    # screen recording
    root@# minidoc -tst code.rst.py -dst ./images -still false
    
    # on current dir,screen shot
    root@# minidoc -still true
    
    # on current dir,screen recording
    root@# minidoc -still false
  • from docstring only one level(experimental,no recursive support, since only one level AST walked)

    root@# minidoc_from_docstring -proj dtable

Features

  • auto generate .rst doc from .tst.py

  • auto exec test-code in .tst.py

  • auto record the screen and save as .svg

Restrict

  • currently only support python3

TODO

  • javascript

  • lua

  • tclsh

References

  • termtosvg

  • elist

  • efdir

  • estring

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

minidoc-0.0.4.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file minidoc-0.0.4.tar.gz.

File metadata

  • Download URL: minidoc-0.0.4.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8

File hashes

Hashes for minidoc-0.0.4.tar.gz
Algorithm Hash digest
SHA256 df9d6eac8e4a105ea0d972ca7c54beaa96f967fcc4cde84d105876ea4145162e
MD5 ce13a8f0f32bbdcfa847f0d896e1c944
BLAKE2b-256 ddb59d0e845af71b1af88f3fbda9f355cf7ba609432e3b46be62721b0100dc21

See more details on using hashes here.

Supported by

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