脏模型的sphinx扩展

dirty-models-sphinx的Python项目详细描述


Documentation StatusLatest VersionSupported Python versionsDevelopment StatusLicenseDownload formatSupported Python implementations

脏模型Sphinx扩展

Sphinx脏模型的扩展

关于

Sphinx帮助开发人员编写 使用Dirty Models的应用程序。

功能
  • 用实型描述每个字段。
  • Dirty Models上定义的所有字段类型都有文档记录。
  • 使用前缀(在字段前面使用#:的文档注释)或 每个字段的后缀(字段后的多行文档字符串)文档。
  • 文档read only字段。
  • 记录每个字段的默认值。
  • 这些字段上的文档日期时间格式。
  • 能够在模型签名中设置前缀文本。
  • 能够在字段签名中设置前缀文本。
  • 能够将字段类型记录为注释或字段指令。
  • 能够将模型添加到toctree
  • 能够将模型属性添加到toctree

更改日志

0.4.1版
  • 修复安装。
0.4.0版
  • 在timefield和datetimefield上记录默认时区。
  • 在DateTimeField上记录强制时区。
  • 小修小修。
  • 修复嵌套类。
  • 文档枚举字段。
0.3.0版
  • 添加了将模型添加到toctree的选项。
  • 添加了将模型属性添加到toctree的选项。
  • 添加了设置前缀模型签名的选项。
  • 添加了设置前缀模型字段签名的选项。
  • 添加了使用字段类型作为批注的选项。
  • 已将字段添加到索引。
  • 已将默认值标签更改为Default value

问题

  • 当模型属性位于toctree中时,LaTex手动文档类生成器失败。 这是因为它使用相同的ids创建了一个伪节,并在创建toctree后删除。 因此,乳胶构建器在尝试创建链接时找不到引用。

安装

只需使用pip即可安装:

$ pip install dirty-models-sphinx

并添加到项目的Sphinx扩展。

警告

autodoc需要扩展(包含在sphinx中)。

conf.py文件:

extensions=['sphinx.ext.autodoc','dirty_models_sphinx']

配置

可以使用conf.py文件中的配置修改Dirty Models Sphinx extension行为。

dirty_model_add_classes_to_toc

If it is ^{tt13}$ Dirty Models classes will be added to table of content. Default: ^{tt13}$.

dirty_model_add_attributes_to_toc

If it is ^{tt13}$ Dirty Models class attributes will be added to table of content, only if classes were added. Default: ^{tt13}$.

dirty_model_class_标签

It defines a prefix text for Dirty Model class signatures. It is possible to use ^{tt17}$ in order to avoid prefix. Default: ^{tt18}$.

dirty_model_property_标签

It defines a prefix text for Dirty Model class field signatures. It is possible to use ^{tt17}$ in order to avoid prefix. Default: ^{tt20}$.

dirty_model_field_type_as_annotation

If it is ^{tt13}$ field type will be shown as annotation to attribute. Otherwise, if it is ^{tt22}$, field type will be shown as field directive. Default: ^{tt13}$.

使用量

只需使用常规的自动文档管理器:

..automodule:: models
    :members::show-inheritance:

未来

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

推荐PyPI第三方库


热门话题
java将多个线程中的函数放入单个队列   数组在Java中,如何在不改变整数顺序的情况下找到整数组的顺序?   java控制器属于表示层?   java Apache Ivy和本地Maven repo如何处理使用Maven 3构建的快照   Java可与泛型类型进行比较   java这个表达式在泛型中是什么意思   JavaEclipse和TeamCity插件   java检测构造函数中的final是否为空   java如何在StanfordCoreNLP管道中同时使用词汇化和依赖性解析器?   java在AntUnit控制台日志中显示完整异常堆栈跟踪   lambda如何与Java 8供应商建立连锁关系   如何让GRPC的重试机制在Kubernetes集群中使用grpcjava工作?   如何使用openjdk:7 Docker映像和Gradle包装器避免“EC参数错误”?   java将集合映射扩展为一维映射新的“无法推断函数接口类型”