-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Windows pip support #1426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Windows pip support #1426
Changes from all commits
e5e1d03
f7aeaab
7e811cd
371cf0e
c6f8538
e73327f
1a31344
e12d3b5
d216800
01b065b
6f68bf1
8d53d20
7a343df
5a219e2
9a5885f
b5f5ca5
11aeaa0
3b7e2a4
aa8199e
8124d65
74336b9
21139a2
d2761c0
1435f2e
c5f7ef3
f1c92a3
f8ecb46
a2fd0e2
aebd8c1
0635cf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| name: Build Wheels (Windows) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master, main ] | ||
| tags: [ 'v*' ] | ||
| pull_request: | ||
| branches: [ master, main ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 90 | ||
| strategy: | ||
| matrix: | ||
| os: [windows-latest] | ||
| python-version: ['3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install CMake (Windows) | ||
| run: | | ||
| choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' | ||
| refreshenv | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install build wheel setuptools | ||
|
|
||
| - name: Clone dependencies | ||
| run: | | ||
| git clone --single-branch --depth 1 https://github.com/pybind/pybind11.git pybind11 | ||
| git clone -b 20250814.1 --single-branch --depth 1 https://github.com/abseil/abseil-cpp.git open_spiel/abseil-cpp | ||
| git clone -b master https://github.com/nlohmann/json.git open_spiel/json | ||
| cd open_spiel/json && git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 && cd ../.. | ||
| git clone -b master https://github.com/pybind/pybind11_json.git open_spiel/pybind11_json | ||
| cd open_spiel/pybind11_json && git checkout d0bf434be9d287d73a963ff28745542daf02c08f && cd ../.. | ||
| git clone -b master https://github.com/pybind/pybind11_abseil.git open_spiel/pybind11_abseil | ||
| cd open_spiel/pybind11_abseil && git checkout 73992b5 && cd ../.. | ||
| git clone -b develop --single-branch --depth 1 https://github.com/jblespiau/dds.git open_spiel/games/bridge/double_dummy_solver | ||
|
|
||
| - name: Build wheel | ||
| run: | | ||
| python -m build --wheel --outdir dist/ | ||
| if (!(Test-Path dist/*.whl)) { Write-Error "No wheel file generated"; exit 1 } | ||
| Get-ChildItem dist/*.whl | ||
| shell: pwsh | ||
|
|
||
| - name: Test wheel installation | ||
| run: | | ||
| $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 | ||
| python -m pip install $wheel.FullName | ||
| python -c "import pyspiel; game = pyspiel.load_game('tic_tac_toe'); print('OpenSpiel works! Game:', game.get_type().short_name)" | ||
| shell: pwsh | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: wheels-${{ matrix.os }}-py${{ matrix.python-version }} | ||
| path: dist/*.whl | ||
|
|
||
| upload_pypi: | ||
| needs: [build_wheels] | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| path: dist | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| packages_dir: dist/*/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| # Builds and tests the OpenSpiel wheels using cibuildwheel. | ||
| # | ||
| # Each wheel is built via the manylinux2014 pypa Docker image on Linux and | ||
| # standard MacOS X on 10.15. Each binary wheel is built only for x86_64. Basic | ||
| # API tests are run within the Docker environment that built the wheel. Full | ||
| # tests (tests that use extra dependencies such as PyTorch, JAX, Tensorflow) | ||
| # are tested in the Github Actions CI environment (Ubuntu 20.04 and Mac OS | ||
| # 10.15). | ||
| # Each wheel is built via the manylinux_2_28 pypa Docker image on Linux, | ||
| # standard MacOS X, and Windows using MSVC. Each binary wheel is built for | ||
| # x86_64 (and arm64 where supported). Basic API tests are run within the build | ||
| # environment. Full tests (tests that use extra dependencies such as PyTorch, | ||
| # JAX, Tensorflow) are tested in the Github Actions CI environment. | ||
| name: wheels | ||
|
|
||
| on: | ||
|
|
@@ -145,3 +144,79 @@ jobs: | |
| dist/*.tar.gz | ||
| ./wheelhouse/*.whl | ||
|
|
||
| # Windows wheel builds - separate job due to different build process (no cibuildwheel) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really? no cibuildwheel? I'm surprised, it said it supported Windows. Fine with me, though, if this works.. |
||
| build_windows_wheels: | ||
| name: Build wheels on Windows Python ${{ matrix.python-version }} | ||
| runs-on: windows-latest | ||
| timeout-minutes: 90 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ['3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| env: | ||
| OPEN_SPIEL_BUILDING_WHEEL: ON | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install CMake | ||
| run: | | ||
| choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | ||
| refreshenv | ||
| shell: pwsh | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install build wheel setuptools | ||
| shell: pwsh | ||
|
|
||
| - name: Clone dependencies | ||
| run: | | ||
| git clone --single-branch --depth 1 https://github.com/pybind/pybind11.git pybind11 | ||
| git clone -b 20250814.1 --single-branch --depth 1 https://github.com/abseil/abseil-cpp.git open_spiel/abseil-cpp | ||
| git clone -b master https://github.com/nlohmann/json.git open_spiel/json | ||
| cd open_spiel/json && git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 && cd ../.. | ||
| git clone -b master https://github.com/pybind/pybind11_json.git open_spiel/pybind11_json | ||
| cd open_spiel/pybind11_json && git checkout d0bf434be9d287d73a963ff28745542daf02c08f && cd ../.. | ||
| git clone -b master https://github.com/pybind/pybind11_abseil.git open_spiel/pybind11_abseil | ||
| cd open_spiel/pybind11_abseil && git checkout 73992b5 && cd ../.. | ||
| git clone -b develop --single-branch --depth 1 https://github.com/jblespiau/dds.git open_spiel/games/bridge/double_dummy_solver | ||
| shell: pwsh | ||
|
|
||
| - name: Build wheel | ||
| run: | | ||
| python -m build --wheel --outdir dist/ | ||
| if (!(Test-Path dist/*.whl)) { Write-Error "No wheel file generated"; exit 1 } | ||
| Get-ChildItem dist/*.whl | ||
| shell: pwsh | ||
|
|
||
| - name: Test wheel installation | ||
| run: | | ||
| $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 | ||
| python -m pip install $wheel.FullName | ||
| python -c "import pyspiel; game = pyspiel.load_game('tic_tac_toe'); print('OpenSpiel works! Game:', game.get_type().short_name)" | ||
| shell: pwsh | ||
|
|
||
| # Note: Windows tests are currently less thorough than Linux/macOS tests. | ||
| # TODO: Improve Windows test coverage in future iterations. | ||
| - name: Run basic tests | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a commet here that the windows tests are less thorough. Maybe we can improve this down the road. |
||
| run: | | ||
| python -c "import pyspiel; print('Registered games:', len(pyspiel.registered_names()))" | ||
| python -c "import pyspiel; g = pyspiel.load_game('kuhn_poker'); print('Kuhn poker loaded successfully')" | ||
| python -c "import pyspiel; g = pyspiel.load_game('leduc_poker'); print('Leduc poker loaded successfully')" | ||
| shell: pwsh | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: wheels-windows-py${{ matrix.python-version }} | ||
| path: dist/*.whl | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """ | ||
| OpenSpiel: A Framework for Reinforcement Learning in Games. | ||
|
|
||
| OpenSpiel is a collection of environments and algorithms for research in general | ||
| reinforcement learning and search/planning in games. | ||
| """ | ||
|
|
||
| import pyspiel | ||
|
|
||
| __all__ = ["pyspiel"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this file to build-wheels-windows.yml?