Skip to content

Migrate to pybind11#576

Merged
LecrisUT merged 2 commits intospglib:developfrom
LecrisUT:feat/pybind11
May 12, 2025
Merged

Migrate to pybind11#576
LecrisUT merged 2 commits intospglib:developfrom
LecrisUT:feat/pybind11

Conversation

@LecrisUT
Copy link
Copy Markdown
Collaborator

@LecrisUT LecrisUT commented May 9, 2025

Took a while to convert these, but I got the basic structure there.

However, there are some test failures that I would need help pinning down.

@LecrisUT LecrisUT requested review from atztogo and lan496 May 9, 2025 21:26
@atztogo
Copy link
Copy Markdown
Collaborator

atztogo commented May 10, 2025

Related to MSG, I think @lan496 may be easier to see the reason of failures, but otherwise I will have a look.

@LecrisUT LecrisUT force-pushed the feat/pybind11 branch 2 times, most recently from b95a4d9 to 52927b4 Compare May 10, 2025 06:54
@codecov
Copy link
Copy Markdown

codecov bot commented May 10, 2025

Codecov Report

❌ Patch coverage is 90.09288% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.33%. Comparing base (0be9860) to head (2073627).
⚠️ Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
python/py_bindings.cpp 88.77% 23 Missing and 9 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #576      +/-   ##
===========================================
+ Coverage    74.09%   74.33%   +0.23%     
===========================================
  Files           25       26       +1     
  Lines         8049     7878     -171     
  Branches      1682     1630      -52     
===========================================
- Hits          5964     5856     -108     
+ Misses        1577     1541      -36     
+ Partials       508      481      -27     
Flag Coverage Δ
c_api 68.67% <ø> (ø)
fortran_api 50.96% <ø> (ø)
python_api 67.07% <90.09%> (+0.11%) ⬆️
unit_tests 11.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LecrisUT
Copy link
Copy Markdown
Collaborator Author

Found my typo

@atztogo
Copy link
Copy Markdown
Collaborator

atztogo commented May 11, 2025

@lan496, it seems the test failures were fixed by @LecrisUT.

@lan496 lan496 requested a review from Copilot May 11, 2025 10:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the Python API to use pybind11 for generating bindings. Key changes include the update of type annotations in the Python stub file, the addition of new pybind11 function bindings in the C++ headers and implementation, and related updates to the build configuration and changelog.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
python/spglib/_spglib.pyi Updated type annotations and added deprecation decorator
python/py_bindings.h Added function bindings using pybind11
python/_spglib.cpp Implemented the pybind11 module for the Spglib binding
pyproject.toml Updated build requirements to include pybind11
ChangeLog.md Documented the migration to pybind11 for the Python API
Files not reviewed (1)
  • python/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (2)

python/spglib/_spglib.pyi:105

  • Confirm that tests are updated to cover the new 'atom_types' parameter in the symmetry_with_collinear_spin function.
atom_types: np.ndarray,

python/spglib/_spglib.pyi:98

  • Ensure that the 'deprecated' decorator is imported or defined in this module to avoid a NameError at runtime.
@deprecated("Not used")

Copy link
Copy Markdown
Member

@lan496 lan496 left a comment

Choose a reason for hiding this comment

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

LGTM

@LecrisUT LecrisUT enabled auto-merge (squash) May 12, 2025 09:57
LecrisUT added 2 commits May 12, 2025 11:57
@LecrisUT LecrisUT merged commit cff3a27 into spglib:develop May 12, 2025
43 of 49 checks passed
@LecrisUT LecrisUT deleted the feat/pybind11 branch May 12, 2025 10:04
lan496 added a commit that referenced this pull request Nov 11, 2025
For now we make the dict from the python side directly. A further
simplification would be to move the class inside as a C++ class or
making it a thin wrapper of one. That I will probably postpone until we
get enough familiarity with the tools.

Depends-on: #576
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.

4 participants