diff --git a/README.rst b/README.rst index 45856b84572ce710211002bcbee59a047d8f9a3d..3c864ad505b786db0f768e9800f59a7b1cd454d4 100644 --- a/README.rst +++ b/README.rst @@ -40,13 +40,13 @@ python. This can be activated with ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/ac A quick setup would be: -0. ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate`` -1. ``git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git && cd pycalibration`` - clone the offline calibration package from EuXFEL GitLab -2. ``pyenv shell 3.8.11`` - load required version of python -3. ``python3 -m venv .venv`` - create the virtual environment -4. ``source .venv/bin/activate`` - activate the virtual environment -5. ``python3 -m pip install --upgrade pip`` - upgrade version of pip -6. ``python3 -m pip install .`` - install the pycalibration package (add ``-e`` flag for editable development installation) +1. ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate`` +2. ``git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git && cd pycalibration`` - clone the offline calibration package from EuXFEL GitLab +3. ``pyenv shell 3.8.11`` - load required version of python +4. ``python3 -m venv .venv`` - create the virtual environment +5. ``source .venv/bin/activate`` - activate the virtual environment +6. ``python3 -m pip install --upgrade pip`` - upgrade version of pip +7. ``python3 -m pip install .`` - install the pycalibration package (add ``-e`` flag for editable development installation) Copy/paste script: @@ -71,11 +71,11 @@ will downgrade/upgrade your local packages, which may cause major issues and may **break your local environment**, it is highly recommended to use the venv installation method instead. -0. ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate`` -1. ``git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git && cd pycalibration`` - clone the offline calibration package from EuXFEL GitLab -2. ``pyenv shell 3.8.11`` - load required version of python -3. ``pip install .`` - install the pycalibration package (add ``-e`` flag for editable development installation) -4. ``export PATH=$HOME/.local/bin:$PATH`` - make sure that the home directory is in the PATH environment variable +1. ``source /gpfs/exfel/sw/calsoft/.pyenv/bin/activate`` +2. ``git clone ssh://git@git.xfel.eu:10022/detectors/pycalibration.git && cd pycalibration`` - clone the offline calibration package from EuXFEL GitLab +3. ``pyenv shell 3.8.11`` - load required version of python +4. ``pip install .`` - install the pycalibration package (add ``-e`` flag for editable development installation) +5. ``export PATH=$HOME/.local/bin:$PATH`` - make sure that the home directory is in the PATH environment variable Copy/paste script: diff --git a/pyproject.toml b/pyproject.toml index ac3b70bf15486cd8bf285f4acb60d60bda7ad460..9b2d60a2d97e513e063f6b3b742407686218413b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,9 @@ disable = "C0330, C0326" [tool.pylint.format] max-line-length = "88" +[flake8] +max-line-length = 88 + [tool.pytest.ini_options] norecursedirs = [ "legacy", diff --git a/src/cal_tools/mdc_config.py b/src/cal_tools/mdc_config.py index 0d646c132bba8b5deabb549f54dcd60548d3cb85..8022121c2dd1b2a28389b8a33d06ab8192adc06b 100644 --- a/src/cal_tools/mdc_config.py +++ b/src/cal_tools/mdc_config.py @@ -1,6 +1,7 @@ -from dynaconf import Dynaconf from pathlib import Path +from dynaconf import Dynaconf + config_dir = Path(__file__).parent.resolve() mdc_config = Dynaconf( diff --git a/src/cal_tools/mdc_config.yaml b/src/cal_tools/mdc_config.yaml index 18c4c957f4f99428c6f7eb4dbcdfa8911d62b55e..8bfc8ddf59830bd70eb0ade10b522fa4db8af224 100644 --- a/src/cal_tools/mdc_config.yaml +++ b/src/cal_tools/mdc_config.yaml @@ -5,4 +5,4 @@ scope: '' token-url: https://in.xfel.eu/metadata/oauth/token user-email: calibration@example.com user-id: '' -user-secret: '' \ No newline at end of file +user-secret: '' diff --git a/webservice/config/__init__.py b/webservice/config/__init__.py index 560ec4379bc363039c2267259016a016f07c9b8e..a1f3c85facbb98bbaa10422fd369128096daea6a 100644 --- a/webservice/config/__init__.py +++ b/webservice/config/__init__.py @@ -1,6 +1,7 @@ -from dynaconf import Dynaconf from pathlib import Path +from dynaconf import Dynaconf + config_dir = Path(__file__).parent.resolve() webservice = Dynaconf( diff --git a/webservice/listen_kafka.py b/webservice/listen_kafka.py index 32287a95baccf0b38191f84fce95355176659506..4fed88fce43ee721b3ed50f2298e28b070f6c790 100644 --- a/webservice/listen_kafka.py +++ b/webservice/listen_kafka.py @@ -3,6 +3,7 @@ import json from kafka import KafkaConsumer + from .config import webservice as config topic = config['kafka']['topic'] diff --git a/webservice/serve_overview.py b/webservice/serve_overview.py index 5df38aff8da9af13fe1d392c34c7a775a5076ae5..c1e0a4f903beec6ab633494638cb13eebd59a3fe 100644 --- a/webservice/serve_overview.py +++ b/webservice/serve_overview.py @@ -12,7 +12,7 @@ from typing import Optional import yaml from jinja2 import Template -from xfel_calibrate.settings import free_nodes_cmd, preempt_nodes_cmd, reservation +from xfel_calibrate.settings import free_nodes_cmd, preempt_nodes_cmd, reservation # noqa: E501 from .config import serve_overview as config @@ -344,7 +344,8 @@ class RequestHandler(BaseHTTPRequestHandler): self.wfile.write(bytes(message, "utf8")) return -def run(config_file = Optional[str]): + +def run(config_file: Optional[str] = None): if config_file is not None: config.configure(includes_for_dynaconf=[Path(config_file).absolute()]) diff --git a/webservice/webservice.py b/webservice/webservice.py index bf61dec8ca490077fde84cf6fb9953d3e36c1230..c2907d30d18ba216f651d3a247ed65df4a5ea767 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -1126,10 +1126,10 @@ def main(argv: Optional[List[str]] = None): description='Start the calibration webservice' ) parser.add_argument('--config-file', type=str, default=None) - parser.add_argument('--mode', type=str, default="sim", choices=['sim', 'prod']) + parser.add_argument('--mode', type=str, default="sim", choices=['sim', 'prod']) # noqa parser.add_argument('--log-file', type=str, default='./web.log') parser.add_argument( - '--log-level', type=str, default="INFO", choices=['INFO', 'DEBUG', 'ERROR'] + '--log-level', type=str, default="INFO", choices=['INFO', 'DEBUG', 'ERROR'] # noqa ) args = parser.parse_args(argv) @@ -1141,7 +1141,7 @@ def main(argv: Optional[List[str]] = None): if config_file is not None: config.configure(includes_for_dynaconf=[Path(config_file).absolute()]) - fmt = '%(asctime)s - %(name)s - %(levelname)s - [%(filename)s:%(lineno)d] %(message)s' + fmt = '%(asctime)s - %(name)s - %(levelname)s - [%(filename)s:%(lineno)d] %(message)s' # noqa logging.basicConfig( filename=log_file, level=getattr(logging, log_level),