Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
79b5e4b
Add CMakeLists.txt
dvadym Aug 24, 2025
fcaeaa3
cache v4
dvadym Aug 24, 2025
c1917af
tests.yaml
dvadym Aug 24, 2025
0514247
actions fix
dvadym Aug 24, 2025
d022006
actions fix
dvadym Aug 24, 2025
730626f
actions fix
dvadym Aug 24, 2025
b896a3a
debug
dvadym Aug 24, 2025
0f06084
add cmake file
dvadym Aug 24, 2025
468316b
requirements
dvadym Aug 24, 2025
aa57b52
protoc
dvadym Aug 24, 2025
a8fd19a
poetry
dvadym Aug 24, 2025
e9aa7d0
fix
dvadym Aug 25, 2025
fbbe1ae
fix
dvadym Aug 25, 2025
ed1656c
fix
dvadym Aug 25, 2025
626439f
fix
dvadym Aug 25, 2025
62338d9
fix
dvadym Aug 25, 2025
6aefe0f
fix
dvadym Aug 25, 2025
75690fe
fix
dvadym Aug 25, 2025
e30f77d
win
dvadym Aug 25, 2025
4ded6e8
win
dvadym Aug 25, 2025
93421ca
mac
dvadym Aug 25, 2025
5ad33d9
win
dvadym Aug 25, 2025
d0c7d3a
win
dvadym Aug 25, 2025
4bbaaec
win
dvadym Aug 25, 2025
f2624c3
win
dvadym Aug 25, 2025
c63c795
win
dvadym Aug 25, 2025
4e63a58
win
dvadym Aug 25, 2025
2b69395
win
dvadym Aug 25, 2025
3208219
win
dvadym Aug 25, 2025
ab53d88
win
dvadym Aug 25, 2025
1f30e31
win
dvadym Aug 25, 2025
7453313
win
dvadym Aug 25, 2025
06eced8
win
dvadym Aug 25, 2025
b670ae0
win
dvadym Aug 25, 2025
402512f
win
dvadym Aug 25, 2025
b13dcb2
win
dvadym Aug 25, 2025
1c29392
fix
dvadym Sep 4, 2025
292124e
git_tag
dvadym Sep 5, 2025
510a48a
absl::hash Mac fix
dvadym Sep 5, 2025
90c1b48
remove dep
dvadym Sep 5, 2025
78b4455
poetry update
dvadym Sep 5, 2025
488f37c
poetry update
dvadym Sep 5, 2025
56298e5
poetry update
dvadym Sep 5, 2025
ddbf3dc
poetry update
dvadym Sep 5, 2025
23df743
poetry update
dvadym Sep 5, 2025
0814d70
poetry update
dvadym Sep 5, 2025
6a75720
google_dp update
dvadym Sep 5, 2025
63367c0
+absl dep
dvadym Sep 5, 2025
05fcc7c
toml
dvadym Sep 5, 2025
6bb8182
poetry numpy fix
dvadym Sep 5, 2025
b4cb936
disable mac
dvadym Sep 5, 2025
95e43ac
poetry
dvadym Sep 5, 2025
e68a2cf
poetry
dvadym Sep 5, 2025
f22006f
poetry
dvadym Sep 5, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Cache Bazel Unix
uses: actions/cache@v2.1.5
uses: actions/cache@v4
with:
path: |
./bazel-PyDP
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
echo "::set-output name=dir::$(poetry config cache-dir)"

- name: poetry cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand Down
32 changes: 6 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ jobs:
fail-fast: false
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11"]
# TODO: fix for Mac and Windows.
os: [ubuntu-latest]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -34,18 +35,6 @@ jobs:
run: |
@("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8

- name: Cache Bazel Unix
# Not working on Windows: https://github.com/actions/cache/issues/576
if: runner.os != 'Windows'
uses: actions/cache@v2.1.5
with:
path: |
./bazel-PyDP
./bazel-bin
./bazel-cache
./bazel-out
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}

