diff --git a/.ci/tests/examples/run.sh b/.ci/tests/examples/run.sh index e21ed2b2c..aa498de5f 100755 --- a/.ci/tests/examples/run.sh +++ b/.ci/tests/examples/run.sh @@ -11,7 +11,7 @@ helper="$2" python -m venv ".$example" source ".$example/bin/activate" -".$example/bin/pip" install ./fedn/ fire +".$example/bin/pip" install . fire >&2 echo "Start FEDn" pushd "examples/$example" diff --git a/.devcontainer/bin/init_venv.sh b/.devcontainer/bin/init_venv.sh index c76670e77..89546305d 100755 --- a/.devcontainer/bin/init_venv.sh +++ b/.devcontainer/bin/init_venv.sh @@ -10,8 +10,5 @@ python -m venv .venv sphinx==4.4.0 \ sphinx_press_theme==0.8.0 \ sphinx-autobuild==2021.3.14 \ - autopep8==1.5.7 \ - isort==5.10.1 \ - flake8==4.0.1 \ sphinx_rtd_theme==0.5.2 -.venv/bin/pip install -e fedn \ No newline at end of file +.venv/bin/pip install -e . \ No newline at end of file diff --git a/.devcontainer/devcontainer.json.tpl b/.devcontainer/devcontainer.json.tpl index cdf276df5..29348f392 100644 --- a/.devcontainer/devcontainer.json.tpl +++ b/.devcontainer/devcontainer.json.tpl @@ -5,23 +5,26 @@ "remoteUser": "default", // "workspaceFolder": "/fedn", // "workspaceMount": "source=/path/to/fedn,target=/fedn,type=bind,consistency=default", - "extensions": [ - "ms-azuretools.vscode-docker", - "ms-python.python", - "exiasr.hadolint", - "yzhang.markdown-all-in-one", - "ms-python.isort" - ], + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-docker", + "ms-python.python", + "exiasr.hadolint", + "yzhang.markdown-all-in-one", + "charliermarsh.ruff" + ] + } + }, "mounts": [ - "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=default", + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=default" ], "runArgs": [ "--net=host" ], "build": { "args": { - "BASE_IMG": "python:3.9" + "BASE_IMG": "python:3.11" } } -} - +} \ No newline at end of file diff --git a/.dockerignore b/.dockerignore index 0df29e059..24f906be5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,4 +9,5 @@ docs/* **/.mnist-pytorch **/*.npz **/data -**/*.tgz \ No newline at end of file +**/*.tgz +dist \ No newline at end of file diff --git a/.github/workflows/code-checks.yaml b/.github/workflows/code-checks.yaml index 939be75e7..83d01d9ed 100644 --- a/.github/workflows/code-checks.yaml +++ b/.github/workflows/code-checks.yaml @@ -11,30 +11,9 @@ jobs: - name: init venv run: .devcontainer/bin/init_venv.sh - - - name: check Python imports - run: > - .venv/bin/isort . --check --diff - --skip .venv - --skip .mnist-keras - --skip .mnist-pytorch - --skip fedn_pb2.py - --skip fedn_pb2_grpc.py - - - name: check Python formatting - run: > - .venv/bin/autopep8 --recursive --diff - --exclude .venv - --exclude .mnist-keras - --exclude .mnist-pytorch - --exclude fedn_pb2.py - --exclude fedn_pb2_grpc.py - . - - name: run Python linter - run: > - .venv/bin/flake8 . - --exclude ".venv,.mnist-keras,.mnist-pytorch,fedn_pb2.py,fedn_pb2_grpc.py" + - name: Ruff Linting + uses: chartboost/ruff-action@v1 - name: check for floating imports run: > diff --git a/.github/workflows/push-to-pypi.yaml b/.github/workflows/push-to-pypi.yaml index 8cfa91cee..1b59835ad 100644 --- a/.github/workflows/push-to-pypi.yaml +++ b/.github/workflows/push-to-pypi.yaml @@ -16,15 +16,15 @@ jobs: - name: Install pypa/build run: python -m pip install build - working-directory: ./fedn + working-directory: ./ - name: Build package run: python -m build - working-directory: ./fedn + working-directory: ./ - name: Publish to Test PyPI uses: pypa/gh-action-pypi-publish@v1.8.14 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} - packages_dir: fedn/dist + packages_dir: ./dist diff --git a/.gitignore b/.gitignore index 0f4259be8..024116c3c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ __pycache__/ .Python build/ develop-eggs/ -#dist/ downloads/ eggs/ .eggs/ @@ -38,6 +37,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +dist # PyInstaller # Usually these files are written by a python script from a template diff --git a/Dockerfile b/Dockerfile index 5a7259859..49c91a3be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ARG GRPC_HEALTH_PROBE_VERSION="" ARG REQUIREMENTS="" # Add FEDn and default configs -COPY fedn /app/fedn +COPY . /app COPY config/settings-client.yaml.template /app/config/settings-client.yaml COPY config/settings-combiner.yaml.template /app/config/settings-combiner.yaml COPY config/settings-reducer.yaml.template /app/config/settings-reducer.yaml @@ -27,6 +27,8 @@ RUN if [ ! -z "$GRPC_HEALTH_PROBE_VERSION" ]; then \ echo "No grpc_health_probe version specified, skipping installation"; \ fi +# Setup working directory +WORKDIR /app # Create FEDn app directory SHELL ["/bin/bash", "-c"] @@ -39,7 +41,8 @@ RUN mkdir -p /app \ # Install FEDn and requirements && python -m venv /venv \ && /venv/bin/pip install --upgrade pip \ - && /venv/bin/pip install --no-cache-dir -e /app/fedn \ + && /venv/bin/pip install --no-cache-dir setuptools>=65 \ + && /venv/bin/pip install --no-cache-dir -e . \ && if [[ ! -z "$REQUIREMENTS" ]]; then \ /venv/bin/pip install --no-cache-dir -r /app/config/requirements.txt; \ fi \ @@ -47,6 +50,4 @@ RUN mkdir -p /app \ # Clean up && rm -r /app/config/requirements.txt -# Setup working directory -WORKDIR /app ENTRYPOINT [ "/venv/bin/fedn" ] \ No newline at end of file diff --git a/config/combiner-settings.override.yaml b/config/combiner-settings.override.yaml index fc3f86e12..bca431b7a 100644 --- a/config/combiner-settings.override.yaml +++ b/config/combiner-settings.override.yaml @@ -5,5 +5,5 @@ version: '3.3' services: combiner: volumes: - - ${HOST_REPO_DIR:-.}/fedn:/app/fedn + - ${HOST_REPO_DIR:-.}:/app - ${HOST_REPO_DIR:-.}/config/settings-combiner.yaml:/app/config/settings-combiner.yaml diff --git a/config/reducer-settings.override.yaml b/config/reducer-settings.override.yaml index af5ee5126..18e499f73 100644 --- a/config/reducer-settings.override.yaml +++ b/config/reducer-settings.override.yaml @@ -5,5 +5,5 @@ version: '3.3' services: reducer: volumes: - - ${HOST_REPO_DIR:-.}/fedn:/app/fedn + - ${HOST_REPO_DIR:-.}:/app - ${HOST_REPO_DIR:-.}/config/settings-reducer.yaml:/app/config/settings-reducer.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml index 3f2f3c2be..969626582 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -78,7 +78,7 @@ services: - mongo entrypoint: [ "sh", "-c" ] command: - - "/venv/bin/pip install --no-cache-dir -e /app/fedn && /venv/bin/python fedn/fedn/network/api/server.py" + - "/venv/bin/pip install --no-cache-dir -e . && /venv/bin/python fedn/network/api/server.py" ports: - 8092:8092 @@ -97,7 +97,7 @@ services: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn entrypoint: [ "sh", "-c" ] command: - - "/venv/bin/pip install --no-cache-dir -e /app/fedn && /venv/bin/fedn run combiner --init config/settings-combiner.yaml" + - "/venv/bin/pip install --no-cache-dir -e . && /venv/bin/fedn run combiner --init config/settings-combiner.yaml" ports: - 12080:12080 healthcheck: @@ -127,7 +127,7 @@ services: - ${HOST_REPO_DIR:-.}/fedn:/app/fedn entrypoint: [ "sh", "-c" ] command: - - "/venv/bin/pip install --no-cache-dir -e /app/fedn && /venv/bin/fedn run client --init config/settings-client.yaml" + - "/venv/bin/pip install --no-cache-dir -e . && /venv/bin/fedn run client --init config/settings-client.yaml" deploy: replicas: 0 depends_on: diff --git a/docs/quickstart.rst b/docs/quickstart.rst index cbff5ae5d..314d40c01 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -34,8 +34,8 @@ Clone the FEDn repository and install the package: .. code-block:: bash git clone https://github.com/scaleoutsystems/fedn.git - cd fedn/fedn - pip install -e . + cd fedn + pip install . It is recommended to use a virtual environment when installing FEDn. diff --git a/examples/flower-client/client/flwr_task.py b/examples/flower-client/client/flwr_task.py index dea53d9cc..6cd908177 100644 --- a/examples/flower-client/client/flwr_task.py +++ b/examples/flower-client/client/flwr_task.py @@ -5,9 +5,9 @@ from collections import OrderedDict import torch -import torch.nn as nn -import torch.nn.functional as F +import torch.nn.functional as F # noqa: N812 from flwr_datasets import FederatedDataset +from torch import nn from torch.utils.data import DataLoader from torchvision.transforms import Compose, Normalize, ToTensor from tqdm import tqdm @@ -42,9 +42,7 @@ def load_data(partition_id, num_clients): partition = fds.load_partition(partition_id) # Divide data on each node: 80% train, 20% test partition_train_test = partition.train_test_split(test_size=0.2) - pytorch_transforms = Compose( - [ToTensor(), Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))] - ) + pytorch_transforms = Compose([ToTensor(), Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) def apply_transforms(batch): """Apply transforms to the partition from FederatedDataset.""" diff --git a/examples/flower-client/client/python_env.yaml b/examples/flower-client/client/python_env.yaml index 4c5fc4668..984a2e96d 100644 --- a/examples/flower-client/client/python_env.yaml +++ b/examples/flower-client/client/python_env.yaml @@ -8,4 +8,4 @@ dependencies: - torchvision==0.17.1 - fire==0.3.1 - fedn[flower]==0.9.0 - - flwr-datasets[vision]==0.1.0 + - flwr-datasets[vision]==0.1.0 \ No newline at end of file diff --git a/examples/mnist-pytorch/docker-compose.override.yaml b/examples/mnist-pytorch/docker-compose.override.yaml index eb7aedc47..6b17b343d 100644 --- a/examples/mnist-pytorch/docker-compose.override.yaml +++ b/examples/mnist-pytorch/docker-compose.override.yaml @@ -3,8 +3,7 @@ version: '3.4' # Overriding requirements -x-env: - &defaults +x-env: &defaults GET_HOSTS_FROM: dns FEDN_PACKAGE_EXTRACT_DIR: package FEDN_NUM_DATA_SPLITS: 2 diff --git a/fedn/__init__.py b/fedn/__init__.py index 31be09d81..703eab7b2 100644 --- a/fedn/__init__.py +++ b/fedn/__init__.py @@ -1,3 +1,23 @@ -"""The fedn package.""" +import glob +import os +from os.path import basename, dirname, isfile + +from fedn.network.api.client import APIClient # flake8: noqa + + +modules = glob.glob(dirname(__file__) + "/fedn" + "/*.py") +__all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.endswith("__init__.py")] + + +_ROOT = os.path.abspath(os.path.dirname(__file__)) + + +def get_data(path): + """ + + :param path: + :return: + """ + return os.path.join(_ROOT, "data", path) diff --git a/fedn/fedn/common/__init__.py b/fedn/common/__init__.py similarity index 100% rename from fedn/fedn/common/__init__.py rename to fedn/common/__init__.py diff --git a/fedn/fedn/common/certificate/__init__.py b/fedn/common/certificate/__init__.py similarity index 100% rename from fedn/fedn/common/certificate/__init__.py rename to fedn/common/certificate/__init__.py diff --git a/fedn/fedn/common/certificate/certificate.py b/fedn/common/certificate/certificate.py similarity index 100% rename from fedn/fedn/common/certificate/certificate.py rename to fedn/common/certificate/certificate.py diff --git a/fedn/fedn/common/certificate/certificatemanager.py b/fedn/common/certificate/certificatemanager.py similarity index 100% rename from fedn/fedn/common/certificate/certificatemanager.py rename to fedn/common/certificate/certificatemanager.py diff --git a/fedn/fedn/common/config.py b/fedn/common/config.py similarity index 100% rename from fedn/fedn/common/config.py rename to fedn/common/config.py diff --git a/fedn/fedn/common/exceptions.py b/fedn/common/exceptions.py similarity index 100% rename from fedn/fedn/common/exceptions.py rename to fedn/common/exceptions.py diff --git a/fedn/fedn/common/log_config.py b/fedn/common/log_config.py similarity index 100% rename from fedn/fedn/common/log_config.py rename to fedn/common/log_config.py diff --git a/fedn/fedn/common/net/__init__.py b/fedn/common/net/__init__.py similarity index 100% rename from fedn/fedn/common/net/__init__.py rename to fedn/common/net/__init__.py diff --git a/fedn/fedn/__init__.py b/fedn/fedn/__init__.py deleted file mode 100644 index 7e3df239e..000000000 --- a/fedn/fedn/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -import glob -import os -from os.path import basename, dirname, isfile - -from fedn.network.api.client import APIClient - -# flake8: noqa - - -modules = glob.glob(dirname(__file__) + "/*.py") -__all__ = [basename(f)[:-3] for f in modules if isfile(f) - and not f.endswith('__init__.py')] - - -_ROOT = os.path.abspath(os.path.dirname(__file__)) - - -def get_data(path): - """ - - :param path: - :return: - """ - return os.path.join(_ROOT, 'data', path) diff --git a/fedn/fedn/network/__init__.py b/fedn/network/__init__.py similarity index 100% rename from fedn/fedn/network/__init__.py rename to fedn/network/__init__.py diff --git a/fedn/fedn/network/api/__init__.py b/fedn/network/api/__init__.py similarity index 100% rename from fedn/fedn/network/api/__init__.py rename to fedn/network/api/__init__.py diff --git a/fedn/fedn/network/api/auth.py b/fedn/network/api/auth.py similarity index 100% rename from fedn/fedn/network/api/auth.py rename to fedn/network/api/auth.py diff --git a/fedn/fedn/network/api/client.py b/fedn/network/api/client.py similarity index 100% rename from fedn/fedn/network/api/client.py rename to fedn/network/api/client.py diff --git a/fedn/fedn/network/api/interface.py b/fedn/network/api/interface.py similarity index 100% rename from fedn/fedn/network/api/interface.py rename to fedn/network/api/interface.py diff --git a/fedn/fedn/network/api/network.py b/fedn/network/api/network.py similarity index 100% rename from fedn/fedn/network/api/network.py rename to fedn/network/api/network.py diff --git a/fedn/fedn/network/api/server.py b/fedn/network/api/server.py similarity index 100% rename from fedn/fedn/network/api/server.py rename to fedn/network/api/server.py diff --git a/fedn/fedn/network/api/tests.py b/fedn/network/api/tests.py similarity index 100% rename from fedn/fedn/network/api/tests.py rename to fedn/network/api/tests.py diff --git a/fedn/fedn/network/api/v1/__init__.py b/fedn/network/api/v1/__init__.py similarity index 100% rename from fedn/fedn/network/api/v1/__init__.py rename to fedn/network/api/v1/__init__.py diff --git a/fedn/fedn/network/api/v1/client_routes.py b/fedn/network/api/v1/client_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/client_routes.py rename to fedn/network/api/v1/client_routes.py diff --git a/fedn/fedn/network/api/v1/combiner_routes.py b/fedn/network/api/v1/combiner_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/combiner_routes.py rename to fedn/network/api/v1/combiner_routes.py diff --git a/fedn/fedn/network/api/v1/model_routes.py b/fedn/network/api/v1/model_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/model_routes.py rename to fedn/network/api/v1/model_routes.py diff --git a/fedn/fedn/network/api/v1/package_routes.py b/fedn/network/api/v1/package_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/package_routes.py rename to fedn/network/api/v1/package_routes.py diff --git a/fedn/fedn/network/api/v1/round_routes.py b/fedn/network/api/v1/round_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/round_routes.py rename to fedn/network/api/v1/round_routes.py diff --git a/fedn/fedn/network/api/v1/session_routes.py b/fedn/network/api/v1/session_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/session_routes.py rename to fedn/network/api/v1/session_routes.py diff --git a/fedn/fedn/network/api/v1/shared.py b/fedn/network/api/v1/shared.py similarity index 100% rename from fedn/fedn/network/api/v1/shared.py rename to fedn/network/api/v1/shared.py diff --git a/fedn/fedn/network/api/v1/status_routes.py b/fedn/network/api/v1/status_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/status_routes.py rename to fedn/network/api/v1/status_routes.py diff --git a/fedn/fedn/network/api/v1/validation_routes.py b/fedn/network/api/v1/validation_routes.py similarity index 100% rename from fedn/fedn/network/api/v1/validation_routes.py rename to fedn/network/api/v1/validation_routes.py diff --git a/fedn/fedn/network/clients/__init__.py b/fedn/network/clients/__init__.py similarity index 100% rename from fedn/fedn/network/clients/__init__.py rename to fedn/network/clients/__init__.py diff --git a/fedn/fedn/network/clients/client.py b/fedn/network/clients/client.py similarity index 100% rename from fedn/fedn/network/clients/client.py rename to fedn/network/clients/client.py diff --git a/fedn/fedn/network/clients/connect.py b/fedn/network/clients/connect.py similarity index 100% rename from fedn/fedn/network/clients/connect.py rename to fedn/network/clients/connect.py diff --git a/fedn/fedn/network/clients/package.py b/fedn/network/clients/package.py similarity index 100% rename from fedn/fedn/network/clients/package.py rename to fedn/network/clients/package.py diff --git a/fedn/fedn/network/clients/state.py b/fedn/network/clients/state.py similarity index 100% rename from fedn/fedn/network/clients/state.py rename to fedn/network/clients/state.py diff --git a/fedn/fedn/network/clients/test_client.py b/fedn/network/clients/test_client.py similarity index 100% rename from fedn/fedn/network/clients/test_client.py rename to fedn/network/clients/test_client.py diff --git a/fedn/fedn/network/combiner/__init__.py b/fedn/network/combiner/__init__.py similarity index 100% rename from fedn/fedn/network/combiner/__init__.py rename to fedn/network/combiner/__init__.py diff --git a/fedn/fedn/network/combiner/aggregators/__init__.py b/fedn/network/combiner/aggregators/__init__.py similarity index 100% rename from fedn/fedn/network/combiner/aggregators/__init__.py rename to fedn/network/combiner/aggregators/__init__.py diff --git a/fedn/fedn/network/combiner/aggregators/aggregatorbase.py b/fedn/network/combiner/aggregators/aggregatorbase.py similarity index 100% rename from fedn/fedn/network/combiner/aggregators/aggregatorbase.py rename to fedn/network/combiner/aggregators/aggregatorbase.py diff --git a/fedn/fedn/network/combiner/aggregators/fedavg.py b/fedn/network/combiner/aggregators/fedavg.py similarity index 100% rename from fedn/fedn/network/combiner/aggregators/fedavg.py rename to fedn/network/combiner/aggregators/fedavg.py diff --git a/fedn/fedn/network/combiner/aggregators/fedopt.py b/fedn/network/combiner/aggregators/fedopt.py similarity index 100% rename from fedn/fedn/network/combiner/aggregators/fedopt.py rename to fedn/network/combiner/aggregators/fedopt.py diff --git a/fedn/fedn/network/combiner/aggregators/tests/test_fedavg.py b/fedn/network/combiner/aggregators/tests/test_fedavg.py similarity index 100% rename from fedn/fedn/network/combiner/aggregators/tests/test_fedavg.py rename to fedn/network/combiner/aggregators/tests/test_fedavg.py diff --git a/fedn/fedn/network/combiner/combiner.py b/fedn/network/combiner/combiner.py similarity index 100% rename from fedn/fedn/network/combiner/combiner.py rename to fedn/network/combiner/combiner.py diff --git a/fedn/fedn/network/combiner/combiner_tests.py b/fedn/network/combiner/combiner_tests.py similarity index 100% rename from fedn/fedn/network/combiner/combiner_tests.py rename to fedn/network/combiner/combiner_tests.py diff --git a/fedn/fedn/network/combiner/connect.py b/fedn/network/combiner/connect.py similarity index 100% rename from fedn/fedn/network/combiner/connect.py rename to fedn/network/combiner/connect.py diff --git a/fedn/fedn/network/combiner/interfaces.py b/fedn/network/combiner/interfaces.py similarity index 100% rename from fedn/fedn/network/combiner/interfaces.py rename to fedn/network/combiner/interfaces.py diff --git a/fedn/fedn/network/combiner/modelservice.py b/fedn/network/combiner/modelservice.py similarity index 100% rename from fedn/fedn/network/combiner/modelservice.py rename to fedn/network/combiner/modelservice.py diff --git a/fedn/fedn/network/combiner/roundhandler.py b/fedn/network/combiner/roundhandler.py similarity index 100% rename from fedn/fedn/network/combiner/roundhandler.py rename to fedn/network/combiner/roundhandler.py diff --git a/fedn/fedn/network/config.py b/fedn/network/config.py similarity index 100% rename from fedn/fedn/network/config.py rename to fedn/network/config.py diff --git a/fedn/fedn/network/controller/__init__.py b/fedn/network/controller/__init__.py similarity index 100% rename from fedn/fedn/network/controller/__init__.py rename to fedn/network/controller/__init__.py diff --git a/fedn/fedn/network/controller/control.py b/fedn/network/controller/control.py similarity index 100% rename from fedn/fedn/network/controller/control.py rename to fedn/network/controller/control.py diff --git a/fedn/fedn/network/controller/controlbase.py b/fedn/network/controller/controlbase.py similarity index 100% rename from fedn/fedn/network/controller/controlbase.py rename to fedn/network/controller/controlbase.py diff --git a/fedn/fedn/network/grpc/__init__.py b/fedn/network/grpc/__init__.py similarity index 100% rename from fedn/fedn/network/grpc/__init__.py rename to fedn/network/grpc/__init__.py diff --git a/fedn/fedn/network/grpc/auth.py b/fedn/network/grpc/auth.py similarity index 100% rename from fedn/fedn/network/grpc/auth.py rename to fedn/network/grpc/auth.py diff --git a/fedn/fedn/network/grpc/fedn.proto b/fedn/network/grpc/fedn.proto similarity index 100% rename from fedn/fedn/network/grpc/fedn.proto rename to fedn/network/grpc/fedn.proto diff --git a/fedn/fedn/network/grpc/fedn_pb2.py b/fedn/network/grpc/fedn_pb2.py similarity index 100% rename from fedn/fedn/network/grpc/fedn_pb2.py rename to fedn/network/grpc/fedn_pb2.py diff --git a/fedn/fedn/network/grpc/fedn_pb2_grpc.py b/fedn/network/grpc/fedn_pb2_grpc.py similarity index 100% rename from fedn/fedn/network/grpc/fedn_pb2_grpc.py rename to fedn/network/grpc/fedn_pb2_grpc.py diff --git a/fedn/fedn/network/grpc/server.py b/fedn/network/grpc/server.py similarity index 100% rename from fedn/fedn/network/grpc/server.py rename to fedn/network/grpc/server.py diff --git a/fedn/fedn/network/loadbalancer/__init__.py b/fedn/network/loadbalancer/__init__.py similarity index 100% rename from fedn/fedn/network/loadbalancer/__init__.py rename to fedn/network/loadbalancer/__init__.py diff --git a/fedn/fedn/network/loadbalancer/firstavailable.py b/fedn/network/loadbalancer/firstavailable.py similarity index 100% rename from fedn/fedn/network/loadbalancer/firstavailable.py rename to fedn/network/loadbalancer/firstavailable.py diff --git a/fedn/fedn/network/loadbalancer/leastpacked.py b/fedn/network/loadbalancer/leastpacked.py similarity index 100% rename from fedn/fedn/network/loadbalancer/leastpacked.py rename to fedn/network/loadbalancer/leastpacked.py diff --git a/fedn/fedn/network/loadbalancer/loadbalancerbase.py b/fedn/network/loadbalancer/loadbalancerbase.py similarity index 100% rename from fedn/fedn/network/loadbalancer/loadbalancerbase.py rename to fedn/network/loadbalancer/loadbalancerbase.py diff --git a/fedn/fedn/network/state.py b/fedn/network/state.py similarity index 100% rename from fedn/fedn/network/state.py rename to fedn/network/state.py diff --git a/fedn/fedn/network/storage/__init__.py b/fedn/network/storage/__init__.py similarity index 100% rename from fedn/fedn/network/storage/__init__.py rename to fedn/network/storage/__init__.py diff --git a/fedn/fedn/network/storage/models/__init__.py b/fedn/network/storage/models/__init__.py similarity index 100% rename from fedn/fedn/network/storage/models/__init__.py rename to fedn/network/storage/models/__init__.py diff --git a/fedn/fedn/network/storage/models/memorymodelstorage.py b/fedn/network/storage/models/memorymodelstorage.py similarity index 100% rename from fedn/fedn/network/storage/models/memorymodelstorage.py rename to fedn/network/storage/models/memorymodelstorage.py diff --git a/fedn/fedn/network/storage/models/modelstorage.py b/fedn/network/storage/models/modelstorage.py similarity index 100% rename from fedn/fedn/network/storage/models/modelstorage.py rename to fedn/network/storage/models/modelstorage.py diff --git a/fedn/fedn/network/storage/models/tempmodelstorage.py b/fedn/network/storage/models/tempmodelstorage.py similarity index 100% rename from fedn/fedn/network/storage/models/tempmodelstorage.py rename to fedn/network/storage/models/tempmodelstorage.py diff --git a/fedn/fedn/network/storage/models/tests/test_tempmodelstorage.py b/fedn/network/storage/models/tests/test_tempmodelstorage.py similarity index 100% rename from fedn/fedn/network/storage/models/tests/test_tempmodelstorage.py rename to fedn/network/storage/models/tests/test_tempmodelstorage.py diff --git a/fedn/fedn/network/storage/s3/__init__.py b/fedn/network/storage/s3/__init__.py similarity index 100% rename from fedn/fedn/network/storage/s3/__init__.py rename to fedn/network/storage/s3/__init__.py diff --git a/fedn/fedn/network/storage/s3/base.py b/fedn/network/storage/s3/base.py similarity index 100% rename from fedn/fedn/network/storage/s3/base.py rename to fedn/network/storage/s3/base.py diff --git a/fedn/fedn/network/storage/s3/miniorepository.py b/fedn/network/storage/s3/miniorepository.py similarity index 100% rename from fedn/fedn/network/storage/s3/miniorepository.py rename to fedn/network/storage/s3/miniorepository.py diff --git a/fedn/fedn/network/storage/s3/repository.py b/fedn/network/storage/s3/repository.py similarity index 100% rename from fedn/fedn/network/storage/s3/repository.py rename to fedn/network/storage/s3/repository.py diff --git a/fedn/fedn/network/storage/statestore/__init__.py b/fedn/network/storage/statestore/__init__.py similarity index 100% rename from fedn/fedn/network/storage/statestore/__init__.py rename to fedn/network/storage/statestore/__init__.py diff --git a/fedn/fedn/network/storage/statestore/mongostatestore.py b/fedn/network/storage/statestore/mongostatestore.py similarity index 100% rename from fedn/fedn/network/storage/statestore/mongostatestore.py rename to fedn/network/storage/statestore/mongostatestore.py diff --git a/fedn/fedn/network/storage/statestore/statestorebase.py b/fedn/network/storage/statestore/statestorebase.py similarity index 100% rename from fedn/fedn/network/storage/statestore/statestorebase.py rename to fedn/network/storage/statestore/statestorebase.py diff --git a/fedn/fedn/network/storage/statestore/stores/__init__.py b/fedn/network/storage/statestore/stores/__init__.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/__init__.py rename to fedn/network/storage/statestore/stores/__init__.py diff --git a/fedn/fedn/network/storage/statestore/stores/client_store.py b/fedn/network/storage/statestore/stores/client_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/client_store.py rename to fedn/network/storage/statestore/stores/client_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/combiner_store.py b/fedn/network/storage/statestore/stores/combiner_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/combiner_store.py rename to fedn/network/storage/statestore/stores/combiner_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/model_store.py b/fedn/network/storage/statestore/stores/model_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/model_store.py rename to fedn/network/storage/statestore/stores/model_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/package_store.py b/fedn/network/storage/statestore/stores/package_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/package_store.py rename to fedn/network/storage/statestore/stores/package_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/round_store.py b/fedn/network/storage/statestore/stores/round_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/round_store.py rename to fedn/network/storage/statestore/stores/round_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/session_store.py b/fedn/network/storage/statestore/stores/session_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/session_store.py rename to fedn/network/storage/statestore/stores/session_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/shared.py b/fedn/network/storage/statestore/stores/shared.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/shared.py rename to fedn/network/storage/statestore/stores/shared.py diff --git a/fedn/fedn/network/storage/statestore/stores/status_store.py b/fedn/network/storage/statestore/stores/status_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/status_store.py rename to fedn/network/storage/statestore/stores/status_store.py diff --git a/fedn/fedn/network/storage/statestore/stores/store.py b/fedn/network/storage/statestore/stores/store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/store.py rename to fedn/network/storage/statestore/stores/store.py diff --git a/fedn/fedn/network/storage/statestore/stores/validation_store.py b/fedn/network/storage/statestore/stores/validation_store.py similarity index 100% rename from fedn/fedn/network/storage/statestore/stores/validation_store.py rename to fedn/network/storage/statestore/stores/validation_store.py diff --git a/fedn/setup.py b/fedn/setup.py deleted file mode 100644 index 43322d795..000000000 --- a/fedn/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name='fedn', - version='0.9.1', - description="""Scaleout Federated Learning""", - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - author='Scaleout Systems AB', - author_email='contact@scaleoutsystems.com', - url='https://www.scaleoutsystems.com', - py_modules=['fedn'], - python_requires='>=3.8,<3.12', - install_requires=[ - "requests", - "urllib3>=1.26.4", - "minio", - "grpcio~=1.60.0", - "grpcio-tools~=1.60.0", - "numpy>=1.21.6", - "protobuf~=4.25.2", - "pymongo", - "Flask==3.0.3", - "pyjwt", - "pyopenssl", - "psutil", - "click==8.1.7", - "grpcio-health-checking~=1.60.0", - "pyyaml", - "plotly", - "virtualenv", - ], - extras_require={ - 'flower': ["flwr==1.8.0"] - }, - license='Apache 2.0', - zip_safe=False, - entry_points={ - 'console_scripts': ["fedn=cli:main"] - }, - keywords='Federated learning', - packages=find_packages(exclude=["tests", "tests.*"]), - classifiers=[ - 'Natural Language :: English', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ], -) diff --git a/fedn/fedn/utils/__init__.py b/fedn/utils/__init__.py similarity index 100% rename from fedn/fedn/utils/__init__.py rename to fedn/utils/__init__.py diff --git a/fedn/fedn/utils/checksum.py b/fedn/utils/checksum.py similarity index 100% rename from fedn/fedn/utils/checksum.py rename to fedn/utils/checksum.py diff --git a/fedn/fedn/utils/dispatcher.py b/fedn/utils/dispatcher.py similarity index 100% rename from fedn/fedn/utils/dispatcher.py rename to fedn/utils/dispatcher.py diff --git a/fedn/fedn/utils/environment.py b/fedn/utils/environment.py similarity index 95% rename from fedn/fedn/utils/environment.py rename to fedn/utils/environment.py index a147eba30..754cb5312 100644 --- a/fedn/fedn/utils/environment.py +++ b/fedn/utils/environment.py @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. """ + import yaml from fedn.utils import PYTHON_VERSION @@ -31,6 +32,8 @@ def __init__(self, name=None, python=None, build_dependencies=None, dependencies Represents environment information for FEDn compute packages. Args: + ---- + name: Name of environment. If unspecified, defaults to fedn_env python: Python version for the environment. If unspecified, defaults to the current Python version. build_dependencies: List of build dependencies for the environment that must @@ -38,15 +41,14 @@ def __init__(self, name=None, python=None, build_dependencies=None, dependencies defaults to an empty list. dependencies: List of dependencies for the environment. If unspecified, defaults to an empty list. + """ if name is not None and not isinstance(name, str): raise TypeError(f"`name` must be a string but got {type(name)}") if python is not None and not isinstance(python, str): raise TypeError(f"`python` must be a string but got {type(python)}") if build_dependencies is not None and not isinstance(build_dependencies, list): - raise TypeError( - f"`build_dependencies` must be a list but got {type(build_dependencies)}" - ) + raise TypeError(f"`build_dependencies` must be a list but got {type(build_dependencies)}") if dependencies is not None and not isinstance(dependencies, list): raise TypeError(f"`dependencies` must be a list but got {type(dependencies)}") self.name = name or "fedn_env" diff --git a/fedn/fedn/utils/flowercompat/__init__.py b/fedn/utils/flowercompat/__init__.py similarity index 100% rename from fedn/fedn/utils/flowercompat/__init__.py rename to fedn/utils/flowercompat/__init__.py diff --git a/fedn/fedn/utils/flowercompat/client_app_adapter.py b/fedn/utils/flowercompat/client_app_adapter.py similarity index 100% rename from fedn/fedn/utils/flowercompat/client_app_adapter.py rename to fedn/utils/flowercompat/client_app_adapter.py diff --git a/fedn/fedn/utils/helpers/__init__.py b/fedn/utils/helpers/__init__.py similarity index 100% rename from fedn/fedn/utils/helpers/__init__.py rename to fedn/utils/helpers/__init__.py diff --git a/fedn/fedn/utils/helpers/helperbase.py b/fedn/utils/helpers/helperbase.py similarity index 100% rename from fedn/fedn/utils/helpers/helperbase.py rename to fedn/utils/helpers/helperbase.py diff --git a/fedn/fedn/utils/helpers/helpers.py b/fedn/utils/helpers/helpers.py similarity index 100% rename from fedn/fedn/utils/helpers/helpers.py rename to fedn/utils/helpers/helpers.py diff --git a/fedn/fedn/utils/helpers/plugins/__init__.py b/fedn/utils/helpers/plugins/__init__.py similarity index 100% rename from fedn/fedn/utils/helpers/plugins/__init__.py rename to fedn/utils/helpers/plugins/__init__.py diff --git a/fedn/fedn/utils/helpers/plugins/androidhelper.py b/fedn/utils/helpers/plugins/androidhelper.py similarity index 100% rename from fedn/fedn/utils/helpers/plugins/androidhelper.py rename to fedn/utils/helpers/plugins/androidhelper.py diff --git a/fedn/fedn/utils/helpers/plugins/numpyhelper.py b/fedn/utils/helpers/plugins/numpyhelper.py similarity index 100% rename from fedn/fedn/utils/helpers/plugins/numpyhelper.py rename to fedn/utils/helpers/plugins/numpyhelper.py diff --git a/fedn/fedn/utils/helpers/tests/test_numpyhelper.py b/fedn/utils/helpers/tests/test_numpyhelper.py similarity index 100% rename from fedn/fedn/utils/helpers/tests/test_numpyhelper.py rename to fedn/utils/helpers/tests/test_numpyhelper.py diff --git a/fedn/fedn/utils/parameters.py b/fedn/utils/parameters.py similarity index 100% rename from fedn/fedn/utils/parameters.py rename to fedn/utils/parameters.py diff --git a/fedn/fedn/utils/plots.py b/fedn/utils/plots.py similarity index 100% rename from fedn/fedn/utils/plots.py rename to fedn/utils/plots.py diff --git a/fedn/fedn/utils/process.py b/fedn/utils/process.py similarity index 92% rename from fedn/fedn/utils/process.py rename to fedn/utils/process.py index 1fcda7a33..1a30fca2c 100644 --- a/fedn/fedn/utils/process.py +++ b/fedn/utils/process.py @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. """ + import os import subprocess import sys @@ -66,7 +67,9 @@ def _exec_cmd( """A convenience wrapper of `subprocess.Popen` for running a command from a Python script. Args: + ---- cmd: The command to run, as a string or a list of strings. + cwd: The current working directory. throw_on_error: If True, raises an Exception if the exit code of the program is nonzero. extra_env: Extra environment variables to be defined when running the child process. If this argument is specified, `kwargs` cannot contain `env`. @@ -81,6 +84,7 @@ def _exec_cmd( kwargs: Keyword arguments (except `text`) passed to `subprocess.Popen`. Returns: + ------- If synchronous is True, return a `subprocess.CompletedProcess` instance, otherwise return a Popen instance. @@ -94,9 +98,7 @@ def _exec_cmd( raise ValueError("`extra_env` and `env` cannot be used at the same time") if capture_output and stream_output: - raise ValueError( - "`capture_output=True` and `stream_output=True` cannot be specified at the same time" - ) + raise ValueError("`capture_output=True` and `stream_output=True` cannot be specified at the same time") env = env if extra_env is None else {**os.environ, **extra_env} @@ -108,9 +110,7 @@ def _exec_cmd( if capture_output or stream_output: if kwargs.get("stdout") is not None or kwargs.get("stderr") is not None: - raise ValueError( - "stdout and stderr arguments may not be used with capture_output or stream_output" - ) + raise ValueError("stdout and stderr arguments may not be used with capture_output or stream_output") kwargs["stdout"] = subprocess.PIPE if capture_output: kwargs["stderr"] = subprocess.PIPE @@ -148,7 +148,7 @@ def _exec_cmd( def run_process(args, cwd): - """ Run a process and log the output. + """Run a process and log the output. :param args: The arguments to the process. :type args: list @@ -156,11 +156,10 @@ def run_process(args, cwd): :type cwd: str :return: """ - status = subprocess.Popen( - args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + status = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) def check_io(): - """ Check stdout/stderr of the child process. + """Check stdout/stderr of the child process. :return: """ diff --git a/fedn/fedn/utils/tests/test_helpers.py b/fedn/utils/tests/test_helpers.py similarity index 100% rename from fedn/fedn/utils/tests/test_helpers.py rename to fedn/utils/tests/test_helpers.py diff --git a/fedn/fedn/utils/tests/test_parameters.py b/fedn/utils/tests/test_parameters.py similarity index 100% rename from fedn/fedn/utils/tests/test_parameters.py rename to fedn/utils/tests/test_parameters.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..0e149a442 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,203 @@ +lint = ["ruff>=0.0.220"] # MIT License (MIT) + +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "fedn" +version = "0.9.1" +description = "Scaleout Federated Learning" +authors = [{ name = "Scaleout Systems AB", email = "contact@scaleoutsystems.com" }] +readme = "README.rst" +license = {file="LICENSE"} +keywords = [ + "Scaleout", + "FEDn", + "Federated learning", + "FL", + "Machine learning", +] +classifiers = [ + "Natural Language :: English", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] + +requires-python = '>=3.8,<3.12' +dependencies = [ + "requests", + "urllib3>=1.26.4", + "minio", + "grpcio~=1.60.0", + "grpcio-tools~=1.60.0", + "numpy>=1.21.6", + "protobuf~=4.25.2", + "pymongo", + "Flask==3.0.3", + "pyjwt", + "pyopenssl", + "psutil", + "click==8.1.7", + "grpcio-health-checking~=1.60.0", + "pyyaml", + "plotly", + "virtualenv" +] + +[project.urls] +homepage = "https://www.scaleoutsystems.com" +documentation = 'https://fedn.readthedocs.io/en/stable/' +repository = 'https://github.com/scaleoutsystems/fedn' + +[project.scripts] +fedn = "fedn.cli.main:main" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["."] +include = ["fedn*"] +exclude = ["tests", "tests.*"] + +[tool.ruff] +line-length = 160 +target-version = "py39" + +lint.select = [ + "ANN", # flake8-annotations + "ARG", # flake8-unused-arguments + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "C90", # mccabe + "D", # pydocstyle + "DTZ", # flake8-datetimez + "E", # pycodestyle + "ERA", # eradicate + "F", # Pyflakes + "I", # isort + "N", # pep8-naming + "PD", # pandas-vet + "PGH", # pygrep-hooks + "PLC", # Pylint + "PLE", # Pylint + "PLR", # Pylint + "PLW", # Pylint + "PT", # flake8-pytest-style + "Q", # flake8-quotes + "RET", # flake8-return + "S", # flake8-bandit + "SIM", # flake8-simplify + "T20", # flake8-print + "TID", # flake8-tidy-imports + "W", # pycodestyle +] + +exclude = [ + ".venv", + ".mnist-keras", + ".mnist-pytorch", + "fedn_pb2.py", + "fedn_pb2_grpc.py", + ".ci", + "test*" +] + +lint.ignore = [ + "ANN002", # Missing type annotation for *args + "ANN003", # Missing type annotation for **kwargs + "ANN101", # Missing type annotation for self in method + "ANN102", # Missing type annotation for cls in method + "D107", # Missing docstring in __init__ + "D100", # Missing docstring in public module + "D200", # One-line docstring should fit on one line with quotes + "D210", # [*] No whitespaces allowed surrounding docstring text (100+) + "D104", # Missing docstring in public package (17) + "ANN201", # Missing return type annotation for public function (100+) + "ANN001", # Missing type annotation for function argument (100+) + "ANN205", # Missing return type annotation for staticmethod (5) + "RET504", # Unnecessary assignment to `settings` before `return` statement (72) + "ANN204", # Missing return type annotation for special method `__init__` (61) + "D205", # 1 blank line required between summary line and description (100+) + "T201", # `print` found (31) + "SIM401", # Use `result.get("id", "")` instead of an `if` block (72) + "D400", # First line should end with a period (80) + "D415", # First line should end with a period, question mark, or exclamation point (80) + "D101", # Missing docstring in public class (30) + "S113", # Probable use of requests call without timeout (41) + "PLR2004", # Magic value used in comparison, consider replacing `200` with a constant variable + "PLR0913", # Too many arguments in function definition (31) + "ANN202", # Missing return type annotation for private function (41) + "D102", # Missing docstring in public method (64) + "SIM108", # Use ternary operator instead of `if`-`else`-block (20) + "RET505", # Unnecessary `else` after `return` statement (20) + "D103", # Missing docstring in public function (17) + "D401", # First line of docstring should be in imperative mood (24) + "N818", # Exception name should be named with an Error suffix (8) + "B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling (11) + "DTZ005", # The use of `datetime.datetime.now()` without `tz` argument is not allowed (18) + "ANN206", # Missing return type annotation for classmethod (1) + "S110", # `try`-`except`-`pass` detected, consider logging the exception (3) + "N803", # Argument name should be lowercase + "N805", # First argument of a method should be named `self` + "SIM118", # Use `key in dict` instead of `key in dict.keys()` + "SIM115", # Use context handler for opening files + "B027", # `StateStoreBase.__init__` is an empty method in an abstract base class, but has no abstract decorator + "ARG002", # Unused method argument: `use_typing` + "B006", # Do not use mutable data structures for argument defaults + "PLR1714", # Consider merging multiple comparisons: `retcheck in ("", " ")`. Use a `set` if the elements are hashable. + "ERA001", # Found commented-out code + "N802", # Function name should be lowercase + "SIM116", # Use a dictionary instead of consecutive `if` statements + "RET503", # Missing explicit `return` at the end of function able to return non-`None` value + "PLR0911", # Too many return statements (11 > 6) + "C901", # function is too complex (11 > 10) + "ARG001", # Unused function argument: + "SIM105", # Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass` + "PLR0915", # Too many statements + "B024", # `Config` is an abstract base class, but it has no abstract methods + "RET506", # Unnecessary `else` after `raise` statement + "N804", # First argument of a class method should be named `cls` + "S202", # Uses of `tarfile.extractall()` + "PLR0912", # Too many branches + "SIM211", # Use `not ...` instead of `False if ... else True` + "D404", # First word of the docstring should not be "This" + "PLW0603", # Using the global statement to update ... is discouraged + "D105", # Missing docstring in magic method + "PLR1722", # Use `sys.exit()` instead of `exit` + "C408", # Unnecessary `dict` call (rewrite as a literal) + "DTZ007", # The use of `datetime.datetime.strptime()` without %z must be followed by `.replace(tzinfo=)` or `.astimezone()` + "PLW2901", # `for` loop variable `val` overwritten by assignment target + "D419", # Docstring is empty + "C416", # Unnecessary `list` comprehension (rewrite using `list()`) + "SIM102", # Use a single `if` statement instead of nested `if` statements + "PLW1508", # Invalid type for environment variable default; expected `str` or `None` + "B007", # Loop control variable `v` not used within loop body + "N806", # Variable `X_test` in function should be lowercase + + # solved with --fix + "Q000", # [*] Single quotes found but double quotes preferred + "D212", # [*] Multi-line docstring summary should start at the first line + "D213", # [*] Multi-line docstring summary should start at the second line + "D202", # [*] No blank lines allowed after function docstring (found 1) + "D209", # [*] Multi-line docstring closing quotes should be on a separate line + "D204", # [*] 1 blank line required after class docstring + "SIM114", # [*] Combine `if` branches using logical `or` operator + "D208", # [*] Docstring is over-indented + "I001", # [*] Import block is un-sorted or un-formatted + "SIM103", # Return the condition directly + "PLR5501", # [*] Use `elif` instead of `else` then `if`, to reduce indentation + "RET501", # [*] Do not explicitly `return None` in function if it is the only possible return value + "PLW0120", # [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents + + # unsafe? + "S104", # Possible binding to all interfaces + + "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes + "S501", # Probable use of `requests` call with `verify=False` disabling SSL certificate checks + "S108", # Probable insecure usage of temporary file or directory: "/tmp/models" + "S603", # `subprocess` call: check for execution of untrusted input +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b98843069..000000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -max-line-length = 160 - -[pep8] -max-line-length = 160 \ No newline at end of file