Skip to content

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

Draft
kmontemayor2-sc wants to merge 1 commit into
mainfrom
python-3.13-support-01-prereqs
Draft

Prepare for Python 3.12 and 3.13: drop distutils, make GLT install fa…#764
kmontemayor2-sc wants to merge 1 commit 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.

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