From 6537e80f85c86c025b4264148db28cfe0ef654e6 Mon Sep 17 00:00:00 2001 From: Gabryel Reyes Date: Tue, 10 Sep 2024 09:54:53 +0200 Subject: [PATCH 1/3] Use a requirements file to cache pip --- .github/workflows/main.yml | 8 ++++---- .github/workflows/requirements.txt | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/requirements.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0652cd0..a0fcdcba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -209,11 +209,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: .github/workflows/requirements.txt - name: Install dependencies - run: | - pip install pylint "git+https://github.com/gabryelreyes/SerialMuxProt.git#egg=SerialMuxProt&subdirectory=python/SerialMuxProt" + run: pip install -r .github/workflows/requirements.txt - name: Analysing the code with pylint - run: | - pylint ./webots/controllers/*/*.py + run: pylint ./webots/controllers/*/*.py diff --git a/.github/workflows/requirements.txt b/.github/workflows/requirements.txt new file mode 100644 index 00000000..26d7047e --- /dev/null +++ b/.github/workflows/requirements.txt @@ -0,0 +1,10 @@ +platformio==6.1.15 +numpy==1.26.4 +tensorflow==2.10.0 +tensorflow-probability==0.15.0 +keras==2.10.0 +matplotlib==3.9.0 +pandas==2.2.2 +pytest==8.3.2 +pylint==3.2.7 +git+https://github.com/gabryelreyes/SerialMuxProt.git#egg=SerialMuxProt&subdirectory=python/SerialMuxProt \ No newline at end of file From 51bb66a117999369b35dba6383de22ea5561d00f Mon Sep 17 00:00:00 2001 From: Gabryel Reyes Date: Tue, 10 Sep 2024 10:01:19 +0200 Subject: [PATCH 2/3] Limit python linting to 3.9 and 3.11 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a0fcdcba..b258d3eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -198,7 +198,7 @@ jobs: needs: intro strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10"] # Steps represent a sequence of tasks that will be executed as part of the job. steps: From 6463269d19525fdab440c78c6b5733430d96870f Mon Sep 17 00:00:00 2001 From: Gabryel Reyes Date: Tue, 10 Sep 2024 10:04:46 +0200 Subject: [PATCH 3/3] Remove disable pylint import errors --- webots/controllers/RL_Supervisor/agent.py | 10 +++++----- webots/controllers/RL_Supervisor/networks.py | 10 +++++----- webots/controllers/RL_Supervisor/plotting.py | 4 ++-- webots/controllers/RL_Supervisor/trajectory_buffer.py | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/webots/controllers/RL_Supervisor/agent.py b/webots/controllers/RL_Supervisor/agent.py index b65dc0df..45769c84 100644 --- a/webots/controllers/RL_Supervisor/agent.py +++ b/webots/controllers/RL_Supervisor/agent.py @@ -31,11 +31,11 @@ import csv import os import struct -import numpy as np # pylint: disable=import-error -import tensorflow as tf # pylint: disable=import-error -import tensorflow_probability as tfp # pylint: disable=import-error -from trajectory_buffer import Memory -from networks import Models +import numpy as np +import tensorflow as tf +import tensorflow_probability as tfp +from trajectory_buffer import Memory +from networks import Models ################################################################################ # Variables diff --git a/webots/controllers/RL_Supervisor/networks.py b/webots/controllers/RL_Supervisor/networks.py index 7895eb76..064995f0 100644 --- a/webots/controllers/RL_Supervisor/networks.py +++ b/webots/controllers/RL_Supervisor/networks.py @@ -28,11 +28,11 @@ # Imports ################################################################################ -import tensorflow as tf # pylint: disable=import-error -import tensorflow_probability as tfp # pylint: disable=import-error -from tensorflow import keras # pylint: disable=import-error -from keras import layers # pylint: disable=import-error -from keras.regularizers import l2 # pylint: disable=import-error +import tensorflow as tf +import tensorflow_probability as tfp +from tensorflow import keras +from keras import layers +from keras.regularizers import l2 ################################################################################ # Variables diff --git a/webots/controllers/RL_Supervisor/plotting.py b/webots/controllers/RL_Supervisor/plotting.py index 8efb92b3..2b62ba90 100644 --- a/webots/controllers/RL_Supervisor/plotting.py +++ b/webots/controllers/RL_Supervisor/plotting.py @@ -6,8 +6,8 @@ # mini-batch steps. # Imports -import matplotlib.pyplot as plt # pylint: disable=import-error -import pandas as pd # pylint: disable=import-error +import matplotlib.pyplot as plt +import pandas as pd # Define the path to the CSV file LOG_FILE = "logs/training_logs.csv" diff --git a/webots/controllers/RL_Supervisor/trajectory_buffer.py b/webots/controllers/RL_Supervisor/trajectory_buffer.py index 3a244b28..f39824d8 100644 --- a/webots/controllers/RL_Supervisor/trajectory_buffer.py +++ b/webots/controllers/RL_Supervisor/trajectory_buffer.py @@ -28,7 +28,7 @@ # Imports ################################################################################ -import numpy as np # pylint: disable=import-error +import numpy as np ################################################################################ # Variables