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

Python 3.12 Compatibility #374

Closed
1 of 2 tasks
AndydeCleyre opened this issue Nov 21, 2023 · 0 comments · Fixed by #373
Closed
1 of 2 tasks

Python 3.12 Compatibility #374

AndydeCleyre opened this issue Nov 21, 2023 · 0 comments · Fixed by #373

Comments

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Nov 21, 2023

I thought it would be worthwhile to have an issue tracking anything needed for Python 3.12 compatibility, as more blockers may come up as some are fixed. So far I can identify two problems:

EDIT: Both of these are now addressed by PR #373.

For the distutils migration, it may be as simple as:

diff --git a/ward/_collect.py b/ward/_collect.py
index d72a57e..d288b10 100644
--- a/ward/_collect.py
+++ b/ward/_collect.py
@@ -5,10 +5,10 @@ import os
 import pkgutil
 import sys
 from dataclasses import dataclass
-from distutils.sysconfig import get_python_lib
 from importlib._bootstrap import ModuleSpec  # type: ignore[import]
 from importlib._bootstrap_external import FileFinder  # type: ignore[import]
 from pathlib import Path
+from sysconfig import get_path
 from types import ModuleType
 from typing import Callable, Iterable, List, Optional, Set, Tuple
 
@@ -113,7 +113,7 @@ def get_info_for_modules(
 
                 # ignore site-packages directories
                 abs_path = dir_path.absolute()
-                if str(abs_path).startswith(get_python_lib()):
+                if str(abs_path).startswith(get_path('platlib')):
                     continue
 
                 # if we have seen this path before, skip it

Python 3.12 was released on October 2nd.

@darrenburns I'm not sure how much availability you have for ward maintenance these days, or if there's someone else you can bring in to help, but I'd love to keep using this project with the current Python release and going forward.

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 a pull request may close this issue.

1 participant