-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update to Python 3.11 #662
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.8.12 | ||
3.11.7 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +0,0 @@ | ||
"""Setup environment before loading app.""" | ||
|
||
import ctypes.util | ||
import sys | ||
from ctypes import CDLL | ||
|
||
|
||
def patch_ctypes_on_macos_11(): # pragma: no cover | ||
"""Work around a problem loading pywb under macOS 11. | ||
|
||
pywb has a dependency on an old version of fakeredis which fails to load | ||
when using Python <= 3.8 under macOS 11. This function patches `ctypes.util.find_library` | ||
to work around the issue. | ||
|
||
See https://github.com/hypothesis/viahtml/issues/55. | ||
""" | ||
|
||
if sys.platform != "darwin": | ||
return | ||
|
||
def _find_library_patched(name): | ||
path = f"lib{name}.dylib" | ||
try: | ||
# In macOS 11, some system libraries don't exist on disk. Instead you test | ||
# the validity of a library path by trying to load it. | ||
# See https://bugs.python.org/issue41179. | ||
CDLL(path) | ||
except OSError: | ||
# Fall back to the un-patched version. | ||
path = ctypes.util.find_library(name) | ||
return path | ||
|
||
ctypes.util.find_library = _find_library_patched | ||
|
||
|
||
# Apply ctypes patch before pywb is imported. | ||
patch_ctypes_on_macos_11() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that important but this is a minor version lower than the version in Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from h. Dependabot updates the Dockerfile but it doesn't know about
.python-version
, so we'll have this minor skew across our projects.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we've ever seen problems due to Python minor version differences between what we use in dev and what the Docker container uses, but perhaps this could be bumped periodically by the cookiecutter or something? CC @seanh .