Contributing to EnvPool

Build From Source

See Build From Source.

Adding A New Environment

See Add New Environment into EnvPool.

Lint Check

We use several tools to secure code quality, including

  • Python lint and formatting: ruff;

  • Type check: mypy;

  • C++ Google-style: cpplint, clang-format, clang-tidy;

  • Bazel build file: buildifier;

  • License: addlicense;

  • Documentation: doc8, Sphinx warning checks, and spelling.

The most common shortcuts are:

make ruff        # Python lint
make py-format   # Python formatting check
make docstyle    # doc8 + Sphinx warnings
make spelling    # Documentation spelling check

To automatically format the code, run:

make format

To check if everything conforms to the specification, run:

make lint

Test Locally

This command will run automatic tests in the main directory:

make bazel-test

To collect a merged Python + C/C++ LCOV report locally, run:

make bazel-coverage
python3 scripts/coverage_summary.py \
  --lcov bazel-out/_coverage/_coverage_report.dat \
  --genhtml-lcov-file coverage/lcov.genhtml.info \
  --repo-root "$PWD"
genhtml coverage/lcov.genhtml.info \
  --prefix "$PWD" \
  --branch-coverage \
  --legend \
  --output-directory coverage/site

The merged LCOV file is written to bazel-out/_coverage/_coverage_report.dat.

If you only want to debug for Bazel build:

# this is for general use case
make bazel-debug
# this is for a special folder "envpool/classic_control"
bazel build //envpool/classic_control --config=debug

If you’d like to run only a single test, for example, testing Mujoco integration; however, you don’t want to build other stuff such as OpenCV:

bazel test --test_output=all //envpool/mujoco:mujoco_gym_align_test --config=test
# or alternatively
cd bazel-bin/envpool/mujoco/mujoco_gym_align_test.runfiles/envpool/
./envpool/mujoco/mujoco_gym_align_test

Feel free to customize the command in Makefile!

Documentation

Documentations are written under the docs/ directory as ReStructuredText (.rst) files. index.rst is the main page. A Tutorial on ReStructuredText can be found here.

To compile documentation into the web page, run:

make doc

And the website is in http://localhost:8000