自动化科学出版手稿机器人

manubot的Python项目详细描述


manubot的python实用程序:手稿,开放和自动

Travis Linux Build StatusAppVeyor Windows Build Status

Manubot是下一代学术出版的工作流程和工具集。 这个存储库包含一个python包,其中包含几个与manubot相关的实用程序,如下面的usage section所述。

命令行界面检索并格式化用户提供的持久标识符(如dois或pubmed id)的书目元数据。 命令行界面为pandoc的使用准备学术手稿。 基于Rootstock template的manubot手稿使用manubot process命令自动生成手稿的几个方面。 有关更多信息,请参见rootstock的manuscript usage guide

注意: 如果您想通过编辑现有手稿来体验MufBoT,请参阅^ {A7}。 如果要创建新的手稿,请参见https://github.com/manubot/rootstock

要引用Manubot项目或了解其设计和历史的更多信息,请参见:

Open collaborative writing with Manubot
Daniel S. Himmelstein, Vincent Rubinetti, David R. Slochower, Dongbo Hu, Venkat S. Malladi, Casey S. Greene, Anthony Gitter
PLOS Computational Biology (2019-06-24) https://doi.org/c7np
DOI: 10.1371/journal.pcbi.1007128 · PMID: 31233491

手稿的manubot版本可以在https://greenelab.github.io/meta-review/上找到。

安装

如果您使用manubotpython包作为手稿存储库的一部分,则通过rootstock的environment specification来处理此包的安装。 对于其他用例,可以通过pip安装此包。

安装最新版本from PyPI

pip install --upgrade manubot

或者从GitHub上的源代码安装,使用提交哈希指定的版本:

COMMIT=d2160151e52750895571079a6e257beb6e0b1278
pip install --upgrade git+https://github.com/manubot/manubot@$COMMIT
如果出现当前参数,则可以使用该参数进行更新。

用法

安装python包将创建manubot命令行程序。 以下是根据manubot --help提供的使用信息:

usage: manubot [-h] [--version] {process,cite} ...

Manubot: the manuscript bot for scholarly writing

optional arguments:
  -h, --help      show this help message and exit
  --version       show program's version number and exit

subcommands:
  All operations are done through subcommands:

  {process,cite}
    process       process manuscript content
    cite          citation to CSL command line utility

请注意,所有操作都是通过以下子命令完成的。

过程

manubot process程序是使用manubot的主要接口。 有两个必需的参数:--content-directory--output-directory,它们指定到内容和输出目录的相应路径。 内容目录存储手稿源文件。 由manubot生成的文件保存到输出目录。

一种常见的设置是为包含contentoutput目录的手稿创建一个目录。 在此设置下,您可以使用:

manubot process \
  --content-directory=content \
  --output-directory=output

有关所有命令行参数的文档,请参见manubot process --help

usage: manubot process [-h] --content-directory CONTENT_DIRECTORY
                       --output-directory OUTPUT_DIRECTORY
                       [--template-variables-path TEMPLATE_VARIABLES_PATH]
                       [--cache-directory CACHE_DIRECTORY]
                       [--clear-requests-cache]
                       [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]

Process manuscript content to create outputs for Pandoc consumption. Performs
bibliographic processing and templating.

optional arguments:
  -h, --help            show this help message and exit
  --content-directory CONTENT_DIRECTORY
                        Directory where manuscript content files are located.
  --output-directory OUTPUT_DIRECTORY
                        Directory to output files generated by this script.
  --template-variables-path TEMPLATE_VARIABLES_PATH
                        Path or URL of a JSON file containing template
                        variables for jinja2. Specify this argument multiple
                        times to read multiple files. Variables can be applied
                        to a namespace (i.e. stored under a dictionary key)
                        like `--template-variables-
                        path=namespace=path_or_url`. Namespaces must match the
                        regex `[a-zA-Z_][a-zA-Z0-9_]*`.
  --cache-directory CACHE_DIRECTORY
                        Custom cache directory. If not specified, caches to
                        output-directory.
  --clear-requests-cache
  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the logging level for stderr logging

手册参考

