Skip to content

Conversation

lan496
Copy link
Member

@lan496 lan496 commented Jul 5, 2024

Resolves #486 (comment)

@lan496 lan496 mentioned this pull request Jul 5, 2024
4 tasks
Copy link

codecov bot commented Jul 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.90%. Comparing base (3486a6d) to head (72319fb).
Report is 35 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #501   +/-   ##
========================================
  Coverage    83.90%   83.90%           
========================================
  Files           25       25           
  Lines         8185     8185           
  Branches      1709     1701    -8     
========================================
  Hits          6868     6868           
  Misses        1317     1317           
Flag Coverage Δ
c_api 74.78% <ø> (ø)
fortran_api 56.19% <ø> (ø)
python_api 80.36% <ø> (ø)
unit_tests 13.47% <ø> (ø)

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.

@lan496 lan496 marked this pull request as ready for review July 6, 2024 00:33
@lan496 lan496 requested a review from LecrisUT July 6, 2024 00:33
@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 6, 2024

We can still keep the if TYPE_CHECKING part, we just need the alias definitions outside of it. Those the | operator not work on python 3.9?

Can you add -Werror to

addopts = "-m 'not benchmark'"

We should also do something similar for the CMake builds and tests, the examples are using deprecated api as well.

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 6, 2024

I didn't find ny more usage in spglib.py, but try to use the regex pattern \[['"]\w+["']\]. At least in example I've found usage

@lan496
Copy link
Member Author

lan496 commented Jul 7, 2024

Those the | operator not work on python 3.9?

No, python 3.9 complains "TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'types.GenericAlias'"
https://github.com/spglib/spglib/actions/runs/9814689958/job/27102679055

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 8, 2024

About the Fedora failures, update .distro/Relax_numpy_requirements.patch to:

Subject: [PATCH] Relax numpy requirements
---
Index: pyproject.toml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/pyproject.toml b/pyproject.toml
--- a/pyproject.toml	(revision c4f576776c61725f90bd6becfb57b26a8c223883)
+++ b/pyproject.toml	(date 1720423830036)
@@ -1,7 +1,7 @@
 [build-system]
 # Numpy build and runtime dependencies are linked to ABI compatibility
 # A new wheel rebuild is needed when changing these
-requires = ["scikit-build-core", "numpy~=2.0"]
+requires = ["scikit-build-core", "numpy"]
 build-backend = "scikit_build_core.build"
 
 [project]
@@ -13,7 +13,7 @@
 readme = "python/README.rst"
 dynamic = ["version"]
 dependencies = [
-    "numpy>=1.20,<3",
+    "numpy>=1.20",
     "importlib-resources; python_version<'3.10'",
     "typing-extensions; python_version<'3.10'",
 ]

I still see issues with example_full.py. As a dirty fix, can you do the following patch:

--- a/test/example/CMakeLists.txt	(revision c4f576776c61725f90bd6becfb57b26a8c223883)
+++ b/test/example/CMakeLists.txt	(date 1720425410296)
@@ -20,10 +20,10 @@
 
 if (SPGLIB_WITH_Python)
     add_test(NAME example-python
-            COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/python_api/example.py
+            COMMAND ${Python_EXECUTABLE} -Werror ${CMAKE_CURRENT_SOURCE_DIR}/python_api/example.py
     )
     add_test(NAME example-python-full
-            COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/python_api/example_full.py
+            COMMAND ${Python_EXECUTABLE} -Werror ${CMAKE_CURRENT_SOURCE_DIR}/python_api/example_full.py
     )
     set_property(TEST example-python example-python-full
             APPEND PROPERTY

I will try to address them properly later together with the cmake tests.

Copy link
Collaborator

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

Ok, I've tested locally and -Werror worked, just that get_symmetry is not converted. I don't think that one should be converted to a dataclass in that form though.

@lan496
Copy link
Member Author

lan496 commented Jul 8, 2024

I will try to address them properly later together with the cmake tests.

Should I wait for your work before releasing the next version?

@LecrisUT
Copy link
Collaborator

LecrisUT commented Jul 8, 2024

I will try to address them properly later together with the cmake tests.

Should I wait for your work before releasing the next version?

No, go ahead. I'm waiting on #458 and #394, which should be merged after 2.5 release

@LecrisUT LecrisUT added this to the 2.5 milestone Jul 8, 2024
@lan496 lan496 enabled auto-merge July 8, 2024 12:42
@lan496 lan496 merged commit 79285b0 into spglib:develop Jul 8, 2024
@lan496 lan496 deleted the type-chore branch July 8, 2024 22:21
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.

Release v2.5.0
2 participants