diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index a4304436..f1fea3f4 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -13,13 +13,13 @@ jobs: linting: runs-on: ubuntu-latest steps: - - uses: neuroinformatics-unit/actions/lint@v2.0.0 + - uses: neuroinformatics-unit/actions/lint@v2 manifest: name: Check Manifest runs-on: ubuntu-latest steps: - - uses: neuroinformatics-unit/actions/check_manifest@v2.0.0 + - uses: neuroinformatics-unit/actions/check_manifest@v2 test: needs: [linting, manifest] @@ -38,10 +38,10 @@ jobs: ~/.NeuralPlayground/* key: cached-test-data enableCrossOsArchive: true - - uses: neuroinformatics-unit/actions/test@v2.0.0 + - uses: neuroinformatics-unit/actions/test@v2 with: python-version: ${{ matrix.python-version }} - use-xvfb: true + secret-codecov-token: ${{ secrets.CODECOV_TOKEN }} build_sdist_wheels: name: Build source distribution @@ -49,18 +49,13 @@ jobs: if: github.event_name == 'push' && github.ref_type == 'tag' runs-on: ubuntu-latest steps: - - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2.0.0 + - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2 upload_all: name: Publish build distributions needs: [build_sdist_wheels] runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 + - uses: neuroinformatics-unit/actions/upload_pypi@v2 with: - name: artifact - path: dist - - uses: pypa/gh-action-pypi-publish@v1.5.0 - with: - user: __token__ - password: ${{ secrets.TWINE_API_KEY }} + secret-pypi-key: ${{ secrets.TWINE_API_KEY }} diff --git a/neuralplayground/arenas/discritized_objects.py b/neuralplayground/arenas/discritized_objects.py index ba1610ed..0720778f 100644 --- a/neuralplayground/arenas/discritized_objects.py +++ b/neuralplayground/arenas/discritized_objects.py @@ -406,7 +406,7 @@ def plot_trajectory( else: return ax - def render(self, history_length=30): + def render(self, history_length=30, display=True): """Render the environment live through iterations""" f, ax = plt.subplots(1, 1, figsize=(8, 6)) canvas = FigureCanvas(f) @@ -416,5 +416,6 @@ def render(self, history_length=30): image = np.frombuffer(canvas.tostring_rgb(), dtype="uint8") image = image.reshape(f.canvas.get_width_height()[::-1] + (3,)) print(image.shape) - cv2.imshow("2D_env", image) - cv2.waitKey(10) + if display: + cv2.imshow("2D_env", image) + cv2.waitKey(10) diff --git a/neuralplayground/arenas/simple2d.py b/neuralplayground/arenas/simple2d.py index 498dbe27..d98e421d 100644 --- a/neuralplayground/arenas/simple2d.py +++ b/neuralplayground/arenas/simple2d.py @@ -347,7 +347,7 @@ def plot_trajectory( else: return ax - def render(self, history_length=30): + def render(self, history_length=30, display=True): """Render the environment live through iterations as in OpenAI gym""" f, ax = plt.subplots(1, 1, figsize=(8, 6)) canvas = FigureCanvas(f) @@ -357,5 +357,6 @@ def render(self, history_length=30): image = np.frombuffer(canvas.tostring_rgb(), dtype="uint8") image = image.reshape(f.canvas.get_width_height()[::-1] + (3,)) print(image.shape) - cv2.imshow("2D_env", image) - cv2.waitKey(10) + if display: + cv2.imshow("2D_env", image) + cv2.waitKey(10) diff --git a/tests/arena_exp_test.py b/tests/arena_exp_test.py index 34f8c767..8eff4b6c 100644 --- a/tests/arena_exp_test.py +++ b/tests/arena_exp_test.py @@ -51,7 +51,7 @@ def test_agent_interaction(self, init_env): action = agent.act(obs) # Run environment for given action obs, state, reward = init_env[0].step(action) - init_env[0].render() + init_env[0].render(display=False) init_env[0].plot_trajectory()