Skip to content

Commit bd2e83a

Browse files
authored
Merge pull request #133 from timlehr/tlehr/pythonPackage
Build: adding support for distribution via Python package
2 parents dbaa731 + b750c76 commit bd2e83a

7 files changed

Lines changed: 136 additions & 1 deletion

File tree

.github/workflows/build.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,59 @@ jobs:
150150
path: |
151151
build_win64/Release/*
152152
build_win64/Debug/*
153+
package_wheels:
154+
runs-on: ${{ matrix.os }}
155+
strategy:
156+
matrix:
157+
python-version: ["3.9"]
158+
os: [ ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest ]
159+
steps:
160+
- uses: actions/checkout@v4
161+
with:
162+
fetch-depth: 1
163+
submodules: recursive
164+
- name: Install Dependencies
165+
run: |
166+
sudo apt-get update
167+
sudo apt-get install -y libglfw3-dev libgtk-3-dev
168+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
169+
- name: Install UV
170+
uses: astral-sh/setup-uv@v6
171+
with:
172+
version: "0.8.22"
173+
python-version: ${{ matrix.python-version }}
174+
- name: Install Python
175+
run: uv python install
176+
- name: Build Python wheel
177+
run: |
178+
uv build --wheel
179+
- name: Archive Python wheel
180+
uses: actions/upload-artifact@v4
181+
with:
182+
name: wheel-${{ matrix.os }}
183+
path: dist/*.whl
184+
package_sdist:
185+
runs-on: ubuntu-22.04
186+
steps:
187+
- uses: actions/checkout@v4
188+
with:
189+
fetch-depth: 1
190+
submodules: recursive
191+
- name: Install Dependencies
192+
run: |
193+
sudo apt-get update
194+
sudo apt-get install -y libglfw3-dev libgtk-3-dev
195+
- name: Install UV
196+
uses: astral-sh/setup-uv@v6
197+
with:
198+
version: "0.8.22"
199+
- name: Install Python
200+
run: uv python install
201+
- name: Build Python wheel
202+
run: |
203+
uv build --sdist
204+
- name: Archive Python sdist
205+
uses: actions/upload-artifact@v4
206+
with:
207+
name: sdist
208+
path: dist/*.tar.gz

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
cmake_minimum_required(VERSION 3.10)
22
cmake_policy(SET CMP0076 NEW)
33

4-
project(raven VERSION 1.0)
4+
# Project version is stored in VERSION.txt
5+
file(READ "${CMAKE_CURRENT_LIST_DIR}/VERSION.txt" RAVEN_VERSION)
6+
string(STRIP "${RAVEN_VERSION}" RAVEN_VERSION)
7+
8+
project(raven VERSION ${RAVEN_VERSION})
59

610
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
711

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ You can load a file into WASM Raven a few ways:
6868

6969
Note: The WASM build of raven is missing some features - see the Help Wanted section below.
7070

71+
## Building (as a Python package)
72+
73+
Raven can be built and embedded inside a Python package for easy distribution alongside other OTIO Python packages.
74+
For simplicity, we recommend using [UV](https://github.com/astral-sh/uv) for builds and running Raven from the Python package.
75+
76+
_Note: Since we don't publish Raven to PyPI yet, you will need to build it yourself._
77+
78+
```shell
79+
# clone the code
80+
git clone --recursive https://github.com/OpenTimelineIO/raven.git
81+
cd raven
82+
83+
# run Raven using UV
84+
uv run --no-editable raven example.otio
85+
86+
# build wheel using UV (wheel file will be in ./dist)
87+
uv build # add '--python <python_version>' to build for a specific Python version
88+
```
89+
7190
## Troubleshooting
7291

7392
If you have trouble building, these hints might help...

VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[build-system]
2+
requires = ["scikit-build-core"]
3+
build-backend = "scikit_build_core.build"
4+
5+
[project]
6+
name = "opentimelineio-raven"
7+
dynamic = ["version"]
8+
description = "OpenTimelineIO viewer app made with Dear ImGui."
9+
authors = [
10+
{ name = "Contributors to the OpenTimelineIO project", email = "otio-discussion@lists.aswf.io"}
11+
]
12+
classifiers = [
13+
"Programming Language :: C++",
14+
"Development Status :: 4 - Beta",
15+
"Intended Audience :: Developers",
16+
"Topic :: Multimedia :: Video",
17+
"Topic :: Multimedia :: Video :: Display",
18+
"Topic :: Multimedia :: Video :: Non-Linear Editor",
19+
"Topic :: Software Development :: Libraries :: Python Modules",
20+
"License :: OSI Approved :: Apache Software License",
21+
"Operating System :: OS Independent",
22+
"Natural Language :: English"
23+
]
24+
keywords = ["film", "tv", "editing", "editorial", "edit", "non-linear", "time", "otio", "opentimelineio", "raven"]
25+
license = { file = "LICENSE.txt" }
26+
readme = "README.md"
27+
requires-python = ">=3.9,<3.13"
28+
29+
[project.scripts]
30+
raven = "otio_raven._wrapper:main"
31+
32+
[project.urls]
33+
"Homepage" = "https://github.com/OpenTimelineIO/raven"
34+
"Bug Tracker" = "https://github.com/OpenTimelineIO/raven/issues"
35+
36+
[tool.scikit-build]
37+
cmake.version = ">=3.10"
38+
cmake.build-type = "Release"
39+
wheel.packages = ["python/otio_raven"]
40+
wheel.install-dir = "otio_raven"
41+
wheel.py-api = "py3"
42+
43+
[tool.scikit-build.metadata.version]
44+
provider = "scikit_build_core.metadata.regex"
45+
input = "VERSION.txt"
46+
regex = "^(?P<version>.+)"
47+
result = "{version}"

python/otio_raven/__init__.py

Whitespace-only changes.

python/otio_raven/_wrapper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
import subprocess
3+
import os
4+
5+
def main():
6+
package_dir = os.path.dirname(__file__)
7+
exe_path = os.path.join(package_dir, "bin", "raven")
8+
sys.exit(subprocess.call([exe_path] + sys.argv[1:]))

0 commit comments

Comments
 (0)