refactor(python): modernize and fix typing in schola/core, 3.10 bug fixes#26
Open
noamonti748 wants to merge 12 commits into
Open
refactor(python): modernize and fix typing in schola/core, 3.10 bug fixes#26noamonti748 wants to merge 12 commits into
schola/core, 3.10 bug fixes#26noamonti748 wants to merge 12 commits into
Conversation
…s on 3.10, same thing for 3.10 cloudpickle issue with ray
schola/coreschola/core, 3.10 bug fixes
| ): | ||
|
|
||
| self, | ||
| auto_reset_type: AutoResetType | AutoresetMode | int = AutoResetType.SAME_STEP, |
Collaborator
There was a problem hiding this comment.
Can you make it so that this function takes only AutoResetType. Caller(s) can be responsible for using the coerce helper to get an AutoResetType. That will prevent the temptation to expand the signature for the next framework with their own AutoReset Enum
Move `coerce_auto_reset_type` to base_protocol.py so callers don't depend on gRPC.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves static typing across the Schola Python core package
(schola.core)usingbasedpyright, with targetedpyrightconfig.jsonexecution environments so protobuf, protocol, simulator, and utility modules can be checked incrementally without drowning in generated-code noise.Also fixes a real ONNX export bug (
make_box_outputparameter name mismatch) and documents Python version constraints forAsyncVecEnv(asyncio.TaskGrouprequires 3.11+). Tests are updated for the new annotations and for Python 3.10 vs 3.11 behavior (xfail/skipif where Ray pickling orTaskGroupare incompatible).Related issues
None.
Type of change
Changes
Static typing (basedpyright)
Expanded
pyrightconfig.jsonwith per-directory execution environments for:schola/core/protocols/protobufsuppress unknown-type noise from generated protobuf bindingsschola/core/protocols, schola/core/simulators/unreal, schola/core/utilsscoped rule overrides for incremental adoptionAnnotated core modules with modern typing (X | None, built-in dict/list,
typing_extensions.override, targeted# pyright: filepragmas where full strictness is impractical):base_protocol, async_base_protocol, socket_protocol, gRPC/protobuf stack (serialize, deserialize, grpc_protocol, async_grpc_protocol, offline_grpc_protocol)base_simulator, external_simulator, Unreal simulators (base, executable, project)dict_helpers, id_manager, plugins, ubtmodel.py, error_manager.pyUpdated corresponding tests under
Test/core/for typing compliance (e.g.@overrideon stub protocol classes, assertion style changes).Bug fixes uncovered during typing / test runs
rllib/export.py:ScholaRLModuleandRllibScholaModel.make_box_outputnow accept_space_name(matchingScholaModel.make_fundamental_output), fixingtorch.export/ ONNX export failures (unexpected keyword argument'_space_name').sb3/async_env.py:AsyncVecEnv.__init__raises a clearRuntimeErroron Python < 3.11 because it usesasyncio.TaskGroup.Python 3.10 test handling
Test/sb3/test_async_env.py: module-level pytest.mark.xfail on Python < 3.11 (raises=RuntimeError) plus early pytest.xfail() in the shared fixture so setup does not ERROR.Test/rllib/scripts/test_eval_cli.py: skipif ontest_apply_env_config_rebuilds_real_eval_env_runner_groupon Python < 3.11 (Ray eval-config pickling with MagicMock stubs fails on 3.10; passes on 3.11).Testing
Python (
Resources/python,Test)pip install --group test -e "./Resources/python[all]"python -m pytest Test --import-mode=importlib -n 0Unreal C++ (
Source)Checklist