Skip to content

Simple yet powerful tool to remove comments from python scripts, with directory recursion

License

Notifications You must be signed in to change notification settings

codecliff/NoCommentsPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

NoCommentsPython

A python script to remove comments from python scripts, with directory recursion

Features

  1. Removes comments and docstrings
  2. Removes blank lines
  3. Can handle all files in a given directory
  4. Can attach a predefined header text to each output
  5. Non destructive - writes output to a separate file

How to use :

  1. See help :

    python nocommentspython.py -h

  2. Specify an input file to strip

    python nocommentspython.py -i /path/to/inputfile.py

    This will create an output file inputfile.py_sanscomments.py in the same directory as input file

  3. (Optional) Retain header section

    python nocommentspython.py -i /path/to/inputfile.py -k yes

  4. (Optional) Specify a header file to insert at the top of output file (Say, for copyright and licenses)

    python nocommentspython.py -i /path/to/inputfile.py -c /path/to/headerfile.txt

  5. Process all files in a directory :

    python nocommentspython.py -i /path/to/directory

    This will process each .py file in that directory and save its respective output file. If any input file has an associated header file, it will be duly inserted in its output file (see below).

Note

Header/Copyright Files: (Automatic headers for output)* If an input file is named abcinput.py, you can store its header text in a file named abcinput.py_header.txt in the same directory. This text will automatically be inserted in the output. This is specially helpful for processing directories (see above).

© Rahul Singh

About

Simple yet powerful tool to remove comments from python scripts, with directory recursion

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages