Skip to content

Commit

Permalink
Merge pull request #18 from UM-ARM-Lab/mjcf_optional
Browse files Browse the repository at this point in the history
make the dm_control dependency opt-in
  • Loading branch information
LemonPi authored Jul 14, 2023
2 parents 951d02a + 5aa6080 commit a203561
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install .[test]
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Installation
```shell
pip install pytorch-kinematics
# Alternatively, if you want to load from mujoco's XML format, use:
pip install pytorch-kinematics[mujoco]
```

For development, clone repository somewhere, then `pip3 install -e .` to install in editable mode.
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ dependencies = [# Optional
'transformations',
'absl-py',
'lxml',
'dm_control',
'pyyaml'
]

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

# List URLs that are relevant to your project
#
Expand Down Expand Up @@ -102,4 +102,4 @@ test = ["pytest"]
# These are the assumed default build requirements from pip:
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
4 changes: 2 additions & 2 deletions src/pytorch_kinematics/mjcf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from dm_control import mjcf

import pytorch_kinematics.transforms as tf
from . import chain
from . import frame
Expand Down Expand Up @@ -59,6 +57,8 @@ def build_chain_from_mjcf(data):
chain.Chain
Chain object created from MJCF.
"""
from dm_control import mjcf

model = mjcf.from_xml_string(data)
root_body = model.worldbody.body[0]
root_frame = frame.Frame(root_body.name + "_frame",
Expand Down

0 comments on commit a203561

Please sign in to comment.