Skip to content

integrated pybinding into fast-downward#1

Open
Emanuele-Tirendi wants to merge 4 commits intoroeger:pybind11-playgroundfrom
Emanuele-Tirendi:pybind11-playground-inegration
Open

integrated pybinding into fast-downward#1
Emanuele-Tirendi wants to merge 4 commits intoroeger:pybind11-playgroundfrom
Emanuele-Tirendi:pybind11-playground-inegration

Conversation

@Emanuele-Tirendi
Copy link

No description provided.

Copy link
Collaborator

@FlorianPommerening FlorianPommerening left a comment

Choose a reason for hiding this comment

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

This is going in the right direction but the Python interface should be part of the search code and the CMake files for the library and the search code should be merged.

so if in doubt, use that one.

Run with one of the following two commands
$ ./fast-downward.py pybindings-command-line
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need to integrate the call into the driver for now. You can of course do this for the prototype if it helps to test things but for now, the goal is just to compile a library.

Notes on the integration into fast-downward

* The command "make install" still needs to be done manually.
This could be integrated into build.py.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think make parameters can be passed to build.py as well, but the installation of the library also is not the most important thing right now.

* The command "make install" still needs to be done manually.
This could be integrated into build.py.
* The path where the library is installed is now hard coded in
src/pybindings/CMakeLists.txt. This could be integrated into
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll have to think about what a good way of installing the library is. Did you find any "best-practice" guide on this?

Copy link
Author

Choose a reason for hiding this comment

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

No, I didn't. For now I took the install command away and let it only be done in the builds/python_library/bin folder and I added a comment whether it would be preferable to put it in builds/python_library/pybind_libraries. You'll see it after I push my commits again.

import logging
import os
import sys
import importlib
Copy link
Collaborator

Choose a reason for hiding this comment

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

Eventually, the goal is to just do import pydownward here. But this is definitely a later step. For now the goal is to generate the library file and expose the right classes in the right way.

if (NOT PYBINDING_LIBRARY)
add_subdirectory(search)
else()
add_subdirectory(pybindings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The pybindings directory was just the prototype and should eventually go away. the source code should be inside search which means we have to merge the cmake files of pybindings and search.

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# TODO: Can you use the same flags here as in search/CMakeLists.txt?
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should keep all the setup of flags in the general part, so it should not be needed here.

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../search/")

# TODO: Need to integrate DownwardFiles.cmake
file (GLOB SOURCE_FILES "../search/*.cc" "../search/*/*.cc")
Copy link
Collaborator

Choose a reason for hiding this comment

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

GLOB is a hack that we should avoid. The file src/search/DownwardFiles.cmake defines the list of sources and search/CMakeLists.txt already collects them and handles the dependencies.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could maybe treat the file that defines the interface (currently called test.cc but we have to find a better name) as a CMake plugin. Then the build configuration for the library would enable this plugin and all other configs would disable it.


## == Install ==

set(PYTHON_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../trypybindings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

trypybindings also is a temporary thing and should not be hard-coded here. For now, I'd ignore the installation step.

@@ -0,0 +1,71 @@
begin_version
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having this file in the repo for the prototype is fine but of course in the long runs, we should remove it again.

1
0 0 0 1
1
end_operator
Copy link
Collaborator

Choose a reason for hiding this comment

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

I cannot comment on the next file (the compiled python library) but it should not be checked in. It will be different in every build and for every user. You can add it to .gitignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants