加载Python对象文档。

pytkdocs的Python项目详细描述


pytkdocs公司

cidocumentationpypi versionconda versiongitter

加载Python对象文档。在

要求

pytkdocs需要Python3.6或更高版本。在

<详细信息>要安装python3.6,我建议使用^{}
# install pyenv
git clone https://github.com/pyenv/pyenv ~/.pyenv

# setup pyenv (you should also put these three lines in .bashrc or similar)exportPATH="${HOME}/.pyenv/bin:${PATH}"exportPYENV_ROOT="${HOME}/.pyenv"eval"$(pyenv init -)"# install Python 3.6
pyenv install 3.6.12

# make it available globally
pyenv global system 3.6.12

安装

使用pip

^{pr2}$

使用^{}

python3.6 -m pip install --user pipx

pipx install --python python3.6 pytkdocs

使用conda

condainstall-cconda-forgepytkdocs

使用

pytkdocs在标准输入上接受JSON,在标准输出上写入JSON。在

输入格式:

{"objects":[{"path":"pytkdocs","new_path_syntax":false,"members":true,"inherited_members":false,"filters":["!^_[^_]"],"docstring_style":"google","docstring_options":{"replace_admonitions":true}}]}

输出格式:

{"loading_errors":["string (message)"],"parsing_errors":{"string (object)":["string (message)"]},"objects":[{"name":"pytkdocs","path":"pytkdocs","category":"module","file_path":"/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py","relative_file_path":"pytkdocs/__init__.py","properties":["special"],"parent_path":"pytkdocs","has_contents":true,"docstring":"pytkdocs package.\n\nLoad Python objects documentation.","docstring_sections":[{"type":"markdown","value":"pytkdocs package.\n\nLoad Python objects documentation."}],"source":{"code":"\"\"\"\npytkdocs package.\n\nLoad Python objects documentation.\n\"\"\"\n\nfrom typing import List\n\n__all__: List[str] = []\n","line_start":1},"children":{"pytkdocs.__all__":{"name":"__all__","path":"pytkdocs.__all__","category":"attribute","file_path":"/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py","relative_file_path":"pytkdocs/__init__.py","properties":["special"],"parent_path":"pytkdocs","has_contents":false,"docstring":null,"docstring_sections":[],"source":{},"children":{},"attributes":[],"methods":[],"functions":[],"modules":[],"classes":[]}},"attributes":["pytkdocs.__all__"],"methods":[],"functions":[],"modules":["pytkdocs.__main__","pytkdocs.cli","pytkdocs.loader","pytkdocs.objects","pytkdocs.parsers","pytkdocs.properties","pytkdocs.serializer"],"classes":[]}]}

命令行

不带参数运行pytkdocs将读取整个标准输入, 并输出一次结果。在

运行pytkdocs --line-by-line将进入无限循环, 每次迭代时,在标准输入上读取一行, 结果写回一行。 这允许其他程序在子进程中使用pytkdocs, 给它输入一行JSON,并读回一行JSON。 这种模式实际上是专门为 mkdocstrings。在

配置

可用的配置选项包括:

  • new_path_syntax:当设置为true时,此选项强制使用新的对象路径语法, 它使用冒号(:)将模块与其他对象分隔开来。在

  • filters:过滤器是允许根据对象名称选择或取消选择对象的正则表达式。 它们递归地应用(在每个对象的每个子对象上)。 如果表达式以感叹号开头, 它将过滤出与之匹配的对象(在求值之前去掉感叹号)。 否则,将选择与之匹配的对象。 每个正则表达式都针对每个名称执行。 它允许细粒度过滤。示例:

    • !^_:筛选出名称以_(private/protected)开头的每个对象
    • ^__:但仍然选择那些以两个开头的_(class private)
    • !^__.*__$:除了那些同时以两个_(特价)结尾的人
  • members:此选项允许显式选择top对象的成员。 如果True,请选择通过筛选器的每个成员。如果False,则不选择任何内容。 如果是名称列表,请仅选择这些成员,并仅对其子级应用筛选器。在

  • inherited_members:true或false(默认值)。启用时,也将选择继承的成员。在

  • docstring_style:解析docstring时要使用的docstring样式。googlerestructured-text1。在

  • docstring_options:传递给docstring解析器的选项。在

    • google接受replace_admonitions布尔选项(默认值:true)。启用后,此选项将 将缩进块的标题替换为等效的标记警告: AdmonitionType: Title将变成{}。
    • restructured-text不接受任何选项。

1:重组文本解析正在积极开发中,功能尚未完成。在

关于new_path_syntax

示例:

New syntax^{}
Old syntax^{}
  • 如果冒号是对象的路径,pytkdocs会相应地拆分路径, 不管new_path_syntax的值。
  • 如果没有冒号,并且new_path_syntax为false,pytkdocs使用 旧的导入行为。
  • 如果没有冒号,并且new_path_syntax为真,pytkdocs使用新的 导入行为,因此认为路径指向模块。

!!!警告“new_path_syntax选项是临时的。” 它的存在只是为了简化到新路径语法的转换。在

Here is an idea of its life time:

- **version 0.9:** the default value for `new_path_syntax` is false.
  A pending deprecation warning is emmitted to tell users to switch to the new path syntax.
- **once version 0.10 is published:** [`mkdocstrings`](https://github.com/pawamoy/mkdocstrings)
  will log an MkDocs warning, making the builds fail
  when `new_path_syntax` is false and strict mode is enabled.
- **version 0.11:** the default value for `new_path_syntax` becomes true,
  and the warning becomes a deprecation warning.
- **version 0.13:** the `new_path_syntax` option is removed.

Please update your paths to use the new colon syntax as soon as possible.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java无法使用mainthread的上下文类加载器将web应用程序添加到@SpringBootApplication的内置Tomcat中   为什么Java递归调用不释放局部变量内存   java堆栈重设堆栈奇偶范围   java如何分组,然后使用java8流列出toMap   JavaEclipse在引导仪表板上展示了“安装本地云服务”如何解决这个问题?   java多个backpress跳过该活动   concat向流中添加两个Java8流或一个额外元素   java在ToolTipText上使用图标   调试java。jvisulavm中添加JMXConnection时的lang.SecurityException   java如何通过JavaFX中的单选按钮对最大可选复选框进行约束?   Spring引导上下文一直试图连接到JavaRMI服务器,但失败了   java Spring cache@cacheexecute匹配列表中的键?   java导出报告并使用JasperReports保存在某个位置   java发布构建失败   java在活动中隐藏特定视图   java定义由canvas2image生成的图像的属性,例如alt标记   java如何将POJO转换为JSON,反之亦然?