ortools/python/README.md
This is the documentation page for the Python 3.9+ wrapper of OR-Tools.
This project aim to explain how you build a Python native wheel package using
setup.py.
You'll need "Python >= 3.9" and few python modules ("wheel" and "absl-py").
Setup.py template to build the python native
project.To Create a native dependent package which will contains two parts:
note: Since Pypi.org support multiple packages, we will simply upload one package per supported platform.
The pipeline for linux-x86-64 should be as follow:
note: The pipeline will be similar for other architectures, don't hesitate to
look at the CI log!
Thus we have the C++ shared library libortools.so and the SWIG generated
Python wrappers e.g. pywrapsat.py in the same package.
Here some dev-note concerning this setup.py.
Then you can generate the package and install it locally using:
python3 setup.py bdist_wheel
python3 -m pip install --user --find-links=dist ortools
If everything good the package (located in <buildir>/python/dist) should have
this layout:
{...}/dist/ortools-X.Y.9999-cp3Z-cp3Z-<platform>.whl:
\- ortools
\- __init__.py
\- .libs
\- libortools.so
\- constraint_solver
\- __init__.py
\- pywrapcp.py
\- _pywrapcp.so
\- ...
\- __init__.py
\- pywrap....py
\- _pywrap....so
...
note: <platform> could be manylinux2014_x86_64, macosx_10_9_x86_64 or win-amd64.
tips: since wheel package are just zip archive you can use unzip -l <package>.whl
to study their layout.
Few links on the subject...
Image has been generated using plantuml:
plantuml -Tsvg docs/{file}.dot
So you can find the dot source files in docs.