diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 6153423..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[bumpversion] -commit = False -tag = False -tag_name = {new_version} -tag_message = Bump version to {new_version} -message = Bump version to {new_version} -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P[a-z]+)(?P\d+))? -serialize = - {major}.{minor}.{patch} - -[bumpversion:file:setup.py] -search = version='0.0.0' -replace = version='{new_version}' - -[bumpversion:file:aodntools/__init__.py] -search = __version__ = '0.0.0' -replace = __version__ = '{new_version}' - diff --git a/.gitignore b/.gitignore index eef60be..2eddfd8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ # PyCharm settings .idea + +.hypothesis +build +aodntools/_version.py diff --git a/README.md b/README.md index 745c25b..0d6ca4e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,22 @@ # python-aodntools + ![python-aodntools](https://github.com/aodn/python-aodntools/workflows/python-aodntools/badge.svg) + [![coverage](https://codecov.io/gh/aodn/python-aodntools/branch/master/graph/badge.svg)](https://codecov.io/gh/aodn/python-aodntools) Repository for code used to generate and manipulate data products for the Australia Ocean Data Network (AODN). Sub-packages: + * [ncwriter](aodntools/ncwriter): a basic tool for creating netCDF files based on templates. * [timeseries_products](aodntools/timeseries_products): code used to generate value-added data products for time-series data. See the [examples](examples) folder for sample scripts demonstrating usage of these packages. + +## Versioning + +New versions can be published using the GitHub release tool. + ## Licensing -This project is licensed under the terms of the GNU GPLv3 license. \ No newline at end of file + +This project is licensed under the terms of the GNU GPLv3 license. diff --git a/aodntools/__init__.py b/aodntools/__init__.py index c57bfd5..368d1d8 100644 --- a/aodntools/__init__.py +++ b/aodntools/__init__.py @@ -1 +1,4 @@ -__version__ = '0.0.0' +try: + from ._version import version as __version__ +except ImportError: + __version__ = "Unknown/Not Installed" diff --git a/bumpversion.sh b/bumpversion.sh deleted file mode 100755 index 4559475..0000000 --- a/bumpversion.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -main() { - git fetch --prune origin "+refs/tags/*:refs/tags/*" - OLD_VERSION=$(git tag -l '*.*.*' --sort=-version:refname | head -n 1) - NEW_VERSION=$(bump2version --current-version $OLD_VERSION --list --tag --commit --allow-dirty patch | grep -oP '^new_version=\K.*$') - git push origin tag $NEW_VERSION - - exit 0 -} - -main "$@" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ef3da94 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] + +[tool.setuptools_scm] +write_to = "aodntools/_version.py" diff --git a/setup.py b/setup.py index be44198..4e3c9c0 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,8 @@ ] TESTS_REQUIRE = [ - 'pytest' + 'pytest', + 'setuptools_scm' ] EXTRAS_REQUIRE = {