Skip to content

Commit a203561

Browse files
authored
Merge pull request #18 from UM-ARM-Lab/mjcf_optional
make the dm_control dependency opt-in
2 parents 951d02a + 5aa6080 commit a203561

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
python -m pip install .
30+
python -m pip install .[test]
3131
python -m pip install flake8 pytest
3232
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3333
- name: Lint with flake8

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# Installation
77
```shell
88
pip install pytorch-kinematics
9+
# Alternatively, if you want to load from mujoco's XML format, use:
10+
pip install pytorch-kinematics[mujoco]
911
```
1012

1113
For development, clone repository somewhere, then `pip3 install -e .` to install in editable mode.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ dependencies = [# Optional
5757
'transformations',
5858
'absl-py',
5959
'lxml',
60-
'dm_control',
6160
'pyyaml'
6261
]
6362

@@ -70,7 +69,8 @@ dependencies = [# Optional
7069
# Similar to `dependencies` above, these must be valid existing
7170
# projects.
7271
[project.optional-dependencies] # Optional
73-
test = ["pytest"]
72+
test = ["pytest", "dm_control"]
73+
mujoco = ["dm_control"]
7474

7575
# List URLs that are relevant to your project
7676
#
@@ -102,4 +102,4 @@ test = ["pytest"]
102102
# These are the assumed default build requirements from pip:
103103
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
104104
requires = ["setuptools>=43.0.0", "wheel"]
105-
build-backend = "setuptools.build_meta"
105+
build-backend = "setuptools.build_meta"

src/pytorch_kinematics/mjcf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from dm_control import mjcf
2-
31
import pytorch_kinematics.transforms as tf
42
from . import chain
53
from . import frame
@@ -59,6 +57,8 @@ def build_chain_from_mjcf(data):
5957
chain.Chain
6058
Chain object created from MJCF.
6159
"""
60+
from dm_control import mjcf
61+
6262
model = mjcf.from_xml_string(data)
6363
root_body = model.worldbody.body[0]
6464
root_frame = frame.Frame(root_body.name + "_frame",

0 commit comments

Comments
 (0)