自动化科学出版手稿机器人
manubot的Python项目详细描述
manubot的python实用程序:手稿,开放和自动
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/上找到。
安装
如果您使用manubot
python包作为手稿存储库的一部分,则通过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生成的文件保存到输出目录。
一种常见的设置是为包含content
和output
目录的手稿创建一个目录。
在此设置下,您可以使用:
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 --bib2json
utility转换为csl json。
手动引用的标准引用是从csl jsonid
或note
字段推断出来的。
如果未提供前缀,例如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 --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
来运行测试套件。
您还可以使用manubot
cli来构建手稿。
例如:
manubot process \ --content-directory=tests/manuscripts/example/content \ --output-directory=tests/manuscripts/example/output \ --log-level=DEBUG
发布说明
这个节仅与项目维护人员相关。
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和开源软件(参见^{
我们要感谢贡献者和资助者的支持,使这个项目成为可能。 具体来说,曼努博特的发展得到了以下方面的财政支持:
- 在Grant G-2018-11163到@dhimmel中的alfred p.sloan基金会。
- 在Grant GBMF4552到@cgreene中的gordon&betty moore基金会(@DDD-Moore)。