diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 9c1b696..7bdc321 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -72,7 +72,7 @@ jobs: run: | python -m twine check dist/* pwd - if [ -f dist/axiom-0.0.0.tar.gz ]; then + if [ -f dist/acs-axiom-0.0.0.tar.gz ]; then echo "INVALID VERSION NUMBER" exit 1 fi @@ -114,10 +114,10 @@ jobs: run: | python -m twine check dist/* pwd - if [ -f dist/axiom-0.0.0.tar.gz ]; then + if [ -f dist/acs-axiom-0.0.0.tar.gz ]; then echo "INVALID VERSION NUMBER" exit 1 fi - - name: Publish package distributions to TestPyPI + - name: Publish package distributions to PyPi uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index b83d9e6..9bb0020 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ **.DS_Store .eggs docs/build/ +dist diff --git a/axiom/__init__.py b/axiom/__init__.py index 9ae4d2c..3a84d3c 100644 --- a/axiom/__init__.py +++ b/axiom/__init__.py @@ -2,4 +2,4 @@ from importlib.metadata import version # Version handle -__version__ = version('axiom') +__version__ = version('acs-axiom') diff --git a/axiom/config.py b/axiom/config.py index 6e7c73b..f27dd8c 100644 --- a/axiom/config.py +++ b/axiom/config.py @@ -3,6 +3,7 @@ import json import pkgutil import pathlib +import axiom.utilities as au class Config(dict): @@ -67,34 +68,22 @@ def load(self, config_name, defaults_only=False): config_name (str): Configuration name, without file extension. defaults_only (bool, optional): Load only the defaults. Defaults to False. """ + + default_filepath = os.path.join(au.get_installed_data_root(), f'{config_name}.json') + user_filepath = os.path.join(au.get_user_data_root(), f'{config_name}.json') # Load any installed defaults, if they exists - try: - - defaults = pkgutil.get_data('axiom', f'data/{config_name}.json') - - if defaults is None: - defaults = dict() - else: - defaults = json.loads(defaults.decode('utf-8')) - - except FileNotFoundError: - - defaults = dict() + defaults = json.load(open(default_filepath, 'r')) - # Load only the defaults if defaults_only: self.update(defaults) return # Load the user configuration over the top - user_filepath = os.path.join(pathlib.Path.home(), f'.axiom/{config_name}.json') - if os.path.isfile(user_filepath): user = json.load(open(user_filepath, 'r')) defaults.update(user) - # Update the object dictionary self.update(defaults) diff --git a/setup.cfg b/setup.cfg index f23db5a..c6e98b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] -name = axiom -author = Ben Schreoter +name = acs-axiom +author = Ben Schroeter author_email = ben.schroeter@csiro.au license = MIT description = A prototype utility for validating/applying metadata templates for scientific data.