Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
69e0288
Fix release auditwheel install on Python 3.13
Trinkle23897 Mar 22, 2026
085d3a2
Stage release workflow PR trigger config
Trinkle23897 Mar 22, 2026
80eb230
move
Trinkle23897 Mar 22, 2026
1276ecd
Install Perl zlib module for release builds
Trinkle23897 Mar 22, 2026
dcdecff
Disable unsupported nasm stdbit detection
Trinkle23897 Mar 22, 2026
ca83b24
Stub CUDA runtime for CPU-only release builds
Trinkle23897 Mar 22, 2026
692471e
Disable unsupported nasm strlcpy detection
Trinkle23897 Mar 22, 2026
ed3ada1
Force SDL2 install libdir for release builds
Trinkle23897 Mar 22, 2026
529bc3d
Force OpenCV install libdir for release builds
Trinkle23897 Mar 22, 2026
c780a03
Build release wheels with matrix Python versions
Trinkle23897 Mar 22, 2026
8056ec1
Use multi-version pip repositories for release wheels
Trinkle23897 Mar 22, 2026
aa53da9
Let MuJoCo XML patches override upstream assets
Trinkle23897 Mar 22, 2026
106c646
Use unique MuJoCo XML patches in release wheels
Trinkle23897 Mar 22, 2026
2720f8d
Prefer envpool MuJoCo XML patches at runtime
Trinkle23897 Mar 22, 2026
91395df
Use per-version release artifacts
Trinkle23897 Mar 22, 2026
6eea9bb
Revert "Use per-version release artifacts"
Trinkle23897 Mar 22, 2026
864adce
Stage per-version release artifact workflow config
Trinkle23897 Mar 22, 2026
e418755
Work around release artifact conflicts
Trinkle23897 Mar 22, 2026
ae6b301
Use Python module auditwheel entrypoint
Trinkle23897 Mar 22, 2026
ce4ba5c
Stage release artifact action updates
Trinkle23897 Mar 22, 2026
f7e2b20
Use per-version release wheel artifacts
Trinkle23897 Mar 22, 2026
bb84e33
move
Trinkle23897 Mar 22, 2026
6b5588d
Restage release workflow updates
Trinkle23897 Mar 22, 2026
6003bbe
move
Trinkle23897 Mar 22, 2026
756baf6
Apply suggestion from @Trinkle23897
Trinkle23897 Mar 22, 2026
529c422
fix
Trinkle23897 Mar 22, 2026
a648143
Drop custom Python toolchain version overrides
Trinkle23897 Mar 22, 2026
3558921
Sync docs with current build and benchmark versions
Trinkle23897 Mar 22, 2026
396de27
Fix docs spelling whitelist
Trinkle23897 Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: Release PyPI Wheel

# on: [push, pull_request]
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main

Comment thread
Trinkle23897 marked this conversation as resolved.
jobs:
release:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
Expand Down Expand Up @@ -44,21 +47,24 @@ jobs:
run: |
make release-test
- name: Upload artifact
uses: actions/upload-artifact@main
uses: actions/upload-artifact@v7
with:
name: wheel
name: wheel-${{ matrix.python-version }}
path: wheelhouse/
if-no-files-found: error

