Skip to content

Commit 437417e

Browse files
committed
Update versioneer, slim version handling
1 parent bceb78d commit 437417e

File tree

7 files changed

+262
-1941
lines changed

7 files changed

+262
-1941
lines changed

bin/ForceBalance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from builtins import range
99
import os, sys, re
1010
import argparse
11+
from forcebalance import __version__
1112
from forcebalance.parser import parse_inputs
1213
from forcebalance.forcefield import FF
1314
from forcebalance.objective import Objective
@@ -60,7 +61,7 @@ def process(word, color):
6061
return Answer
6162

6263
def main():
63-
printcool("Welcome to ForceBalance version 1.9.6! =D\nForce Field Optimization System\n\nAuthors:\nLee-Ping Wang\nYudong Qiu, Keri A. McKiernan\nJeffrey R. Wagner, Hyesu Jang, Simon Boothroyd\nArthur Vigil, Erik G. Brandt, John Stoppelman\nJohnny Israeli, Matt Thompson", ansi="1", bold=True, minwidth=64)
64+
printcool(f"Welcome to ForceBalance version {__version__}! =D\nForce Field Optimization System\n\nAuthors:\nLee-Ping Wang\nYudong Qiu, Keri A. McKiernan\nJeffrey R. Wagner, Hyesu Jang, Simon Boothroyd\nArthur Vigil, Erik G. Brandt, John Stoppelman\nJohnny Israeli, Matt Thompson", ansi="1", bold=True, minwidth=64)
6465
logostr = """
6566
,'+++
6667
,++++++. .:,,.

devtools/conda-envs/test_env.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ dependencies:
77
# Base depends
88
- python
99
- pip
10+
- versioneer
1011
# Testing
1112
- pytest
1213
- pytest-cov

setup.cfg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ USE_TABS = False
5353
max-line-length = 119
5454

5555
[versioneer]
56-
# Automatic version numbering scheme
5756
VCS = git
5857
style = pep440
59-
versionfile_source = forcebalance/_version.py
58+
versionfile_source = src/_version.py
6059
versionfile_build = forcebalance/_version.py
61-
tag_prefix = ''
60+
tag_prefix = v

setup.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,16 @@
1212
import argparse
1313
import subprocess
1414

15+
import versioneer
16+
1517
#===================================#
1618
#| ForceBalance version number |#
1719
#| Make sure to update the version |#
1820
#| manually in : |#
1921
#| |#
2022
#| doc/header.tex |#
2123
#| doc/api_header.tex |#
22-
#| bin/ForceBalance.py |#
2324
#===================================#
24-
__version__ = "1.9.6"
25-
# try:
26-
# # use git to find current version
27-
# git_describe = subprocess.check_output(["git", "describe", "--tags"]).strip()
28-
# __version__ = re.sub('-g[0-9a-f]*$','',git_describe)
29-
# except: pass
30-
31-
# The versioning file logic does not work.
32-
# Commenting out until further notice.
33-
# versioning_file = os.path.join(os.path.dirname(__file__), '.__version__')
34-
# try:
35-
# git_describe = subprocess.check_output(["git", "describe"]).strip()
36-
# __version__ = re.sub('-g[0-9a-f]*$','',git_describe)
37-
# with open(versioning_file, 'w') as fh:
38-
# fh.write(__version__)
39-
# #subprocess.call(["git", "add", ".__version__"])
40-
# except:
41-
# with open(versioning_file, 'r') as fh:
42-
# __version__ = fh.read().strip()
43-
4425

4526
# DCD file reading module
4627
DCD = Extension('forcebalance/_dcdlib',
@@ -78,8 +59,6 @@
7859
def buildKeywordDictionary(args):
7960
setupKeywords = {}
8061
setupKeywords["name"] = "forcebalance"
81-
# Don't create a separate installed version number for every commit
82-
setupKeywords["version"] = re.sub('-[0-9]*$','',__version__)
8362
setupKeywords["author"] = "Lee-Ping Wang"
8463
setupKeywords["author_email"] = "[email protected]"
8564
setupKeywords["license"] = "BSD 2.0"
@@ -158,7 +137,11 @@ def main():
158137
setupKeywords=buildKeywordDictionary(args)
159138
## Run setuptools command.
160139
## Refer to setup.cfg for customizing installation behavior
161-
setup(**setupKeywords)
140+
setup(
141+
version=versioneer.get_version(),
142+
cmdclass=versioneer.get_cmdclass(),
143+
**setupKeywords,
144+
)
162145

163146
if os.path.exists('build'):
164147
shutil.rmtree('build')

src/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,5 @@ def build_pid(self, pfld):
135135
from . import parser, forcefield, optimizer, objective, output
136136

137137

138-
# Handle versioneer
139-
from ._version import get_versions
140-
versions = get_versions()
141-
__version__ = versions['version']
142-
__git_revision__ = versions['full-revisionid']
143-
del get_versions, versions
138+
from . import _version
139+
__version__ = _version.get_versions()['version']

0 commit comments

Comments
 (0)