Skip to content

Commit 7b4588d

Browse files
committed
Merge branch 'dev-v2' into benchmarking
Conflicts: poetry.lock pyproject.toml tianshou/highlevel/experiment.py
2 parents 91029ad + 2274043 commit 7b4588d

39 files changed

+1087
-1044
lines changed

.github/workflows/pytest.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,94 @@ on:
1515
required: false
1616
default: false
1717

18+
19+
# This job runs the test suite in two environments:
20+
# - py_pinned: uses Python 3.11 with the existing poetry.lock file (our stable, pinned dev environment)
21+
# - py_latest: latest Python version we want to support, without the lock file to furthermore install the newest dependency versions
22+
#
23+
# This ensures compatibility with both our controlled dev setup and the latest upstream packages,
24+
# helping catch issues introduced by dependency updates or newer Python versions.
1825
jobs:
1926
cpu:
2027
runs-on: ubuntu-latest
2128
if: "!contains(github.event.head_commit.message, 'ci skip')"
2229
strategy:
2330
matrix:
24-
python-version: ["3.11"]
31+
include:
32+
- env_name: py_pinned
33+
python-version: "3.11"
34+
use_lock: true
35+
- env_name: py_latest
36+
python-version: "3.13"
37+
use_lock: false
38+
2539
steps:
2640
- name: Setup tmate session
2741
uses: mxschmitt/action-tmate@v3
2842
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
43+
2944
- name: Cancel previous run
3045
uses: styfle/[email protected]
3146
with:
3247
access_token: ${{ github.token }}
48+
3349
- uses: actions/checkout@v3
50+
3451
- name: Set up Python ${{ matrix.python-version }}
3552
uses: actions/setup-python@v4
3653
with:
3754
python-version: ${{ matrix.python-version }}
38-
# use poetry and cache installed packages, see https://github.com/marketplace/actions/python-poetry-action
55+
3956
- name: Install poetry
4057
uses: abatilo/actions-poetry@v2
58+
4159
- name: Setup a local virtual environment (if no poetry.toml file)
4260
run: |
4361
poetry config virtualenvs.create true --local
4462
poetry config virtualenvs.in-project true --local
45-
- uses: actions/cache@v3
46-
name: Define a cache for the virtual environment based on the dependencies lock file
63+
64+
- name: Remove poetry.lock for latest dependency test
65+
if: ${{ !matrix.use_lock }}
66+
run: rm -f poetry.lock
67+
68+
- name: Define a cache for the virtual environment based on the dependencies lock file
69+
if: matrix.use_lock
70+
uses: actions/cache@v3
4771
with:
4872
path: ./.venv
49-
key: venv-${{ hashFiles('poetry.lock') }}
73+
key: venv-${{ matrix.env_name }}-${{ hashFiles('poetry.lock') }}
74+
restore-keys: |
75+
venv-${{ matrix.env_name }}-
76+
5077
- name: Install the project dependencies
5178
run: |
52-
poetry install --with dev --extras "envpool eval"
79+
if [ "${{ matrix.env_name }}" = "py_latest" ]; then
80+
poetry install --with dev --extras "eval"
81+
else
82+
poetry install --with dev --extras "envpool eval"
83+
fi
84+
85+
- name: List installed packages
86+
run: |
87+
poetry run pip list
88+
5389
- name: wandb login
5490
run: |
5591
poetry run wandb login e2366d661b89f2bee877c40bee15502d67b7abef
92+
5693
- name: Test with pytest
57-
# ignore test/throughput which only profiles the code
5894
run: |
59-
poetry run poe test
95+
if [ "${{ matrix.env_name }}" = "py_pinned" ]; then
96+
poetry run poe test
97+
else
98+
poetry run poe test-nocov
99+
fi
60100
- name: Upload coverage to Codecov
101+
if: matrix.env_name == 'py_pinned'
61102
uses: codecov/codecov-action@v1
62103
with:
63104
token: ${{ secrets.CODECOV }}
64105
file: ./coverage.xml
65-
flags: unittests
66-
name: codecov-umbrella
106+
flags: ${{ matrix.env_name }}
107+
name: codecov-${{ matrix.env_name }}
67108
fail_ci_if_error: false

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ Developers:
1616
* Dr. Dominik Jain (@opcode81)
1717
* Michael Panchenko (@MischaPanch)
1818

19+
### Runtime Environment Compatibility
20+
21+
Tianshou v2 is now compatible with
22+
* Python 3.12 and Python 3.13 #1274
23+
* newer versions of gymnasium (v1+) and numpy (v2+)
24+
25+
Our main test environment remains Python 3.11-based for the time being (see `poetry.lock`).
26+
1927
### Trainer Abstraction
2028

2129
* The trainer logic and configuration is now properly separated between the three cases of on-policy, off-policy
@@ -228,6 +236,9 @@ Developers:
228236
contain parameter `repeat_per_collect`).
229237
* All parameter names have been aligned with the new names used by `TrainerParams` (see above).
230238

239+
* Add option to customize the factory for the collector (`ExperimentBuilder.with_collector_factory`),
240+
adding the abstraction `CollectorFactory`. #1256
241+
231242
### Peripheral Changes
232243

233244
* The `Actor` classes have been renamed for clarity (#1091):

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Contributing to Tianshou
22

3-
Please refer to [tianshou.readthedocs.io/en/latest/contributing.html](https://tianshou.readthedocs.io/en/latest/contributing.html).
3+
Please refer to the ['Developer Guide' on tianshou.org](https://tianshou.org/en/latest/04_developer_guide/developer_guide.html).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> ℹ️ **Introducing Tianshou version 2**
1010
>
11-
> We have just released the first beta version 2.0.0b1 of the new major version of Tianshou, and we invite you to try it!
11+
> We have released the second beta version 2.0.0b2 of the new major version of Tianshou on PyPI, and we invite you to try it!
1212
> Version 2 is a complete overhaul of the software design of the procedural API, in which
1313
> * we establish a clear separation between learning algorithms and policies (via the separate abstractions `Algorithm` and `Policy`).
1414
> * we provide more well-defined, more usable interfaces with extensive documentation of all algorithm and trainer parameters,

0 commit comments

Comments
 (0)