Skip to content

Commit

Permalink
Update versioneer, slim version handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Jul 18, 2024
1 parent bceb78d commit 437417e
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 1,941 deletions.
3 changes: 2 additions & 1 deletion bin/ForceBalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from builtins import range
import os, sys, re
import argparse
from forcebalance import __version__
from forcebalance.parser import parse_inputs
from forcebalance.forcefield import FF
from forcebalance.objective import Objective
Expand Down Expand Up @@ -60,7 +61,7 @@ def process(word, color):
return Answer

def main():
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)
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)
logostr = """
,'+++
,++++++. .:,,.
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
# Base depends
- python
- pip
- versioneer
# Testing
- pytest
- pytest-cov
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ USE_TABS = False
max-line-length = 119

[versioneer]
# Automatic version numbering scheme
VCS = git
style = pep440
versionfile_source = forcebalance/_version.py
versionfile_source = src/_version.py
versionfile_build = forcebalance/_version.py
tag_prefix = ''
tag_prefix = v
31 changes: 7 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,16 @@
import argparse
import subprocess

import versioneer

#===================================#
#| ForceBalance version number |#
#| Make sure to update the version |#
#| manually in : |#
#| |#
#| doc/header.tex |#
#| doc/api_header.tex |#
#| bin/ForceBalance.py |#
#===================================#
__version__ = "1.9.6"
# try:
# # use git to find current version
# git_describe = subprocess.check_output(["git", "describe", "--tags"]).strip()
# __version__ = re.sub('-g[0-9a-f]*$','',git_describe)
# except: pass

# The versioning file logic does not work.
# Commenting out until further notice.
# versioning_file = os.path.join(os.path.dirname(__file__), '.__version__')
# try:
# git_describe = subprocess.check_output(["git", "describe"]).strip()
# __version__ = re.sub('-g[0-9a-f]*$','',git_describe)
# with open(versioning_file, 'w') as fh:
# fh.write(__version__)
# #subprocess.call(["git", "add", ".__version__"])
# except:
# with open(versioning_file, 'r') as fh:
# __version__ = fh.read().strip()


# DCD file reading module
DCD = Extension('forcebalance/_dcdlib',
Expand Down Expand Up @@ -78,8 +59,6 @@
def buildKeywordDictionary(args):
setupKeywords = {}
setupKeywords["name"] = "forcebalance"
# Don't create a separate installed version number for every commit
setupKeywords["version"] = re.sub('-[0-9]*$','',__version__)
setupKeywords["author"] = "Lee-Ping Wang"
setupKeywords["author_email"] = "[email protected]"
setupKeywords["license"] = "BSD 2.0"
Expand Down Expand Up @@ -158,7 +137,11 @@ def main():
setupKeywords=buildKeywordDictionary(args)
## Run setuptools command.
## Refer to setup.cfg for customizing installation behavior
setup(**setupKeywords)
setup(
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
**setupKeywords,
)

if os.path.exists('build'):
shutil.rmtree('build')
Expand Down
8 changes: 2 additions & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,5 @@ def build_pid(self, pfld):
from . import parser, forcefield, optimizer, objective, output


# Handle versioneer
from ._version import get_versions
versions = get_versions()
__version__ = versions['version']
__git_revision__ = versions['full-revisionid']
del get_versions, versions
from . import _version
__version__ = _version.get_versions()['version']
Loading

0 comments on commit 437417e

Please sign in to comment.