Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use updated upload_pypi action #101

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -38,29 +38,24 @@ 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
needs: [test]
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/[email protected]
with:
user: __token__
password: ${{ secrets.TWINE_API_KEY }}
secret-pypi-key: ${{ secrets.TWINE_API_KEY }}
7 changes: 4 additions & 3 deletions neuralplayground/arenas/discritized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
7 changes: 4 additions & 3 deletions neuralplayground/arenas/simple2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
2 changes: 1 addition & 1 deletion tests/arena_exp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
Loading