From 552d78fee942f9c61a68b3cbc21b015416dba8e2 Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Tue, 9 Aug 2022 10:42:51 -1000 Subject: [PATCH 1/3] Update create-release.yml Update GHA for pushing release to support tox. --- .github/workflows/create-release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 75cb5888e..462da1c97 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -38,11 +38,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish + - name: tox clean and build + run: | + tox -e clean + tox -e build + - name: tox publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + tox -e publish From 273d73befd872016060e7a40d61eaa22ce0e59dd Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Tue, 16 Aug 2022 10:02:16 -1000 Subject: [PATCH 2/3] Fix config server testing (#302) * * Fix json encoder on config server. * Add plate-solve as default and don't ignore config. * test-solve is only on gha. * Remove custom json decoder and parsing for config server. The encoding should happen by the client. * Codecov ignores server file. --- .github/codecov.yml | 2 ++ setup.cfg | 5 +---- src/panoptes/utils/config/client.py | 2 +- src/panoptes/utils/config/server.py | 26 ++++---------------------- 4 files changed, 8 insertions(+), 27 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..c9fb5bff0 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "src/panoptes/utils/config/server.py" diff --git a/setup.cfg b/setup.cfg index a54a97f11..36d6bb50d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -117,13 +117,10 @@ addopts = --cov-report xml:build/coverage.xml --strict-markers --doctest-modules - --test-databases memory --strict-markers -vv -ra - --ignore=tests/config/test_config_cli.py - --ignore=tests/config/test_config_server.py - --ignore=src/panoptes/utils/config + --test-databases memory norecursedirs = dist build diff --git a/src/panoptes/utils/config/client.py b/src/panoptes/utils/config/client.py index a55b98b40..545f1e8f9 100644 --- a/src/panoptes/utils/config/client.py +++ b/src/panoptes/utils/config/client.py @@ -45,7 +45,7 @@ def get_config(key=None, >>> # With no parsing, the raw string (including quotes) is returned. >>> get_config(key='location.horizon', parse=False) - '"30.0 deg"' + '"30 deg"' >>> get_config(key='cameras.devices[1].model') 'canon_gphoto2' diff --git a/src/panoptes/utils/config/server.py b/src/panoptes/utils/config/server.py index 1739f79f1..30d38e867 100644 --- a/src/panoptes/utils/config/server.py +++ b/src/panoptes/utils/config/server.py @@ -5,14 +5,12 @@ from flask import Flask from flask import jsonify from flask import request -from flask.json import JSONEncoder from gevent.pywsgi import WSGIServer from loguru import logger from scalpl import Cut from panoptes.utils.config.helpers import load_config from panoptes.utils.config.helpers import save_config -from panoptes.utils.serializers import serialize_object # Turn off noisy logging for Flask wsgi server. logging.getLogger('werkzeug').setLevel(logging.WARNING) @@ -21,24 +19,6 @@ app = Flask(__name__) -class CustomJSONEncoder(JSONEncoder): - - def default(self, obj): - """Custom serialization of each object. - - This method will call :func:`panoptes.utils.serializers.serialize_object` for - each object. - - Args: - obj (`any`): The object to serialize. - - """ - return serialize_object(obj) - - -app.json_provider_class = CustomJSONEncoder - - def config_server(config_file, host=None, port=None, @@ -72,7 +52,7 @@ def config_server(config_file, multiprocessing.Process: The process running the config server. """ logger.info(f'Starting panoptes-config-server with config_file={config_file!r}') - config = load_config(config_files=config_file, load_local=load_local) + config = load_config(config_files=config_file, load_local=load_local, parse=False) logger.success(f'Config server Loaded {len(config)} top-level items') # Add an entry to control running of the server. @@ -317,7 +297,9 @@ def reset_config(): if params['reset']: # Reload the config config = load_config(config_files=app.config['config_file'], - load_local=app.config['load_local']) + load_local=app.config['load_local'], + parse=params.get('parse', False) + ) # Add an entry to control running of the server. config['config_server'] = dict(running=True) app.config['POCS'] = config From 19c79b6c619f7594130c8b9cef4b967dde6ae446 Mon Sep 17 00:00:00 2001 From: Wilfred Gee Date: Tue, 16 Aug 2022 10:17:34 -1000 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b6f10d016..0bb9091ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,15 @@ Changelog ========= +0.2.38 - 2022-08-16 +------------------- + +Fixed +^^^^^ + +* Config server doesn't initially parse config file so it doesn't need to deserialize on response. + + 0.2.37 - 2022-08-09 -------------------