Skip to content

Prepare for Python 3.12 and 3.13: drop distutils, make GLT install fa… - #764

Draft
kmontemayor2-sc wants to merge 7 commits into
mainfrom
python-3.13-support-01-prereqs
Draft

kmontemayor2-sc wants to merge 7 commits into
mainfrom
python-3.13-support-01-prereqs

Conversation

@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator

…ilures fatal

Python 3.12 removed distutils and the deprecated unittest aliases, and GiGL uses both. The distutils imports work today only because setuptools is installed transitively and ships a compatibility shim; a library must not depend on that.

  • Add gigl.common.utils.parse.str_to_bool and use it in place of distutils.util.strtobool at all 15 call sites. Accepted and rejected spellings match strtobool. Every call site already coerced the result with bool() or used it as a condition, so the int to bool return change is not observable.
  • Rename the 26 assertEquals / assertNotEquals uses to assertEqual / assertNotEqual, and select ruff UP005 so they cannot return.
  • Make a failed install_glt.sh fatal. main() returned the child's status but the __main__ block discarded it, so requirements/install_py_deps.sh saw exit 0 under set -e and every base image build continued after a failed GLT install. Measured against a stub that exits 7: the old script exits 0, the new one exits 7. A successful install still exits 0.
  • Run ty twice in make type_check, at the 3.11 floor and at 3.13. ty resolves the standard library against one version per invocation, so the floor pass accepts modules 3.13 removed and only the ceiling pass rejects them.

Scope of work done

Where is the documentation for this feature?: N/A

Did you add automated tests or write a test plan?

Updated Changelog.md? NO

Ready for code review?: NO

…ilures fatal

Python 3.12 removed `distutils` and the deprecated `unittest` aliases, and GiGL uses
both. The `distutils` imports work today only because `setuptools` is installed
transitively and ships a compatibility shim; a library must not depend on that.

- Add `gigl.common.utils.parse.str_to_bool` and use it in place of
  `distutils.util.strtobool` at all 15 call sites. Accepted and rejected spellings
  match `strtobool`. Every call site already coerced the result with `bool()` or used
  it as a condition, so the `int` to `bool` return change is not observable.
- Rename the 26 `assertEquals` / `assertNotEquals` uses to `assertEqual` /
  `assertNotEqual`, and select ruff `UP005` so they cannot return.
- Make a failed `install_glt.sh` fatal. `main()` returned the child's status but the
  `__main__` block discarded it, so `requirements/install_py_deps.sh` saw exit 0 under
  `set -e` and every base image build continued after a failed GLT install. Measured
  against a stub that exits 7: the old script exits 0, the new one exits 7. A
  successful install still exits 0.
- Run `ty` twice in `make type_check`, at the 3.11 floor and at 3.13. `ty` resolves the
  standard library against one version per invocation, so the floor pass accepts
  modules 3.13 removed and only the ceiling pass rejects them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kmontemayor2-sc

Copy link
Copy Markdown
Collaborator Author

/help

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 23:18:23UTC :

🤖 Available PR Commands

You can trigger the following workflows by commenting on this PR:

  • /help - Checkout code
  • /unit_test_py - Run Python Unit Tests
  • /unit_test_cpp - Run C++ Unit Tests
  • /unit_test_scala - Run Scala Unit Tests
  • /integration_test - Run Integration Tests
  • /e2e_test - Run E2E Tests
  • /notebook_tests - Run Example Notebooks Tests
  • /lint_test - Run Linting Tests

💡 Usage: Simply comment on this PR with any of the commands above (e.g., /unit_test)

⏱️ Note: Commands may take some time to complete. Progress updates will be posted as comments.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 23:19:26UTC : Starting to build base images for CUDA and CPU.
This may take a while, please be patient.
The images will be pushed to the GCP Artifact Registry.
Once done, the workflow will update the gigl/dep_vars.env file with the new image names.

kmonte and others added 6 commits September 24, 2026 18:49
# Conflicts:
#	gigl/scripts/post_install.py
main added tests/unit/scripts_test/post_install_test.py, which runs the shipped
post_install.py with bash shimmed on PATH and asserts that a failing and a succeeding
install_glt.sh set the process exit code. That is the behaviour this branch's
tests/unit/scripts/post_install_test.py checked. With main's post_install.py taken in the
merge, the second file only duplicates the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
type_check ran ty twice with hard-coded minors (3.11 from pyproject,
3.13 from the Makefile). A single PYTHON_VERSION variable now picks the
interpreter for every uv command and the ty target version, so CI can
run the same targets once per minor (make ... PYTHON_VERSION=3.13).

PYTHON_VERSION defaults to the contents of .python-version and is
exported as UV_PYTHON; uv resolves that to the same interpreter it
picks from .python-version today. type_check passes the major.minor to
ty, which makes [tool.ty.environment] python-version redundant, so it
is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
type_check no longer has a separate 3.13 pass; the 3.13 check is
make type_check PYTHON_VERSION=3.13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workbench Dockerfile declared ARG PYTHON_VERSION="3.9". Docker exposes
a build ARG to RUN steps as an environment variable, and the Makefile now
reads PYTHON_VERSION to choose the interpreter, so `make install_deps` in
that image would ask uv for Python 3.9, which GiGL does not support. The
conda env and GiGL now use the same supported minor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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