Finish updates to OCCT 8.0.0 API#1493
Open
oursland wants to merge 4 commits into
Open
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the CI conda recipe to build and run against OCCT 8.0.0 instead of 7.9.3 by bumping the shared version variable and aligning both build and run requirements. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="ci/conda/meta.yaml" line_range="32" />
<code_context>
-{% set version = "7.9.3" %}
+{% set version = "8.0.0" %}
package:
</code_context>
<issue_to_address>
**suggestion:** Use the `version` jinja variable for the `occt` dependency to avoid manual duplication.
Hardcoding `occt ==8.0.0` duplicates the version and risks inconsistencies on future bumps. Please reference the existing Jinja variable instead, e.g. `- occt =={{ version }}`, so version changes stay centralized.
```suggestion
- occt =={{ version }}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
OCCT 8.0.0 removed NCollection_BasePointerVector.hxx. The class is already %ignore'd in NCollection.i (its methods are Standard_EXPORT but not exported from libTKernel), but NCollection_module.hxx still pulled the header in. Since that aggregated module header is included by many generated wrappers (Message, FSD, ...), every dependent wrapper failed with a fatal "No such file or directory". Comment out the include to match the .i handling.
OCCT 8.0.0 added deleted copy/move members to BRepAlgoAPI_BuilderAlgo, so the SWIG generator dropped it into the @classnotwrapped excluded list. That severed the inheritance chain BooleanOperation/Splitter -> BuilderAlgo -> Algo, hiding the inherited Shape() from every boolean operation (Fuse/Common/Cut/Section/Splitter). The classic-bottle test failed with "'BRepAlgoAPI_Fuse' object has no attribute 'Shape'". Re-wrap BuilderAlgo (empty body, base BRepAlgoAPI_Algo) so the chain reconnects and Shape() is exposed again. Verified via the Python MRO and hasattr on a local OCCT 8.0.0 build.
The occt800 stub regeneration emitted several constructs that are not valid Python, causing `mypy test_mypy_classic_occ_bottle.py` (run by ci/conda/run_test.sh) to fail at the first syntax error (Geom.pyi:1242) before type-checking even started. Fixes, all in the committed .pyi: - C++ template types leaked into stubs, e.g. `NCollection_Sequence<opencascade::handle<Geom_BSplineSurface>>`. Map each to its %template() Python alias (Geom_SequenceOfBSplineSurface, ...); array instantiations without an alias fall back to Any. - `TCollection_AsciiString::EmptyString()` C++ default-arg values -> ... . - Standard_ErrorHandler.Error() now returns a std::variant<...> in OCCT 8.0.0; the generator garbled it to `OSD_SIGBUS,`. Type as Any. - BRepAlgoAPI_BuilderAlgo was emitted as a base-less @classnotwrapped stub, so the type chain lost the inherited Shape() (mirror of the runtime fix). Give it its BRepAlgoAPI_Algo base. - GCE2d_Make* are typedefs of GC_*2d in OCCT 8.0.0; rendered as NewType(...) they lose the underlying constructors. Make them plain aliases, matching the runtime (GCE2d_MakeSegment = GC_MakeSegment2d). - Add the missing `from typing import Any` to every stub that uses Any. With these, mypy reports "Success: no issues found"; the full pytest suite already passes (190 passed, 18 skipped) per CI build 6543.
…ndows link) OCCT 8.0.0 added inline std::u16string_view constructor, operator+= and AssignCat to TCollection_ExtendedString whose bodies call the private, non-exported allocate()/reallocate(). Wrapping them makes the generated TCollectionPYTHON_wrap.cxx reference those symbols, which the MSVC linker cannot resolve (TKernel.lib does not export them), breaking _TCollection.pyd: LNK2019: unresolved external symbol "TCollection_ExtendedString::allocate(int)" LNK2019: unresolved external symbol "TCollection_ExtendedString::reallocate(int)" Other platforms tolerate the references, so it only fails on Windows. The u16string_view overloads are also unreachable from Python (no typemap converts str to u16string_view); str construction uses the char16_t*/ wchar_t* ctors. So: - skip the u16string_view constructor and AssignCat overload, and - rewrite the __iadd_wrapper__(u16string_view) body to call the Standard_EXPORT AssignCat(char16_t*, int) instead of operator+=. Verified: after rebuild the wrap object has no undefined allocate/ reallocate refs, and test_core_wrapper_features still passes (67 passed). AsciiString's std::string_view members are unaffected (its allocate is inline-available, so it already linked on Windows).
Author
|
@tpaviot I think this PR is now ready for review. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR completes the updates to
pythonocc-coreto match compatibility with OCCT 8.0.0.