Skip to content
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

Fixes for pybind11 updates #1321

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion open_spiel/python/pybind11/bots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/pytypes.h"
#include "pybind11/include/pybind11/smart_holder.h"

// Optional headers.
#if OPEN_SPIEL_BUILD_WITH_ROSHAMBO
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_backgammon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ using open_spiel::State;
using open_spiel::backgammon::BackgammonState;
using open_spiel::backgammon::CheckerMove;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(BackgammonState);

void open_spiel::init_pyspiel_games_backgammon(py::module& m) {
py::class_<CheckerMove>(m, "CheckerMove")
.def_readwrite("pos", &CheckerMove::pos)
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_bargaining.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ using open_spiel::bargaining::BargainingState;
using open_spiel::bargaining::Instance;
using open_spiel::bargaining::Offer;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(BargainingGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(BargainingState);

void open_spiel::init_pyspiel_games_bargaining(py::module& m) {
py::class_<Instance>(m, "Instance")
.def(py::init<>())
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include "open_spiel/python/pybind11/pybind11.h"
#include "open_spiel/spiel.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::bridge::BridgeGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::bridge::BridgeState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
5 changes: 0 additions & 5 deletions open_spiel/python/pybind11/games_chess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "open_spiel/spiel.h"
#include "pybind11/include/pybind11/cast.h"
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/smart_holder.h"

namespace py = ::pybind11;
using open_spiel::Game;
Expand All @@ -38,10 +37,6 @@ using open_spiel::chess::Piece;
using open_spiel::chess::PieceType;
using open_spiel::chess::Move;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessState);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessBoard);

void open_spiel::init_pyspiel_games_chess(py::module& m) {
py::module_ chess = m.def_submodule("chess");

Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_colored_trails.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ using open_spiel::colored_trails::kDefaultNumColors;
using open_spiel::colored_trails::kNumChipsLowerBound;
using open_spiel::colored_trails::kNumChipsUpperBound;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(ColoredTrailsGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ColoredTrailsState);

void open_spiel::init_pyspiel_games_colored_trails(py::module& m) {
m.attr("NUM_COLORS") = py::int_(kDefaultNumColors);
m.attr("NUM_CHIPS_LOWER_BOUND") = py::int_(kNumChipsLowerBound);
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_dots_and_boxes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "open_spiel/games/dots_and_boxes/dots_and_boxes.h"
#include "open_spiel/spiel.h"
#include "pybind11/include/pybind11/smart_holder.h"
#include "pybind11/include/pybind11/pybind11.h"


Expand All @@ -29,8 +28,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::dots_and_boxes::DotsAndBoxesState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(DotsAndBoxesState);

void open_spiel::init_pyspiel_games_dots_and_boxes(py::module& m) {
py::classh<DotsAndBoxesState, State>(m, "DotsAndBoxesState")
.def("dbn_string", &DotsAndBoxesState::DbnString)
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_euchre.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11_abseil/absl_casters.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::euchre::EuchreGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::euchre::EuchreState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_gin_rummy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11_abseil/absl_casters.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::gin_rummy::GinRummyGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::gin_rummy::GinRummyState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_leduc_poker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ using open_spiel::State;
using open_spiel::leduc_poker::LeducState;
using open_spiel::leduc_poker::ActionType;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(LeducState);

void open_spiel::init_pyspiel_games_leduc_poker(py::module& m) {
py::module_ leduc_poker = m.def_submodule("leduc_poker");

Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_negotiation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::negotiation::NegotiationState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(NegotiationState);

void open_spiel::init_pyspiel_games_negotiation(py::module& m) {
py::classh<NegotiationState, State>(m, "NegotiationState")
.def("item_pool",
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_spades.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include "open_spiel/spiel.h"
#include "open_spiel/spiel_utils.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::spades::SpadesGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::spades::SpadesState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_tarok.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include "open_spiel/games/tarok/tarok.h"
#include "open_spiel/python/pybind11/pybind11.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::tarok::TarokState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_tiny_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ using open_spiel::State;
using open_spiel::tiny_bridge::TinyBridgeAuctionState;
using open_spiel::tiny_bridge::TinyBridgePlayState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(TinyBridgePlayState);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(TinyBridgeAuctionState);

void open_spiel::init_pyspiel_games_tiny_bridge(py::module& m) {
py::classh<TinyBridgePlayState, State>(m, "TinyBridgePlayState")
// Pickle support
Expand Down
1 change: 0 additions & 1 deletion open_spiel/python/pybind11/games_trade_comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::trade_comm::TradeCommState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(TradeCommState);
void open_spiel::init_pyspiel_games_trade_comm(py::module& m) {
py::classh<TradeCommState, State>(m, "TradeCommState")
// Pickle support
Expand Down
19 changes: 0 additions & 19 deletions open_spiel/python/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@
#include "pybind11/include/pybind11/functional.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/numpy.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/smart_holder.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/stl.h" // IWYU pragma: keep

// Runtime errors happen if we're inconsistent about whether or not a type has
// PYBIND11_SMART_HOLDER_TYPE_CASTERS applied to it or not. So we do it mostly
// in one place to help with consistency.

namespace open_spiel {

class Policy;
Expand All @@ -67,20 +62,6 @@ class ISMCTSBot;

} // namespace open_spiel

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::State);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Game);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Policy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::TabularPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::PartialTabularPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::UniformPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::PreferredActionPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::NormalFormGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::matrix_game::MatrixGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::tensor_game::TensorGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Bot);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::algorithms::MCTSBot);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::algorithms::ISMCTSBot);

namespace open_spiel {
// Trampoline helper class to allow implementing Bots in Python. See
// https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python
Expand Down
2 changes: 1 addition & 1 deletion open_spiel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function cached_clone() {

DIR="./pybind11"
if [[ ! -d ${DIR} ]]; then
cached_clone -b smart_holder --single-branch --depth 1 https://github.com/pybind/pybind11.git ${DIR}
cached_clone -b master --single-branch --depth 1 https://github.com/pybind/pybind11.git ${DIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor: The other cached_clone calls have the arg (master here) in quotes.

Not sure if consistency matters here.

fi

# The official https://github.com/dds-bridge/dds.git seems to not accept PR,
Expand Down
Loading