publish:
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v8
with:
pattern: wheel-*
path: artifact
merge-multiple: true
- name: Move files so the next action can find them
run: |
mkdir dist && mv artifact/wheel/* dist/
mkdir dist && mv artifact/* dist/
ls dist/
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
Expand Down
57 changes: 45 additions & 12 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,25 +1,58 @@
load("@python_versions//3.11:defs.bzl", py_binary_311 = "py_binary")
load("@python_versions//3.12:defs.bzl", py_binary_312 = "py_binary")
load("@python_versions//3.13:defs.bzl", py_binary_313 = "py_binary")
load("@rules_python//python:defs.bzl", "py_binary")
load("//envpool:requirements.bzl", "requirement")

_SETUP_SRCS = [
"setup.py",
]

_SETUP_DATA = [
"README.md",
"setup.cfg",
"//envpool",
]

_SETUP_DEPS = [
requirement("setuptools"),
requirement("wheel"),
]

filegroup(
name = "clang_tidy_config",
data = [".clang-tidy"],
)

py_binary(
name = "setup",
srcs = [
"setup.py",
],
data = [
"README.md",
"setup.cfg",
"//envpool",
],
srcs = _SETUP_SRCS,
data = _SETUP_DATA,
main = "setup.py",
python_version = "PY3",
deps = [
requirement("setuptools"),
requirement("wheel"),
],
deps = _SETUP_DEPS,
)

py_binary_311(
name = "setup_py311",
srcs = _SETUP_SRCS,
data = _SETUP_DATA,
main = "setup.py",
deps = _SETUP_DEPS,
)

py_binary_312(
name = "setup_py312",
srcs = _SETUP_SRCS,
data = _SETUP_DATA,
main = "setup.py",
deps = _SETUP_DEPS,
)

py_binary_313(
name = "setup_py313",
srcs = _SETUP_SRCS,
data = _SETUP_DATA,
main = "setup.py",
deps = _SETUP_DEPS,
)
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ BAZEL = USE_BAZEL_VERSION=$(BAZEL_VERSION) $(BAZELISK_BIN)
DATE = $(shell date "+%Y-%m-%d")
DOCKER_TAG = $(DATE)-$(COMMIT_HASH)
DOCKER_USER = trinkle23897
RELEASE_PYTHON ?= $(shell python3 -c 'import sys; print("{}.{}".format(sys.version_info[0], sys.version_info[1]))')
RELEASE_SETUP_TARGET = //:setup_py$(subst .,,$(RELEASE_PYTHON))
CLANG_TIDY_MAJOR = 18
CLANG_TIDY_BIN = clang-tidy-$(CLANG_TIDY_MAJOR)
CLANG_TIDY_WRAPPER_DIR = $(HOME)/.cache/$(PROJECT_NAME)/bin
Expand Down Expand Up @@ -78,7 +80,13 @@ spelling-system-install:
python3 -c "import ctypes.util, sys; sys.exit(0 if ctypes.util.find_library('enchant-2') or ctypes.util.find_library('enchant') else 1)")

auditwheel-install:
$(call check_install_extra, auditwheel, auditwheel typed-ast patchelf)
$(call check_install_extra, auditwheel, auditwheel patchelf)

release-system-install:
if command -v dnf >/dev/null 2>&1; then \
perl -MCompress::Zlib -e1 >/dev/null 2>&1 || \
(dnf install -y perl-IO-Compress && dnf clean all); \
fi

# python linter

Expand Down Expand Up @@ -125,10 +133,10 @@ bazel-build: bazel-install bazel-pip-requirement-dev
mkdir -p dist
cp bazel-bin/setup.runfiles/$(PROJECT_NAME)/dist/*.whl ./dist

bazel-release: bazel-install bazel-pip-requirement-release
$(BAZEL) run $(BAZELOPT) //:setup --config=release -- bdist_wheel
bazel-release: bazel-install bazel-pip-requirement-release release-system-install
$(BAZEL) run $(BAZELOPT) $(RELEASE_SETUP_TARGET) --config=release -- bdist_wheel
mkdir -p dist
cp bazel-bin/setup.runfiles/$(PROJECT_NAME)/dist/*.whl ./dist
cp bazel-bin/$(subst //:,,$(RELEASE_SETUP_TARGET)).runfiles/$(PROJECT_NAME)/dist/*.whl ./dist

bazel-test: bazel-install bazel-pip-requirement-dev
$(BAZEL) test --test_output=all $(BAZELOPT) //... --config=test --spawn_strategy=local --color=yes
Expand Down Expand Up @@ -194,7 +202,9 @@ docker-release-launch: docker-release
docker run --network=host -v /:/host -v $(shell pwd):/app -v $(HOME)/.cache:/root/.cache --shm-size=4gb -it $(PROJECT_NAME)-release:$(DOCKER_TAG) zsh

pypi-wheel: auditwheel-install bazel-release
ls dist/*.whl -Art | tail -n 1 | xargs auditwheel repair --plat manylinux_2_28_x86_64
rm -rf wheelhouse
CURRENT_WHEEL=$$(ls dist/*.whl -Art | tail -n 1); \
python3 -m auditwheel repair --plat manylinux_2_28_x86_64 "$$CURRENT_WHEEL"

release-test1:
cd envpool && python3 make_test.py
Expand Down
2 changes: 1 addition & 1 deletion docker/release.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WORKDIR $HOME

RUN dnf install -y \
git curl wget zsh gcc gcc-c++ make tmux golang java-17-openjdk-devel \
qt5-qtbase-devel qt5-qtdeclarative-devel \
qt5-qtbase-devel qt5-qtdeclarative-devel perl-IO-Compress \
&& dnf clean all
RUN ln -sf "$(qmake-qt5 -query QT_INSTALL_HEADERS)" /usr/include/qt

Expand Down
15 changes: 14 additions & 1 deletion envpool/mujoco/gym/mujoco_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <mjxmacro.h>
#include <mujoco.h>

#include <fstream>
#include <stdexcept>
#include <string>

Expand All @@ -28,6 +29,17 @@ namespace mujoco_gym {
class MujocoEnv {
private:
std::array<char, 1000> error_;
std::string xml_path_;

static std::string ResolveXMLPath(const std::string& xml) {
auto ext = xml.rfind(".xml");
if (ext == std::string::npos) {
return xml;
}
std::string patched = xml.substr(0, ext) + "_envpool.xml";
std::ifstream stream(patched);
return stream.good() ? patched : xml;
}

protected:
mjModel* model_;
Expand All @@ -44,7 +56,8 @@ class MujocoEnv {
public:
MujocoEnv(const std::string& xml, int frame_skip, bool post_constraint,
int max_episode_steps)
: model_(mj_loadXML(xml.c_str(), nullptr, error_.begin(), 1000)),
: xml_path_(ResolveXMLPath(xml)),
model_(mj_loadXML(xml_path_.c_str(), nullptr, error_.begin(), 1000)),
frame_skip_(frame_skip),
post_constraint_(post_constraint),
max_episode_steps_(max_episode_steps),
Expand Down
17 changes: 13 additions & 4 deletions envpool/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@

"""EnvPool pip requirements initialization, this is loaded in WORKSPACE."""

load("@rules_python//python:pip.bzl", "pip_parse")
load("@python_versions//:pip.bzl", "multi_pip_parse")

def workspace():
"""Configure pip requirements."""

if "pip_requirements" not in native.existing_rules().keys():
pip_parse(
multi_pip_parse(
name = "pip_requirements",
python_interpreter_target = "@python3_12_x86_64-unknown-linux-gnu//:bin/python3",
default_version = "3.12",
python_interpreter_target = {
"3.11": "@python_versions_3_11_x86_64-unknown-linux-gnu//:bin/python3",
"3.12": "@python_versions_3_12_x86_64-unknown-linux-gnu//:bin/python3",
"3.13": "@python_versions_3_13_x86_64-unknown-linux-gnu//:bin/python3",
},
requirements_lock = {
"3.11": "@envpool//third_party/pip_requirements:requirements.txt",
"3.12": "@envpool//third_party/pip_requirements:requirements.txt",
"3.13": "@envpool//third_party/pip_requirements:requirements.txt",
},
# default timeout value is 600, change it if you failed.
# timeout = 3600,
quiet = False,
requirements_lock = "@envpool//third_party/pip_requirements:requirements.txt",
# extra_pip_args = ["--extra-index-url", "https://mirrors.aliyun.com/pypi/simple"],
)
35 changes: 20 additions & 15 deletions envpool/python_tool_versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Additional Python toolchain versions for rules_python 0.12."""
"""Additional Python toolchain versions for rules_python."""

# Sourced from bazelbuild/rules_python 0.37.0.
PYTHON_TOOL_VERSIONS = {
"3.12.7": {
"url": "20241008/cpython-{python_version}+20241008-{platform}-{build}.tar.gz",
"sha256": {
"aarch64-apple-darwin": "dd07d467f1d533b93d06e4d2ff88b91f491329510c6434297b88b584641bff5d",
"aarch64-unknown-linux-gnu": "ce3230da53aacb17ff77e912170786f47db4a446d4acb6cde7c397953a032bca",
"ppc64le-unknown-linux-gnu": "27d3cba42e94593c49f8610dcadd74f5b731c78f04ebabc2b0e1ba031ec09441",
"s390x-unknown-linux-gnu": "1e28e0fc9cd1fa0365a149c715c44d3030b2c989ca397fc074809b943449df41",
"x86_64-apple-darwin": "2347bf53ed3623645bed35adfca950b2c5291e3a759ec6c7765aa707b5dc866b",
"x86_64-pc-windows-msvc": "4ed1a146c66c7dbd85b87df69b17afc166ea7d70056aaf59a49c3d987a030d3b",
"x86_64-unknown-linux-gnu": "adbda1f3b77d7b65a551206e34a225375f408f9823e2e11df4c332aaecb8714b",
},
"strip_prefix": "python",
load("@rules_python//python:versions.bzl", "MINOR_MAPPING", "TOOL_VERSIONS")

_PYTHON_3_12_7 = {
"url": "20241008/cpython-{python_version}+20241008-{platform}-{build}.tar.gz",
"sha256": {
"aarch64-apple-darwin": "dd07d467f1d533b93d06e4d2ff88b91f491329510c6434297b88b584641bff5d",
"aarch64-unknown-linux-gnu": "ce3230da53aacb17ff77e912170786f47db4a446d4acb6cde7c397953a032bca",
"ppc64le-unknown-linux-gnu": "27d3cba42e94593c49f8610dcadd74f5b731c78f04ebabc2b0e1ba031ec09441",
"s390x-unknown-linux-gnu": "1e28e0fc9cd1fa0365a149c715c44d3030b2c989ca397fc074809b943449df41",
"x86_64-apple-darwin": "2347bf53ed3623645bed35adfca950b2c5291e3a759ec6c7765aa707b5dc866b",
"x86_64-pc-windows-msvc": "4ed1a146c66c7dbd85b87df69b17afc166ea7d70056aaf59a49c3d987a030d3b",
"x86_64-unknown-linux-gnu": "adbda1f3b77d7b65a551206e34a225375f408f9823e2e11df4c332aaecb8714b",
},
"strip_prefix": "python",
}

PYTHON_TOOL_VERSIONS = dict(TOOL_VERSIONS)
PYTHON_TOOL_VERSIONS["3.12.7"] = _PYTHON_3_12_7

PYTHON_MINOR_MAPPING = dict(MINOR_MAPPING)
PYTHON_MINOR_MAPPING["3.12"] = "3.12.7"
12 changes: 7 additions & 5 deletions envpool/workspace1.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
load("@com_justbuchanan_rules_qt//:qt_configure.bzl", "qt_configure")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
load("//envpool:python_tool_versions.bzl", "PYTHON_TOOL_VERSIONS")
load("@rules_python//python:repositories.bzl", "python_register_multi_toolchains")
load("//envpool:python_tool_versions.bzl", "PYTHON_MINOR_MAPPING", "PYTHON_TOOL_VERSIONS")

def workspace():
"""Configure pip requirements."""
python_register_toolchains(
name = "python3_12",
python_version = "3.12.7",
python_register_multi_toolchains(
name = "python_versions",
python_versions = ["3.11", "3.12", "3.13"],
default_version = "3.12",
ignore_root_user_error = True,
minor_mapping = PYTHON_MINOR_MAPPING,
tool_versions = PYTHON_TOOL_VERSIONS,
)

Expand Down
66 changes: 63 additions & 3 deletions third_party/cuda/cuda.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,61 @@

_CUDA_DIR = "CUDA_DIR"

_STUB_CUDA_RUNTIME_API_H = """
#ifndef CUDA_RUNTIME_API_H_
#define CUDA_RUNTIME_API_H_

#include <stddef.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void* cudaStream_t;
typedef int cudaError_t;

enum cudaMemcpyKind {
cudaMemcpyHostToHost = 0,
cudaMemcpyHostToDevice = 1,
cudaMemcpyDeviceToHost = 2,
cudaMemcpyDeviceToDevice = 3,
};

static inline cudaError_t cudaMemcpyAsync(
void* dst, const void* src, size_t count, enum cudaMemcpyKind kind,
cudaStream_t stream) {
(void)dst;
(void)src;
(void)count;
(void)kind;
(void)stream;
abort();
return 1;
}

static inline cudaError_t cudaStreamSynchronize(cudaStream_t stream) {
(void)stream;
abort();
return 1;
}

#ifdef __cplusplus
}
#endif

#endif /* CUDA_RUNTIME_API_H_ */
"""

def _impl(rctx):
cuda_dir = rctx.os.environ.get(_CUDA_DIR, default = "/usr/local/cuda")
rctx.symlink("{}/include".format(cuda_dir), "include")
rctx.symlink("{}/lib64".format(cuda_dir), "lib64")
cuda_include = rctx.path("{}/include/cuda_runtime_api.h".format(cuda_dir))
cudart_static = rctx.path("{}/lib64/libcudart_static.a".format(cuda_dir))
rctx.file("WORKSPACE")
rctx.file("BUILD", content = """
if cuda_include.exists and cudart_static.exists:
rctx.symlink("{}/include".format(cuda_dir), "include")
rctx.symlink("{}/lib64".format(cuda_dir), "lib64")
rctx.file("BUILD", content = """
package(default_visibility = ["//visibility:public"])

cc_library(
Expand All @@ -33,6 +82,17 @@ cc_library(
]),
strip_include_prefix = "include",
)
""")
else:
rctx.file("include/cuda_runtime_api.h", _STUB_CUDA_RUNTIME_API_H)
rctx.file("BUILD", content = """
package(default_visibility = ["//visibility:public"])

cc_library(
name = "cudart_static",
hdrs = ["include/cuda_runtime_api.h"],
strip_include_prefix = "include",
)
""")

cuda_configure = repository_rule(
Expand Down
Loading
Loading