Skip to content

Commit

Permalink
Updated setup.py so that it writes the version on install
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain MARIE committed Jul 6, 2019
1 parent 978b110 commit b53ab64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ site/
# travis CI
github_travis_rsa*
reports
**/_version.py # so that version.py can be pushed by travis without problem
**/_version.py # so that version.py can not be pushed by mistake
9 changes: 8 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ If your project uses git, I would recommend the following:
from os.path import join, pardir, dirname
__version__ = get_version(join(dirname(__file__), pardir))

* when you wish to create releases, after git-tagging your project and before publishing it, do
* then, EITHER in `setup.py`:

setup(
...
use_scm_version={'write_to': '%s/_version.py' % DISTNAME}
)

* OR when you wish to create releases, after git-tagging your project and before publishing it, do

from setuptools_scm import get_version
get_version('.', write_to='<pkg_name>/_version.py')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
dependency_links=DEPENDENCY_LINKS,

# we're using git
use_scm_version=True, # this provides the version + adds the date if local non-commited changes.
use_scm_version={'write_to': '%s/_version.py' % DISTNAME}, # this provides the version + adds the date if local non-commited changes.
# use_scm_version={'local_scheme':'dirty-tag'}, # this provides the version + adds '+dirty' if local non-commited changes.
setup_requires=SETUP_REQUIRES,

Expand Down

0 comments on commit b53ab64

Please sign in to comment.