Skip to content

Commit

Permalink
more standard versioning system
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclifford1 committed Feb 14, 2024
1 parent 62dd95b commit 4f6866f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-package-to-PyPi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- uses: actions/checkout@v3
- name: Get Version numbers
run: |
echo "code_version=$(cat VERSION)" >> $GITHUB_ENV
echo "pypi_version=$(./scripts/get_latest_package_version.py)" >> $GITHUB_ENV
echo "code_version=$(./scripts/get_local_version.py)" >> $GITHUB_ENV
echo "pypi_version=$(./scripts/get_latest_pypi_version.py)" >> $GITHUB_ENV
- name: Set up Python
if: env.code_version != env.pypi_version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Get Version numbers
run: |
echo "code_version=$(cat VERSION)" >> $GITHUB_ENV
echo "pypi_version=$(./scripts/get_latest_package_version.py)" >> $GITHUB_ENV
echo "pypi_version=$(./scripts/get_latest_pypi_version.py)" >> $GITHUB_ENV
# - name: Setup Python
# uses: actions/setup-python@v3
Expand Down
8 changes: 8 additions & 0 deletions IQM_Vis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@
from IQM_Vis.metrics import IQMs
from IQM_Vis import examples
from IQM_Vis import utils

# Changing the version number will action GitHub to push to PyPi the new version
__version__ = '0.2.5.86'

# Author info
__author__ = "Matt Clifford"
__email__ = "[email protected]"
__license__ = "BSD 3-Clause"
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

File renamed without changes.
9 changes: 9 additions & 0 deletions scripts/get_local_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/python3

'''Get the current version of package locally (github repo)'''
# Author: Matt Clifford <[email protected]>
import IQM_Vis


if __name__ == '__main__':
print(IQM_Vis.__version__)
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# Author: Matt Clifford <[email protected]>
from setuptools import setup, find_packages
import IQM_Vis


def get_long_description():
with open('README.md', encoding="utf-8") as f:
text = f.read()
return text

def get_version():
with open('VERSION') as f:
ver = f.read()
while ver[-1] == '\n':
ver = ver[:-1]
return ver

def dependencies_from_file(file_path):
required = []
Expand All @@ -25,8 +20,9 @@ def dependencies_from_file(file_path):
required.append(l_c)
return required


setup(name='IQM-Vis',
version=get_version(),
version=IQM_Vis.__version__,
packages=find_packages(),
include_package_data=True,
install_requires=dependencies_from_file('./requirements.txt'),
Expand Down

0 comments on commit 4f6866f

Please sign in to comment.