- name: Update environment variables Windows
if: runner.os == 'Windows'
# See:
Expand All @@ -56,7 +45,7 @@ jobs:
- name: Cache Bazel Windows
if: runner.os == 'Windows'
# https://stackoverflow.com/questions/66870002/github-actions-cache-maven-m2-repository-on-windows-environment-c-users-run
uses: actions/cache@v2.1.5
uses: actions/cache@v4
with:
path: |
./bazel-cache
Expand Down Expand Up @@ -91,16 +80,7 @@ jobs:
if: runner.os == 'macOS'
timeout-minutes: 20
run: |
PYTHONHOME=$(which python)
PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);")
BAZEL_CONFIG_OS=$(python -c "print('${{ matrix.os }}'.split('-')[0].lower().replace('ubuntu', 'linux'))")
echo "Running: ${{ matrix.os }}"
echo "Using BAZEL_CONFIG_OS: $BAZEL_CONFIG_OS"
bazel --output_base ./bazel-cache build src/python:pydp \
--config $BAZEL_CONFIG_OS \
--verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME \
--action_env=PYTHON_LIB_PATH=$PYTHONPATH
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
bash build_PyDP.sh

- name: Build Google DP Windows
if: runner.os == 'Windows'
Expand Down Expand Up @@ -128,7 +108,7 @@ jobs:
echo "::set-output name=dir::$(poetry config cache-dir)"

- name: poetry cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand Down
41 changes: 2 additions & 39 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,48 +77,11 @@ jobs:
run: |
@("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8

- name: Cache Bazel Unix
# Not working on Windows: https://github.com/actions/cache/issues/576
if: runner.os != 'Windows'
uses: actions/cache@v2.1.5
with:
path: |
./bazel-PyDP
./bazel-bin
./bazel-cache
./bazel-out
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}

- name: Update environment variables Windows
if: runner.os == 'Windows'
# See:
# - On Bazel cache: https://docs.bazel.build/versions/master/output_directories.html
run: |
echo "BAZEL_CACHE_DIR=$env:USERPROFILE\_bazel_$env:USERNAME" >> $env:GITHUB_ENV

- name: Cache Bazel Windows
if: runner.os == 'Windows'
# https://stackoverflow.com/questions/66870002/github-actions-cache-maven-m2-repository-on-windows-environment-c-users-run
uses: actions/cache@v2.1.5
with:
path: |
./bazel-cache
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}

- name: Build Google DP Unix
if: runner.os != 'Windows'
timeout-minutes: 20
run: |
PYTHONHOME=$(which python)
PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);")
BAZEL_CONFIG_OS=$(python -c "print('${{ matrix.os }}'.split('-')[0].lower().replace('ubuntu', 'linux'))")
echo "Running: ${{ matrix.os }}"
echo "Using BAZEL_CONFIG_OS: $BAZEL_CONFIG_OS"
bazel --output_base ./bazel-cache build src/python:pydp \
--config $BAZEL_CONFIG_OS \
--verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME \
--action_env=PYTHON_LIB_PATH=$PYTHONPATH
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
bash build_PyDP.sh

- name: Build Google DP Windows
if: runner.os == 'Windows'
Expand Down Expand Up @@ -146,7 +109,7 @@ jobs:
echo "::set-output name=dir::$(poetry config cache-dir)"

- name: poetry cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand Down
95 changes: 44 additions & 51 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ jobs:
fail-fast: false
max-parallel: 12
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", "3.11"]
# TODO: fix for Mac and Windows.
os: [ubuntu-latest]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -65,70 +66,62 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Setup msbuild Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
- name: Install Protobuf Compiler Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev
- name: Install Protobuf Compiler Mac
if: runner.os == 'macOS'
run: |
brew install protobuf

- name: Fix Paths Windows
# Make sure that tar.exe from Git is used not from Windows
- name: Install Protobuf Compiler Windows
if: runner.os == 'Windows'
run: |
@("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8
$protobufVersion = "32.0"
$downloadUrl = "https://github.com/protocolbuffers/protobuf/releases/download/v$protobufVersion/protoc-$protobufVersion-win64.zip"
$destinationFolder = "$env:TEMP\protoc"

- name: Cache Bazel Unix
# Not working on Windows: https://github.com/actions/cache/issues/576
if: runner.os != 'Windows'
uses: actions/cache@v2.1.5
with:
path: |
./bazel-PyDP
./bazel-bin
./bazel-cache
./bazel-out
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}

- name: Update environment variables Windows
Invoke-WebRequest -Uri $downloadUrl -OutFile protoc.zip
Expand-Archive -Path protoc.zip -DestinationPath $destinationFolder

# Add the protoc directory to the PATH
echo "$destinationFolder\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Verify protoc installation
run: protoc --version

- name: Download proto header Windows
if: runner.os == 'Windows'
# See:
# - On Bazel cache: https://docs.bazel.build/versions/master/output_directories.html
run: |
echo "BAZEL_CACHE_DIR=$env:USERPROFILE\_bazel_$env:USERNAME" >> $env:GITHUB_ENV
run: vcpkg install protobuf:x64-windows

