Skip to content

Commit c75c722

Browse files
authored
Merge pull request #196 from NeLy-EPFL/dev-v1.0.0
Merge release v1.0.0
2 parents f32302b + 1fb303a commit c75c722

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1666
-177
lines changed

.dockerignore

Lines changed: 449 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/black.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- uses: psf/black@stable
1111
with:
1212
version: "23.3.0"

.github/workflows/documentation.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ jobs:
66
docs:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
10-
- uses: actions/setup-python@v3
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
1111
with:
1212
python-version: '3.12'
1313
- name: Install dependencies
1414
run: |
1515
pip install sphinxcontrib-googleanalytics
16+
pip install "flyvision @ https://github.com/Nely-EPFL/flyvis/archive/refs/heads/main.zip"
1617
pip install -e ."[dev,examples]"
1718
pip install toolz
1819
- name: Sphinx build
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and test Docker image
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up Docker Buildx
13+
uses: docker/setup-buildx-action@v3
14+
15+
- name: Cache Docker layers
16+
uses: actions/cache@v4
17+
with:
18+
path: /tmp/.buildx-cache
19+
key: ${{ runner.os }}-buildx-${{ github.sha }}
20+
restore-keys: |
21+
${{ runner.os }}-buildx-
22+
23+
- name: Build Docker image
24+
run: docker build --tag flygym:temp .
25+
26+
- name: Run tests inside Docker container
27+
run: docker run --rm flygym:temp -c "pytest"
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
name: MuJoCo Tests
1+
name: Unit tests (full)
22

33
on: [push]
44

5-
# env:
6-
# LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libGLEW.so
7-
85
jobs:
96
build:
10-
11-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-24.04
128
strategy:
139
matrix:
1410
python-version: ["3.9", "3.10", "3.11", "3.12"]
15-
1611
steps:
17-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1813
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
2015
with:
2116
python-version: ${{ matrix.python-version }}
2217
- name: Set up renderer
2318
run: |
2419
sudo apt-get update
25-
sudo apt-get install -y libgl1-mesa-dev libgl1-mesa-glx libosmesa6-dev
20+
sudo apt-get install -y libegl1-mesa-dev
2621
echo "MUJOCO_GL=egl" >> $GITHUB_ENV
2722
echo "PYOPENGL_PLATFORM=egl" >> $GITHUB_ENV
2823
- name: Install dependencies
2924
run: |
3025
sudo apt-get install ffmpeg
3126
pip install --upgrade pip
3227
pip cache purge
33-
pip install -e ."[dev,examples]"
34-
pip install toolz
28+
pip install "flyvision @ https://github.com/Nely-EPFL/flyvis/archive/refs/heads/main.zip"
29+
pip install -e ".[dev,examples]"
3530
- name: Lint with ruff
3631
run: |
3732
# stop the build if there are Python syntax errors or undefined names

