-
Notifications
You must be signed in to change notification settings - Fork 294
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 support / imp module deleted #1669
Conversation
Hi @EvanBldy , it would be preferable if you remove any whitespace changes and formatting changes if possible. |
82bda96
to
e4e2150
Compare
It should be better :) |
387bde2
to
46b29f0
Compare
The tests are passing in Python 3.8 but not in 3.12, I don't understand the error neither what this code is intended to (https://github.com/AcademySoftwareFoundation/OpenTimelineIO/actions/runs/6462945630/job/17545363452?pr=1669) |
Hi @EvanBldy, thank you for working on this! If you want to try running the tests locally, the usual process is to use these commands to setup and activate a development virtual environment: python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]' # This builds and installs OTIO and the development dependencies in your virtualenv Depending on your setup, you may want to do Then, each time you make a change, you can run: python setup.py install # This rebuilds OTIO with the changes and installs it into the env - goes quicker after the first time
make ci-prebuild # This is what CI uses to lint and make sure all the extra data files needed are included
make test # A shortcut for running the test suite
make ci-postbuild # This is where the CI error was coming from That should help you see what will happen in CI locally. In terms of what autogen_serialized_datamodel.py does, that script autogenerates the markdown for this file and this file. Digging into the error a bit more, I think the issue had to do with some internals of how a File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/opentimelineio/console/autogen_serialized_datamodel.py", line 206, in <lambda>
key=lambda mod: str(mod)
^^^^^^^^
File "<frozen importlib._bootstrap>", line 545, in _module_repr
File "<frozen importlib._bootstrap>", line 830, in _module_repr_from_spec
AttributeError: 'VendorImporter' object has no attribute '_path' This block of code is meant to traverse down into all the submodules. It's hitting some hiccup when it encounters To address this, I did a small rewrite of that block of code: new_mods = sorted(
(
thing for _, thing in inspect.getmembers(mod)
if (
inspect.ismodule(thing)
and thing not in modules
and "opentimelineio" in thing.__name__
and all(not thing.__name__.startswith(t) for t in SKIP_MODULES)
)
),
key=lambda mod: str(mod)
) The main part is that I added an extra filter condition in there to only get modules that are part of opentimelineio. Testing locally, this seems to work for me. Feel free to give that a whirl and update the PR - I think that should fix it up! |
Hi @reinecke, |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1669 +/- ##
=======================================
Coverage 79.84% 79.84%
=======================================
Files 197 197
Lines 21792 21796 +4
Branches 4358 4358
=======================================
+ Hits 17399 17403 +4
Misses 2232 2232
Partials 2161 2161
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
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.
One test is failing on Windows with 3.12 (https://github.com/AcademySoftwareFoundation/OpenTimelineIO/actions/runs/6677197744/job/18146955106?pr=1669#step:9:24). Also I left a note about Pybind11.
Yeah, I'm trying to know what's the problem :) The test seems to be buggy only on Windows / Python 3.12, probably a new change in Python 3.12 |
b456f6b
to
b3ca8d5
Compare
It should be fixed :) |
Hi @JeanChristopheMorinPerso @reinecke, are you okay with my PR ? |
Hi ! Do you have news about this ? |
Hi @EvanBldy -
Are those intentional? We prefer to keep PRs targeted at one specific thing. Would it be possible to revert those files and submit the changes to them as separate PRs? Otherwise this is a great update and I'd love to get it in before the 0.16.0 release. |
Hi @reinecke, thanks for your answer. For the changes :
Cool if it can be in the 0.16.0 release. |
Signed-off-by: Evan Blaudy <[email protected]>
… python 3.12 Signed-off-by: Evan Blaudy <[email protected]>
…in Python 3.12 for autogen_serialized_datamodel.py Signed-off-by: Evan Blaudy <[email protected]>
Signed-off-by: Evan Blaudy <[email protected]>
…hon 3.12 Signed-off-by: Evan Blaudy <[email protected]>
…o support python 3.12 Signed-off-by: Evan Blaudy <[email protected]>
I have removed the changes about DeprecationWarning and made a separate PR : #1688 |
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.
Thank you for all your work on this!
Link the Issue(s) this Pull Request is related to.
#1668
Summarize your change.
The imp module in Python is deprecated since Python 3.4 and is removed in Python 3.12. So the package cannot be imported in Python 3.12 because the imp module doesn't exist anymore. See my issue.
By reading the docs it have to be changed by importlib. So I have made these changes and this works for importing adapters for example :)
Some documentation :
https://docs.python.org/3.12/whatsnew/3.12.html#imp
https://docs.python.org/3.11/library/imp.html
I have added Python 3.12 in the workflow for Python package.
I use some linter (black) in my vscode so my changes can be more than the real modifications. If you want I can revert these changes.
Reference associated tests.
Don't have launched the tests, they will run via GitHub Actions, no ?
I'm sorry it's my first PR to OpenTimeLineIO :)