- name: Setup msbuild Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2

- name: Cache Bazel Windows
- name: Setup Visual studio Windows
if: runner.os == 'Windows'
# https://stackoverflow.com/questions/66870002/github-actions-cache-maven-m2-repository-on-windows-environment-c-users-run
uses: actions/cache@v2.1.5
with:
path: |
./bazel-cache
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}
uses: ilammy/msvc-dev-cmd@v1

- name: Build Google DP Unix
if: runner.os != 'Windows'
timeout-minutes: 20
run: |
PYTHONHOME=$(which python)
PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);")
BAZEL_CONFIG_OS=$(python -c "print('${{ matrix.os }}'.split('-')[0].lower().replace('ubuntu', 'linux'))")
echo "Running: ${{ matrix.os }}"
echo "Using BAZEL_CONFIG_OS: $BAZEL_CONFIG_OS"
bazel --output_base ./bazel-cache build src/python:pydp \
--config $BAZEL_CONFIG_OS \
--verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME \
--action_env=PYTHON_LIB_PATH=$PYTHONPATH
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
bash build_PyDP.sh

- name: Build Google DP Windows
if: runner.os == 'Windows'
timeout-minutes: 20
run: |
$PYTHONHOME=$(python -c 'import sys; print(sys.executable);').replace('\', '/')
$PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").replace('\', '/')
echo "PYTHONHOME=$PYTHONHOME"
echo "PYTHONPATH=$PYTHONPATH"
echo "Running: ${{ matrix.os }}"
bazel.exe --output_base ./bazel-cache build src/python:pydp --config windows --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME --action_env=PYTHON_LIB_PATH=$PYTHONPATH
copy ./bazel-bin/src/bindings/_pydp.so ./src/pydp/_pydp.pyd
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release -j
echo %CD%
dir
move /Y .\src\bindings\PyDP\_pydp.pyd ..\src\pydp\_pydp.pyd

- name: Upgrade pip
run: |
Expand All @@ -144,7 +137,7 @@ jobs:
echo "::set-output name=dir::$(poetry config cache-dir)"

- name: poetry cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand All @@ -153,7 +146,7 @@ jobs:

- name: Install dependencies
run: |
poetry config installer.modern-installation false
poetry lock
poetry install

- name: Build PyDP macOS
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.16)
project(PyDP LANGUAGES CXX)

# C++ Standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(src/bindings/PyDP)
26 changes: 6 additions & 20 deletions build_PyDP.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
#!/bin/bash
set -e # exit on error

## Set variables
PLATFORM=$(python scripts/get_platform.py)

# Search specific python bin and lib folders to compile against the poetry env
PYTHONHOME=$(which python)
PYTHONPATH=$(python -c 'import sys; print([x for x in sys.path if "site-packages" in x][0]);')

# Give user feedback
echo -e "Running bazel with:\n\tPLATFORM=$PLATFORM\n\tPYTHONHOME=$PYTHONHOME\n\tPYTHONPATH=$PYTHONPATH"

# Compile code
bazel build src/python:pydp \
--config $PLATFORM \
--verbose_failures \
--action_env=PYTHON_BIN_PATH=$PYTHONHOME \
--action_env=PYTHON_LIB_PATH=$PYTHONPATH

# Delete the previously compiled package and copy the new one
rm -f ./src/pydp/_pydp.so
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make _pydp -j
mv ./src/bindings/PyDP/_pydp*so ../src/pydp/_pydp.so
15 changes: 0 additions & 15 deletions build_PyDP_linux.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
#!/bin/bash
# This script differs from build_PyDP.sh by installing bazel first (if needed).
BAZELISK_VERSION=v1.8.1
BAZELISK_BINARY=bazelisk-linux-amd64
BAZELISK_DOWNLOAD_URL=https://github.com/bazelbuild/bazelisk/releases/download/

if command -v bazel &>/dev/null; then
echo "Bazel already installed"
else
python -m wget "${BAZELISK_DOWNLOAD_URL}/${BAZELISK_VERSION}/${BAZELISK_BINARY}"
chmod +x ${BAZELISK_BINARY}
mkdir bazel_dir
echo mv ${BAZELISK_BINARY} bazel_dir/bazel
mv ${BAZELISK_BINARY} bazel_dir/bazel
export PATH="$PATH:`pwd`/bazel_dir"
fi

./build_PyDP.sh
Loading
Loading