.github/workflows/tests_macos.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Unit tests (macOS)
2+
3+
on: [push]
4+
5+
env:
6+
SKIP_RENDERING: "true"
7+
8+
jobs:
9+
build:
10+
strategy:
11+
matrix:
12+
os: ["macos-13", "macos-latest"]
13+
python-version: ["3.12"]
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
pip install --upgrade pip
24+
pip cache purge
25+
pip install "flyvision @ https://github.com/Nely-EPFL/flyvis/archive/refs/heads/main.zip"
26+
pip install -e ".[dev,examples]"
27+
- name: Lint with ruff
28+
run: |
29+
# stop the build if there are Python syntax errors or undefined names
30+
ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py38 .
31+
- name: Test with pytest
32+
run: |
33+
python -m pytest
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Unit tests (Ubuntu 22.04)
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-22.04
8+
strategy:
9+
matrix:
10+
python-version: ["3.12"]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Set up renderer
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y libegl1-mesa-dev
21+
echo "MUJOCO_GL=egl" >> $GITHUB_ENV
22+
echo "PYOPENGL_PLATFORM=egl" >> $GITHUB_ENV
23+
- name: Install dependencies
24+
run: |
25+
sudo apt-get install ffmpeg
26+
pip install --upgrade pip
27+
pip cache purge
28+
pip install "flyvision @ https://github.com/Nely-EPFL/flyvis/archive/refs/heads/main.zip"
29+
pip install -e ".[dev,examples]"
30+
- name: Lint with ruff
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py38 .
34+
- name: Test with pytest
35+
run: |
36+
python -m pytest
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit tests (Windows)
2+
3+
on: [push]
4+
5+
env:
6+
SKIP_RENDERING: "true"
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.12"]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
pip install --upgrade pip
23+
pip cache purge
24+
pip install "flyvision @ https://github.com/nely-epfl/flyvis/archive/refs/heads/main.zip"
25+
pip install -e .[dev,examples]
26+
- name: Lint with ruff
27+
run: |
28+
# stop the build if there are Python syntax errors or undefined names
29+
ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py38 .
30+
- name: Test with pytest
31+
run: |
32+
python -m pytest

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM python:3.12-bookworm
2+
3+
# Set shell to bash (instead of sh)
4+
SHELL ["/bin/bash", "-c"]
5+
6+
# Change working directory
7+
ENV HOME /root
8+
WORKDIR $HOME/flygym
9+
10+
# Install system dependencies
11+
RUN apt update && \
12+
apt-get install -y libegl1-mesa-dev ffmpeg
13+
14+
# Set renderer
15+
ENV MUJOCO_GL=egl
16+
ENV PYOPENGL_PLATFORM=egl
17+
18+
# Copy flygym package to the container and install the package
19+
ADD . $HOME/flygym/
20+
21+
# Set up virtual environment and install dependencies
22+
RUN pip install "flyvision @ https://github.com/Nely-EPFL/flyvis/archive/refs/heads/main.zip" && \
23+
pip install -e ".[examples,dev]"
24+
25+
# Set entrypoint
26+
ENTRYPOINT ["/bin/bash"]

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
[![PyPI version](https://badge.fury.io/py/flygym.svg)](https://badge.fury.io/py/flygym)
1010
![Repo Size](https://img.shields.io/github/repo-size/NeLy-EPFL/flygym)
1111

12+
[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/nelyepfl/flygym)
13+
![Docker image size](https://img.shields.io/docker/image-size/nelyepfl/flygym/latest)
14+
15+
16+
1217
![overview_video](https://github.com/NeLy-EPFL/_media/blob/main/flygym/overview_video.gif?raw=true)
1318

1419
This repository contains the source code for FlyGym, the Python library for NeuroMechFly v2, a digital twin of the adult fruit fly *Drosophila* melanogaster that can see, smell, walk over challenging terrain, and interact with the environment (see our [NeuroMechFly v2 paper](https://www.biorxiv.org/content/10.1101/2023.09.18.556649)).
@@ -29,9 +34,10 @@ This package is developed at the [Neuroengineering Laboratory](https://www.epfl.
2934
In brief:
3035
```bash
3136
pip install "flygym"
37+
# or pip install "flygym[examples]" to install additional dependencies needed for examples
3238
```
3339

34-
See [our website](https://neuromechfly.org/installation.html) for details, especially if you plan to install FlyGym in the developer mode (i.e. if you plan to make changes to the code). Dependencies are specified in [`setup.py`](https://github.com/NeLy-EPFL/flygym/blob/main/setup.py) and will be installed automatically upon installation using pip. Installation should take no more than a few minutes. NeuroMechFly has been tested on Linux (Ubuntu 22.04.3) and macOS (13.5.2). All commits are tested automatically using the latest Ubuntu version on Python versions 3.9 through 3.12 (see [CI workflow](https://github.com/NeLy-EPFL/flygym/blob/main/.github/workflows/tests.yaml) for exact test specification). The PyPI version of the current release of FlyGym is indicated on the shield at the top of this page. No special or paid software is required to use FlyGym.
40+
Alternatively, we provide a [Docker image](https://hub.docker.com/r/nelyepfl/flygym). See [our website](https://neuromechfly.org/installation.html) for details, especially if you plan to install FlyGym in the developer mode (i.e. if you plan to make changes to the code). Dependencies are specified in [`setup.py`](https://github.com/NeLy-EPFL/flygym/blob/main/setup.py) and will be installed automatically upon installation using pip. Installation should take no more than a few minutes. The PyPI version of the current release of FlyGym is indicated on the shield at the top of this page. No special, paid software is required to use FlyGym.
3541

3642
## Demos
3743
See [our website](https://neuromechfly.org/tutorials/index.html) for tutorials, including expected outputs. For code blocks that take more than a few seconds to run, the running time (on a 2020 MacBook Pro with M1 processor running macOS 13.5.2) is indicated, typically in the form of a progress bar.

0 commit comments

Comments
 (0)