readthedocs 和 setuptools scm 版本错误 [英] readthedocs and setuptools scm version wrong

查看:76
本文介绍了readthedocs 和 setuptools scm 版本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了一个包以使用 setuptools_scm,发现 readthedocs 中的版本号错误.

I have a package I just updated to use setuptools_scm and found the version number is wrong in readthedocs.

http://sshuttle.readthedocs.org/en/v0.77/ 显示:

Version: 0.78.dev0+ng083293e.d20160304

然而由于版本 083293e 有 0.77 标签,版本字符串应该只是 0.77

however as version 083293e has the 0.77 tag, the version string should be just 0.77

看起来 readthedocs 可能在构建之前对我的源代码进行了更改.

It looks like readthedocs might be making changes to my source code before building.

我查看了 readthedocs 构建日志,它似乎在某个阶段 (0.77) 具有正确的版本,但这是在构建文档之前.

I have looked at the readthedocs build logs, and it seems to have the correct version at one stage (0.77), however this is before it builds the documentation.

Processing dependencies for sshuttle==0.77
Finished processing dependencies for sshuttle==0.77

构建日志在构建文档时没有提及版本.

The build logs don't mention the version while building the documentation.

有没有可能解决这个问题?

Is it possible to solve this?

谢谢

推荐答案

setuptools_scm 的文档现在有 关于如何使用 readthedocs 的说明:

The documentation for setuptools_scm now has instructions on how to use with readthedocs:

不鼓励使用 sphinx 本身的 setuptools_scm,而是在可编辑/真实安装后使用 pkg_resources:

It is discouraged to use setuptools_scm from sphinx itself, instead use pkg_resources after editable/real installation:

from pkg_resources import get_distribution
release = get_distribution('myproject').version
# for example take major/minor
version = '.'.join(release.split('.')[:2])

根本原因是,像 readthedocs 这样的服务有时会更改工作目录很好的理由和使用已安装的元数据可以防止使用不必要的那里的易失数据.

The underlying reason is, that services like readthedocs sometimes change the workingdirectory for good reasons and using the installed metadata prevents using needless volatile data there.

这避免了根据其他答案使用 kluges 的需要.

This avoids the need to use kluges as per the other answer.

这篇关于readthedocs 和 setuptools scm 版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