Skip to content

Commit b84d2a4

Browse files
Merge pull request #125 from majuscule/suggest-write-to-configuration
suggest pkg_resources for distribution Version attributes
2 parents ffef94d + 9c727ee commit b84d2a4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ To use setuptools_scm just modify your project's setup.py file like this:
3131
...,
3232
)
3333
34+
3. Access the version number in your package via :code:`pkg_resources`
35+
36+
E.g. (`PEP-0396 <https://www.python.org/dev/peps/pep-0396>`_):
37+
38+
.. code:: python
39+
40+
from pkg_resources import get_distribution, DistributionNotFound
41+
try:
42+
__version__ = get_distribution(__name__).version
43+
except DistributionNotFound:
44+
# package is not installed
45+
pass
46+
3447
3548
Programmatic usage
3649
------------------

0 commit comments

Comments
 (0)