Package: document-your-code
DYC is a CLI tool that helps with documenting your source code. It will help keep you alert for new methods that were added and not documented.
It also supports to build a reusable docstring template. Just answer the prompt questions in your terminal to see the effect on your files.Keep your Docstrings consistent.Document your DIFF patch.Ease of helping other developers understand your code.All contributions are welcome. Please followDevelopmentsteps to get up and running, all PRs are welcome.
Please join ourIRC discord channelif interested.TechPython 2.7Python 3Installation$ pip install document-your-codeUsageThis is intended to work on all programming languages. Kicking off with Python as a starter (Only default formatting added). You can override
the default settings for python files and extend new formats indyc.yamlat your root project. Refer toExampleandAdvancedTo run on all files in a project. Run$dycstartTo run on a Git Diff patch. Run$dycdiffTo have Docstrings prepended on a method while development.
Run the following command$dycdiff--watchIn order to bypass the text editor pop-up in the confirmation stage. Run$dycstart--skip-confirmMethod Docstring OptionsYou can also Setup your own customized Docstring Method Formatting indyc.yamlwithinformatskeyMethodsKeyDescriptionTypeignoreKnown method Names to be ignored from DocstringslistkeywordsThe necessary keyword to search for in a line that triggers actionslistenabledDetermine if formatting is enabled for the extensionboolindentIndentation in a method. Limited options ['tab', '2 spaces', '4 spaces']strindent_contentConfirm if the content of a docstring has to be indented as wellboolopenStarting opener text of a methodstrcloseClose text of a method. This could be the same as opened, but not all languages opening and closing docstrings are samestrcommentsComments symbolsstrbreak_after_openDo we add a new line after adding the open strings of a method?boolbreak_after_docstringDo we add a new line after adding the docstring?boolbreak_before_closeAdd a new line before closing docstrings on a methodboolwords_per_lineHow many words do we add per docstring?intwithin_scopeShould the docstring be within the scope of the method or out? Just like JS Method docstringsboolArgumentsKeyDescriptionTypetitleA title for arguments. i.e: "Parameters"strunderlineUnderline the titlebooladd_typeIf true, it will prompt for the argument typeboolinlineAdd docstrings all inline or break within.boolignoreArguments to ignore.listprefixA prefix like "@param".strClasses Docstring OptionsYou can also Setup your own customized Docstring Class Formatting indyc.yamlwithinformatskeyClassKeyDescriptionTypekeywordsThe necessary keyword to search for in a line that triggers actions (default = ["class"])listenabledDetermine if formatting is enabled for the extensionboolindentIndentation in a class. Limited options ['tab', '2 spaces', '4 spaces']strindent_contentConfirm if the content of a docstring has to be indented as wellboolopenStarting opener text of a methodstrcloseClose text of a class. This could be the same as opened, but not all languages opening and closing docstrings are samestrcommentsComments symbolsstrbreak_after_openDo we add a new line after adding the open strings of a class?boolbreak_after_docstringDo we add a new line after adding the docstring?boolbreak_before_closeAdd a new line before closing docstrings on a classboolwords_per_lineHow many words do we add per docstring?intwithin_scopeShould the docstring be within the scope of the class or out? Just like JS Method docstringsboolParentsKeyDescriptionTypetitleA title for arguments. i.e: "Inheritance"strunderlineUnderline the titleboolinlineAdd docstrings all inline or break within.boolprefixA prefix like "@parent".strTop of file Options// TODOExample$cdmyapp/
$touchexample.py# example.pydefhello(name):return"Hello "+name$dycstart

ProcessingMethods

Doyouwanttodocumentmethodhello?[y/N]:y(hello)Methoddocstring:DYCGreetsyou(name)Argumentdocstring:JohnSmith(name)Argumenttype:str## CONFIRM: MODIFY DOCSTRING BETWEEN START AND END LINES ONLYdefhello(name):
    ## START"""DYC Greets you
    Parameters----------str name: John Smith"""## ENDreturn"Hello "+name~~~$catexample.py

defhello(name):"""DYC Greets youParameters----------str name: John Smith"""return"Hello "+name%Watchdiff flag.Run in a terminal session where you have project initialized with Git and on unstaged file.This will not work (YET) on untracked files$dycdiff--watchThen on a separate sessionvimpath/to/file## Append or adddefauto_document(foo=False):returnfooPrint output$gitdiffpath/to/file

+
+defauto_document(foo=False):
+"""+    <docstring>+    Parameters+    ----------+    <type> foo: <arg docstring>+    """+returnfooAdvanced$cdmyapp/
$touchexample.py
$touchdyc.yaml# example.pydefhello(name):return"Hello "+name# dyc.yaml

formats:
  -
    extension: 'py'
    method:
      indent: 'tab'
      open: "'''"
      close: "'''"
      break_after_open: false
      break_before_close: false
    arguments:
      title: 'My Customized Title'
      underline: true
      add_type: false
      prefix: '@myAppParam'$dycstart

ProcessingMethods

Doyouwanttodocumentmethodhello?[y/N]:y(hello)Methoddocstring:GreetingFunction(name)Argumentdocstring:HumanName## CONFIRM: MODIFY DOCSTRING BETWEEN START AND END LINES ONLYdefhello(name):
        ## START'''Greeting Function
        My Customized Title-------------------@myAppParam  name: Human Name'''
        ## ENDreturn"Hello "+name~DevelopmentSetupThank you for taking the time to contribute into this project. It is simple but could be really helpful moving forward to all developers.To get started.Fork this repo.Clone the project.Setup virtualenvIn the app folder. Run$pipinstall--editable.Before commiting:Install the pre-commit hookspre-commit installWith dockerdocker-compose builddocker-compose run --rm appDo not needpip install --editable .We useblackto maintain a standard format for our code. Contributions must be black formatted to pass CI.LicenseMIT ©ContributorsFind the list of contributorshere