Skip to content

Finish updates to OCCT 8.0.0 API#1493

Open
oursland wants to merge 4 commits into
tpaviot:review/occt800from
oursland:review/occt800
Open

Finish updates to OCCT 8.0.0 API#1493
oursland wants to merge 4 commits into
tpaviot:review/occt800from
oursland:review/occt800

Conversation

@oursland

@oursland oursland commented Jun 24, 2026

Copy link
Copy Markdown

This PR completes the updates to pythonocc-core to match compatibility with OCCT 8.0.0.

@sourcery-ai

sourcery-ai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates 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

Change Details Files
Bump OCCT dependency from 7.9.3 to 8.0.0 in the CI conda recipe.
  • Update the Jinja2 version variable from 7.9.3 to 8.0.0 so it propagates through the recipe.
  • Adjust the build requirements to depend on occt ==8.0.0.
  • Adjust the run-time requirements to depend on occt ==8.0.0, keeping Python and numpy constraints unchanged.
ci/conda/meta.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread ci/conda/meta.yaml
oursland added 2 commits June 24, 2026 22:33
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.
oursland added 2 commits June 25, 2026 09:00
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).
@oursland oursland changed the title Bump CI conda recipe to occt 8.0.0 Finish updates to OCCT 8.0.0 API Jun 26, 2026
@oursland

Copy link
Copy Markdown
Author

@tpaviot I think this PR is now ready for review.

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.

1 participant