manubot能够依赖用户提供的引用元数据,而不是生成它。 manubot process在内容目录中搜索包含与glob匹配的手动提供的引用元数据的文件。 如果手动引用文件名以.json.yaml结尾,则假定它包含csl数据(即引用样式语言json)。 否则,将从扩展名推断格式并使用pandoc-citeproc --bib2jsonutility转换为csl json。 手动引用的标准引用是从csl jsonidnote字段推断出来的。 如果未提供前缀,例如doi:url:raw:,则会自动添加raw:前缀。 如果多个手动引用文件加载同一标准引文id的元数据,则根据文件名降序分配优先级。

引用

manubot cite是一个命令行实用程序,用于为一个或多个引文创建CSL JSON items。 引文应采用source:identifier格式。 例如,以下示例为四个引用生成csl json:

manubot cite doi:10.1098/rsif.2017.0387 pmid:29424689 pmcid:PMC5640425 arxiv:1806.05726

下面的terminal recording演示了manubot cite的主要功能:

manubot cite demonstration

其他使用信息可从manubot cite --help

usage: manubot cite [-h] [--render] [--csl CSL]
                    [--format {plain,markdown,docx,html,jats}]
                    [--output OUTPUT] [--allow-invalid-csl-data]
                    [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                    citations [citations ...]

Retrieve bibliographic metadata for one or more citation identifiers.

positional arguments:
  citations             One or more (space separated) citations to produce CSL
                        for.

optional arguments:
  -h, --help            show this help message and exit
  --render              Whether to render CSL Data into a formatted reference
                        list using Pandoc. Pandoc version 2.0 or higher is
                        required for complete support of available output
                        formats.
  --csl CSL             When --render, specify an XML CSL definition to style
                        references (i.e. Pandoc's --csl option). Defaults to
                        Manubot's style.
  --format {plain,markdown,docx,html,jats}
                        When --render, format to use for output file. If not
                        specified, attempt to infer this from filename
                        extension. Otherwise, default to plain.
  --output OUTPUT       Specify a file to write output, otherwise default to
                        stdout.
  --allow-invalid-csl-data
                        Allow CSL Items that do not conform to the JSON
                        Schema. Skips CSL pruning.
  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the logging level for stderr logging

开发

使用以下工具创建开发环境:

conda create --name manubot-dev --channel conda-forge \python=3.6 jinja2 pandas pytest pandoc
conda activate manubot-dev  # assumes conda >= 4.4
pip install --editable .

在这个环境中,使用pytest来运行测试套件。 您还可以使用manubotcli来构建手稿。 例如:

manubot process \
  --content-directory=tests/manuscripts/example/content \
  --output-directory=tests/manuscripts/example/output \
  --log-level=DEBUG

发布说明

PyPI

这个节仅与项目维护人员相关。 travis ci部署用于将版本上载到PyPI。 要创建新版本,请在^{}中插入__version__。 然后运行以下命令:

TAG=v`python setup.py --version`# Commit updated __version__ info
git add manubot/__init__.py release-notes/$TAG.md
git commit --message="Prepare $TAG release"
git push
# Create & push tag (assuming upstream is the manubot organization remote)
git tag --annotate $TAG --file=release-notes/$TAG.md
git push upstream $TAG

目标和确认

我们的目标是建立学术基础设施,鼓励开放科学和协助可再生性。 因此,我们希望manubot软件和哲学能被学术界和商业界广泛采用。 因此,manubot是免费的/libre和开源软件(参见^{})。

我们要感谢贡献者和资助者的支持,使这个项目成为可能。 具体来说,曼努博特的发展得到了以下方面的财政支持:

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

推荐PyPI第三方库


热门话题
java如何使用Spring和JSF向客户端授予临时权限   java除了Array/ArrayList之外,还有其他保存矩阵元素的方法吗   java BeanValidation不适用于单选按钮   通过java程序连接到配置单元数据库时出错   java如何使用maven解决二级依赖关系   JfreeChart/Java中带有图例的数据表   合并数组时发生java运行时错误   安全性如何在JavaEE中保护WebSocket端点?   java有没有一种方法可以使用insert方法为树插入值   java编程“静态”的另一种方式:代码可以吗?   java阅读文本文件时如何跳过3行   %04X在C中的含义以及如何在java中编写   java我如何验证一个方法不是仅在一个测试范围内对模拟调用的?   java如何在mac中使用启动appium desktop 1.6.1。球棒   仅匹配最多10位小数的java正则表达式