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

Add support for Python 3.12 #4146

Merged
merged 8 commits into from
Jan 5, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/contrib_rerun_py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
# TODO(jleibs): understand why deps can't be installed in the same step as the wheel
shell: bash
run: |
pip install attrs>=23.1.0 numpy>=1.23 pillow pyarrow==10.0.1 pytest==7.1.2 torch==2.1.0 typing_extensions>=4.5
pip install attrs>=23.1.0 numpy>=1.23 pillow pyarrow==14.0.2 pytest==7.1.2 torch==2.1.0 typing_extensions>=4.5

- name: Get version
id: get-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_build_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
shell: bash
run: |
pixi run pip uninstall rerun-sdk -y
pixi run pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pixi run pip install deprecated numpy>=1.23 pyarrow==14.0.2 pytest==7.1.2
pixi run pip install rerun-sdk --no-index --find-links wheel
- name: Verify built wheel version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_publish_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
run: |
pixi run pip install -r scripts/ci/requirements.txt
pixi run pip uninstall rerun-sdk -y
pixi run pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pixi run pip install deprecated numpy>=1.23 pyarrow==14.0.2 pytest==7.1.2
pixi run pip install rerun-sdk --no-index --find-links wheel

- name: Installed wheel version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_run_notebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# TODO(jleibs): pull these deps from pyproject.toml
shell: bash
run: |
pip install deprecated numpy>=1.23 pillow>=9.5.0 pyarrow==10.0.1 pytest==7.1.2
pip install deprecated numpy>=1.23 pillow>=9.5.0 pyarrow==14.0.2 pytest==7.1.2

- name: Install downloaded wheel_artifact
# Now install the wheel using a specific version and --no-index to guarantee we get the version from
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_test_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
# TODO(jleibs): understand why deps can't be installed in the same step as the wheel
shell: bash
run: |
pip install attrs>=23.1.0 numpy>=1.23 pillow pyarrow==10.0.1 pytest==7.1.2 torch==2.1.0 typing_extensions>=4.5
pip install attrs>=23.1.0 numpy>=1.23 pillow pyarrow==14.0.2 pytest==7.1.2 torch==2.1.0 typing_extensions>=4.5

- name: Get version
id: get-version
Expand Down
3 changes: 2 additions & 1 deletion examples/python/controlnet/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ opencv-python
pillow
diffusers
numpy
torch
#TODO(#4704): clean that up when pytorch is available for 3.12
torch ; python_version < "3.12"
transformers
rerun-sdk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ pillow
requests>=2.31,<3
rerun-sdk
scipy
torch>=1.13.0
#TODO(#4704): clean that up when pytorch is available for 3.12
torch>1.13.0; python_version < "3.12"
transformers>=4.26.0
3 changes: 2 additions & 1 deletion examples/python/detect_and_track_objects/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ pillow
requests>=2.31,<3
rerun-sdk
timm==0.9.11
torch>=1.13.0
#TODO(#4704): clean that up when pytorch is available for 3.12
torch>=1.13.0 ; python_version < "3.12"
transformers
3 changes: 2 additions & 1 deletion examples/python/llm_embedding_ner/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rerun-sdk
torch
#TODO(#4704): clean that up when pytorch is available for 3.12
torch ; python_version < "3.12"
transformers
umap-learn
5 changes: 3 additions & 2 deletions examples/python/segment_anything_model/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ numpy
opencv-python
requests>=2.31,<3
rerun-sdk
torch
torchvision
#TODO(#4704): clean that up when pytorch is available for 3.12
torch ; python_version < "3.12"
torchvision ; python_version < "3.12"
tqdm
2 changes: 1 addition & 1 deletion examples/python/signed_distance_fields/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
numpy
requests>=2.31,<3
rerun-sdk
scikit-learn==1.1.3
scikit-learn>=1.1.3
trimesh==3.15.2
51 changes: 49 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,64 @@
import nox # type: ignore


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]


@nox.session(python=PYTHON_VERSIONS)
def tests(session: nox.Session) -> None:
"""Run the Python test suite"""
session.install("-r", "rerun_py/requirements-build.txt")

# TODO(#4704): clean that up when torch is 3.12 compatible
if session.python == "3.12":
session.run(
"pip", "install", "torch", "torchvision", "--pre", "--index-url", "https://download.pytorch.org/whl/nightly"
)

session.install("./rerun_py")
session.run("just", "py-test", external=True)


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.session(python=PYTHON_VERSIONS)
def run_all(session: nox.Session) -> None:
"""Run all examples through the run_all.py script (pass args with: "-- <args>")"""

# TODO(#4704): clean that up when torch is 3.12 compatible
if session.python == "3.12":
session.run(
"pip", "install", "torch", "torchvision", "--pre", "--index-url", "https://download.pytorch.org/whl/nightly"
)

# Note: the run_all.py scripts installs all dependencies itself. In particular, we can install from
# examples/python/requirements.txt because it includes pyrealsense2, which is not available for mac.
session.run("python", "scripts/run_all.py", "--install-requirements", *session.posargs)


roundtrip_cpp_built = False


@nox.session(python=PYTHON_VERSIONS)
def roundtrips(session: nox.Session) -> None:
"""Run all roundtrip tests (C++ will be built only once / skip with: "-- --no-cpp-build")"""

global roundtrip_cpp_built

session.install("-r", "rerun_py/requirements-build.txt")
session.install("opencv-python")

# TODO(#4704): clean that up when torch is 3.12 compatible
if session.python == "3.12":
session.run(
"pip", "install", "torch", "torchvision", "--pre", "--index-url", "https://download.pytorch.org/whl/nightly"
)
session.install("./rerun_py")

extra_args = []
if roundtrip_cpp_built and "--no-cpp-build" not in session.posargs:
extra_args.append("--no-cpp-build")
extra_args.extend(session.posargs)

session.run("python", "tests/roundtrips.py", "--no-py-build", *extra_args)
session.run("python", "docs/code-examples/roundtrips.py", "--no-py-build", *extra_args)

roundtrip_cpp_built = True
Loading
Loading