File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 7
7
* fix issue #114: stop trying to be smart for the sdist
8
8
and ensure its always correctly usign itself
9
9
* update trove classifiers
10
+ * fix issue #84: document using the installed package metadata for sphinx
10
11
11
12
v1.14.1
12
13
=======
Original file line number Diff line number Diff line change @@ -35,15 +35,32 @@ To use setuptools_scm just modify your project's setup.py file like this:
35
35
Programmatic usage
36
36
------------------
37
37
38
- In order to use setuptools_scm for sphinx config, assuming the sphinx conf
39
- is one directory deeper than the project's root, use:
38
+ In order to use setuptools_scm from code
39
+ that one directory deeper than the project's root, you can use:
40
40
41
41
.. code :: python
42
42
43
43
from setuptools_scm import get_version
44
44
version = get_version(root = ' ..' , relative_to = __file__ )
45
45
46
46
47
+ Usage from sphinx
48
+ -----------------
49
+
50
+ It is discouraged to use setuptools_scm from sphinx itself,
51
+ instead use ``pkg_resources `` after editable/real installation:
52
+
53
+ .. code :: python
54
+
55
+ from pkg_resources import get_distribution
56
+ release = pkg_resources(' myproject' ).version
57
+ # for the example take major/minor
58
+ version = ' .' .join(release.split(' .' )[:2 ])
59
+
60
+ The underlying reason is, that services like readthedocs sometimes change
61
+ the workingdirectory for good reasons and using the installed metadata prevents
62
+ using needless volatile data there.
63
+
47
64
Notable Plugins
48
65
----------------
49
66
You can’t perform that action at this time.
0 commit comments