百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dyc

> 编程语言
开源

记录您的代码

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

记录您的代码

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 follow Development steps to get up and running, all PRs are welcome. Please join our IRC discord channel if interested.

Tech

  • Python 2.7
  • Python 3

Installation

$ pip install document-your-code

Usage

This 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 in dyc.yaml at your root project. Refer to Example and Advanced

To run on all files in a project. Run

bash
$ dyc start

To run on a Git Diff patch. Run

bash
$  dyc diff

To have Docstrings prepended on a method while development. Run the following command

bash
$ dyc diff --watch

In order to bypass the text editor pop-up in the confirmation stage. Run

bash
$ dyc start --skip-confirm

Method Docstring Options

You can also Setup your own customized Docstring Method Formatting in dyc.yaml within formats key

Methods

Key Description Type
ignore Known method Names to be ignored from Docstrings list
keywords The necessary keyword to search for in a line that triggers actions list
enabled Determine if formatting is enabled for the extension bool
indent Indentation in a method. Limited options ['tab', '2 spaces', '4 spaces'] str
indent_content Confirm if the content of a docstring has to be indented as well bool
open Starting opener text of a method str
close Close text of a method. This could be the same as opened, but not all languages opening and closing docstrings are same str
comments Comments symbols str
break_after_open Do we add a new line after adding the open strings of a method? bool
break_after_docstring Do we add a new line after adding the docstring? bool
break_before_close Add a new line before closing docstrings on a method bool
words_per_line How many words do we add per docstring? int
within_scope Should the docstring be within the scope of the method or out? Just like JS Method docstrings bool

Arguments

Key Description Type
title A title for arguments. i.e: "Parameters" str
underline Underline the title bool
add_type If true, it will prompt for the argument type bool
inline Add docstrings all inline or break within. bool
ignore Arguments to ignore. list
prefix A prefix like "@param". str

Classes Docstring Options

You can also Setup your own customized Docstring Class Formatting in dyc.yaml within formats key

Class

Key Description Type
keywords The necessary keyword to search for in a line that triggers actions (default = ["class"]) list
enabled Determine if formatting is enabled for the extension bool
indent Indentation in a class. Limited options ['tab', '2 spaces', '4 spaces'] str
indent_content Confirm if the content of a docstring has to be indented as well bool
open Starting opener text of a method str
close Close text of a class. This could be the same as opened, but not all languages opening and closing docstrings are same str
comments Comments symbols str
break_after_open Do we add a new line after adding the open strings of a class? bool
break_after_docstring Do we add a new line after adding the docstring? bool
break_before_close Add a new line before closing docstrings on a class bool
words_per_line How many words do we add per docstring? int
within_scope Should the docstring be within the scope of the class or out? Just like JS Method docstrings bool

Parents

Key Description Type
title A title for arguments. i.e: "Inheritance" str
underline Underline the title bool
inline Add docstrings all inline or break within. bool
prefix A prefix like "@parent". str

Top of file Options

// TODO

Example

bash
$ cd myapp/
$ touch example.py
python
# example.py

def hello(name):
    return "Hello " + name
bash
$ dyc start

Processing Methods

Do you want to document method hello? [y/N]: y

(hello) Method docstring : DYC Greets you

(name) Argument docstring : John Smith
(name) Argument type : str
vim
## CONFIRM: MODIFY DOCSTRING BETWEEN START AND END LINES ONLY

def hello(name):
    ## START
    """
    DYC Greets you
    Parameters
    ----------
    str name: John Smith
    """
    ## END
    return "Hello " + name
~
~
~
bash
$ cat example.py

def hello(name):
    """
    DYC Greets you
    Parameters
    ----------
    str name: John Smith
    """
    return "Hello " + name%

Watch diff 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

bash
$ dyc diff --watch

Then on a separate session

bash
vim path/to/file
bash
## Append or add

def auto_document(foo=False):
    return foo

Print output

bash
$ git diff path/to/file

+
+def auto_document(foo=False):
+    """
+    
+    Parameters
+    ----------
+     foo: 
+    """
+    return foo

Advanced

bash
$ cd myapp/
$ touch example.py
$ touch dyc.yaml
python
# example.py

def hello(name):
    return "Hello " + name
yaml
# 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'
bash
$ dyc start

Processing Methods

Do you want to document method hello? [y/N]: y

(hello) Method docstring : Greeting Function

(name) Argument docstring : Human Name
vim
## CONFIRM: MODIFY DOCSTRING BETWEEN START AND END LINES ONLY

def hello(name):
        ## START
        '''Greeting Function
        My Customized Title
        -------------------
        @myAppParam  name: Human Name'''
        ## END
    return "Hello " + name
~

Development

Setup

Thank 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.

  1. Fork this repo.
  2. Clone the project.
  3. Setup virtualenv
  4. In the app folder. Run
bash
$ pip install --editable .

Before commiting:

Install the pre-commit hooks

pre-commit install

With docker

  1. docker-compose build
  2. docker-compose run --rm app
  • Do not need pip install --editable .

We use black to maintain a standard format for our code. Contributions must be black formatted to pass CI.

License

MIT ©

Contributors

Find the list of contributors here

Issues· 20 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言