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 77* fix issue #114: stop trying to be smart for the sdist
88 and ensure its always correctly usign itself
99* update trove classifiers
10+ * fix issue #84: document using the installed package metadata for sphinx
1011
1112v1.14.1
1213=======
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:
3535 Programmatic usage
3636------------------
3737
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:
4040
4141.. code :: python
4242
4343 from setuptools_scm import get_version
4444 version = get_version(root = ' ..' , relative_to = __file__ )
4545
4646
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+
4764Notable Plugins
4865----------------
4966
You can’t perform that action at this time.
0 commit comments