Skip to content

Commit

Permalink
support Python 3.12 / pin panda3d==1.10.14 / pin ray>=2.24.0 (mirror #…
Browse files Browse the repository at this point in the history
…720) (#811)

* support Python 3.12

* add matrix support for 3.12 python tests

* add workflow_dispatch

* pin ray 2.24.0

* pin ray=2.24.0

* cancel ray from requirement

* cancel ray installation from workflow

* remove useless distutil code

* redo the merge with main

* fix doc coverage

* sync ipynb to this repo

---------

Co-authored-by: BBBmau <alvarez.mauriciotm@gmail.com>
Co-authored-by: Quanyi Li <quanyili0057@gmail.com>
  • Loading branch information
3 people authored Feb 8, 2025
1 parent 420a78d commit bb0a0c6
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 44 deletions.
105 changes: 71 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
code_style:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Check code style
run: |
pip install "yapf==0.30.0"
Expand All @@ -37,16 +41,19 @@ jobs:
docstring_coverage:
if: github.event_name != 'push' || github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Install software
run: |
sudo apt update && sudo apt install -y bc
pip install "docstr-coverage==2.3.0"
pip install "docstr-coverage"
- name: Get post-PR docstring coverage
run: |
after=$(docstr-coverage --percentage-only --fail-under 0 metadrive/)
Expand All @@ -72,12 +79,15 @@ jobs:
test_functionality:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -86,18 +96,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_functionality
test_environment:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -107,18 +120,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_env
test_policy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -127,18 +143,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_policy
test_component:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -147,18 +166,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_component
test_export_record_scenario:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -167,18 +189,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_export_record_scenario
test_sensor_pipeline:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Prepare OpenGL
run: |
sudo apt-get -y install xvfb
Expand All @@ -191,18 +216,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_sensors/
test_examples:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Prepare OpenGL
run: |
sudo apt-get -y install xvfb
Expand All @@ -217,18 +245,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_examples
test_policy_windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Blackbox tests
run: |
pip install cython
Expand All @@ -237,18 +268,21 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pytest --cov=./ --cov-config=.coveragerc --cov-report=xml -sv tests/test_policy
test_ipynb:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Prepare OpenGL
run: |
sudo apt-get -y install xvfb
Expand All @@ -261,7 +295,7 @@ jobs:
python -m metadrive.pull_asset
pip install pytest
pip install pytest-cov
pip install ray
cd metadrive/
pip install nbmake pytest-xdist
mkdir ./tests/test_ipynb
Expand All @@ -270,12 +304,15 @@ jobs:
test_doc_code:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.9 / 3.12
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Prepare OpenGL
run: |
sudo apt-get -y install xvfb
Expand Down
11 changes: 11 additions & 0 deletions documentation/source/debug_mode.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@
"In addition to the errors raised from MetaDrive, sometimes the game engine, Panda3D, will throw errors and warnings about the rendering service. To enable the logging of Panda3D, set `env_config[\"debug_panda3d\"]=True`. Besides, you can turn on Panda3D's profiler via `env_config[\"pstats\"]=True` and launch the `pstats` in the terminal. It can be used to analyze your program in terms of the time consumed for different functions like rendering, physics and so on, which is very useful if you are developing some graphics related features."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b3e2ecb",
"metadata": {},
"outputs": [],
"source": [
"# launch pstats (bash)\n",
"!pstats"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
5 changes: 0 additions & 5 deletions metadrive/tests/test_functionality/test_read_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import os.path
from distutils.dir_util import copy_tree

from metadrive.engine.asset_loader import AssetLoader
from metadrive.envs.scenario_env import ScenarioEnv
from metadrive.scenario.scenario_description import ScenarioDescription
from metadrive.scenario.utils import read_dataset_summary, read_scenario_data


Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def is_win():
return sys.platform == "win32"


assert sys.version_info.major == 3 and sys.version_info.minor >= 6 and sys.version_info.minor < 12, \
"python version >= 3.6, <3.12 is required"
assert sys.version_info.major == 3 and sys.version_info.minor >= 6 and sys.version_info.minor < 13, \
"python version >= 3.6, <3.13 is required"

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
Expand All @@ -45,8 +45,7 @@ def is_win():
"yapf",
"tqdm",
"progressbar",
# "panda3d==1.10.8",
"panda3d==1.10.13",
"panda3d==1.10.14",
"panda3d-gltf==0.13", # 0.14 will bring some problems
"pillow",
"opencv-python",
Expand Down Expand Up @@ -82,7 +81,7 @@ def is_win():

setup(
name="metadrive-simulator",
python_requires='>=3.6, <3.12', # do version check with assert
python_requires='>=3.6, <3.13', # do version check with assert
version=VERSION,
description="An open-ended driving simulator with infinite scenes",
url="https://github.com/metadriverse/metadrive",
Expand Down

0 comments on commit bb0a0c6

Please sign in to comment.