-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feat: Add native Windows pip installation support with automated CI/CD #1369 #1422
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
183f34b
feat: Add Windows pip installation support
visheshrwl 5290440
fix: Use single-line Python test in Windows workflow
visheshrwl e38f5fa
feat: Add Python 3.14 support to Windows builds
visheshrwl dce9a74
fix: Build cp313 wheel on macOS-15 runner to match test Python version
visheshrwl f755999
fix: Add Windows-specific CMake build configuration to setup.py
visheshrwl ca2aebf
fix: Clone json without --depth to allow checkout of specific commit
visheshrwl 58e1532
ci: Add 90-minute timeout to Windows builds
visheshrwl 0e90990
fix: Use PowerShell for Windows wheel install and add build validation
visheshrwl 9836e67
revert: Match upstream by only building cp314 on macos-15
visheshrwl 5fbb3e3
fix: Skip full tests on macOS Python 3.13 (only cp314 wheel built)
visheshrwl 19f7b82
fix: Support both x86_64 and aarch64 Linux wheels in test script
visheshrwl ca94fae
Merge pull request #1 from visheshrwl/windows-pip-support
visheshrwl 24034cc
Merge branch 'google-deepmind:master' into master
visheshrwl c8db4a7
Merge branch 'google-deepmind:master' into master
visheshrwl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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.10', '3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| 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 20250127.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@v4 | ||
| 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@v4 | ||
| with: | ||
| path: dist | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| packages_dir: dist/*/ |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # OpenSpiel Windows Installation Guide | ||
|
|
||
| ## Quick Installation (Recommended) | ||
|
|
||
| Simply install using pip: | ||
| ```bash | ||
| pip install open-spiel | ||
| ``` | ||
|
|
||
| ### Optional dependencies | ||
| For additional features like visualization and machine learning: | ||
| ```bash | ||
| pip install open-spiel[full] | ||
| ``` | ||
|
|
||
| ## Building from Source | ||
|
|
||
| If you need to build from source or contribute to the project: | ||
|
|
||
| ### Prerequisites | ||
| - **Python 3.9+** (get from [python.org](https://python.org)) | ||
| - **Git** (get from [git-scm.com](https://git-scm.com)) | ||
| - **CMake 3.15+** (get from [cmake.org](https://cmake.org)) | ||
| - **Visual Studio 2019 or later** with C++ development tools | ||
|
|
||
| ### Build Steps | ||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone https://github.com/deepmind/open_spiel.git | ||
| cd open_spiel | ||
| ``` | ||
|
|
||
| 2. Build the wheel: | ||
| ```bash | ||
| python -m pip wheel . --no-deps -w dist | ||
| ``` | ||
|
|
||
| 3. Install the built wheel: | ||
| ```bash | ||
| pip install dist/open_spiel-*.whl | ||
| ``` | ||
|
|
||
| ## Verification | ||
|
|
||
| Test your installation: | ||
| ```python | ||
| import pyspiel | ||
|
|
||
| # Create a simple game | ||
| game = pyspiel.load_game("tic_tac_toe") | ||
| state = game.new_initial_state() | ||
| print("OpenSpiel is working!") | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| **"CMake not found"** | ||
| - Install CMake from [cmake.org](https://cmake.org) and add it to your PATH | ||
|
|
||
| **"Git not found"** | ||
| - Install Git from [git-scm.com](https://git-scm.com) and add it to your PATH | ||
|
|
||
| **"MSVC compiler not found"** | ||
| - Install Visual Studio Community with C++ development tools | ||
| - Or install "Microsoft C++ Build Tools" | ||
|
|
||
| **"Import pyspiel failed"** | ||
| - Make sure you installed the package: `pip install open-spiel` | ||
| - Try reinstalling: `pip uninstall open-spiel && pip install open-spiel` | ||
|
|
||
| ### Getting Help | ||
|
|
||
| - [Documentation](https://openspiel.readthedocs.io/) | ||
| - [Report Issues](https://github.com/deepmind/open_spiel/issues) | ||
| - [Discussions](https://github.com/deepmind/open_spiel/discussions) | ||
|
|
||
| ## Advanced Usage | ||
|
|
||
| ### Development Installation | ||
| ```bash | ||
| git clone https://github.com/deepmind/open_spiel.git | ||
| cd open_spiel | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ### Custom Build Options | ||
| ```bash | ||
| # Set custom CMake flags | ||
| set CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Debug | ||
| python -m pip install . | ||
| ``` | ||
|
|
||
| ### Using with Conda | ||
| ```bash | ||
| conda create -n openspiel python=3.9 | ||
| conda activate openspiel | ||
| pip install open-spiel | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| **That's it!** You should now have OpenSpiel working on Windows with a simple `pip install` command. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """ | ||
visheshrwl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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"] | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| [build-system] | ||
| requires = [ | ||
| "setuptools>=45", | ||
| "wheel", | ||
| "cmake>=3.15", | ||
| "ninja; platform_system != 'Windows'", | ||
| ] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "open-spiel" | ||
| version = "1.6.10" | ||
| description = "A Framework for Reinforcement Learning in Games" | ||
| readme = "README.md" | ||
| requires-python = ">=3.10" | ||
| license = { text = "Apache-2.0" } | ||
| authors = [ {name = "The OpenSpiel authors", email = "open_spiel@google.com"} ] | ||
| keywords = ["reinforcement learning", "game theory", "artificial intelligence", "games"] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Developers", | ||
| "Intended Audience :: Science/Research", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: C++", | ||
| "Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
| "Topic :: Games/Entertainment", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| ] | ||
|
|
||
| dependencies = [ | ||
| "absl-py", | ||
| "attrs", | ||
| "numpy", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| full = [ | ||
| "matplotlib", | ||
| "nashpy", | ||
| "networkx", | ||
| "pillow", | ||
| "pygame", | ||
| "pygraphviz", | ||
| "scipy", | ||
| "tensorflow", | ||
| "torch", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/deepmind/open_spiel" | ||
| Repository = "https://github.com/deepmind/open_spiel.git" | ||
| Documentation = "https://openspiel.readthedocs.io/" | ||
| "Bug Tracker" = "https://github.com/deepmind/open_spiel/issues" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
| include = ["open_spiel*"] | ||
|
|
||
| [tool.setuptools.package-data] | ||
| "*" = ["*.so", "*.pyd", "*.dll"] |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.