Skip to content

simpler dep handling + versions#887

Merged
PhilipDeegan merged 1 commit intoPHAREHUB:masterfrom
PhilipDeegan:releases
Sep 5, 2024
Merged

simpler dep handling + versions#887
PhilipDeegan merged 1 commit intoPHAREHUB:masterfrom
PhilipDeegan:releases

Conversation

@PhilipDeegan
Copy link
Member

@PhilipDeegan PhilipDeegan commented Sep 3, 2024

Summary by CodeRabbit

  • New Features

    • Introduced simplified functions for managing Git repository updates, enhancing the build process for dependencies.
    • Streamlined handling of multiple dependencies (Caliper, cppdict, HighFive, Phlop, pybind, SAMRAI) through a unified update mechanism.
  • Bug Fixes

    • Improved maintainability and readability by reducing complex conditional logic in dependency management.
  • Documentation

    • Updated comments and documentation to reflect the new streamlined processes for dependency handling.
  • Enhancements

    • Enhanced type safety and clarity in file access mode handling within the H5Writer and HighFiveFile classes.

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2024

Walkthrough

Walkthrough

The changes introduce two new functions, phare_git_get_or_update and phare_github_get_or_update, in the CMake configuration files to streamline the management of Git and GitHub repositories. Existing logic for checking the existence of various dependencies has been replaced with direct calls to these functions, simplifying the process of cloning and updating repositories across multiple CMake files. Additionally, modifications were made to enhance type safety in the H5Writer and HighFiveFile classes by changing the flags parameter to use specific enumeration types.

Changes

Files Change Summary
res/cmake/dep.cmake Introduced phare_git_get_or_update and phare_github_get_or_update functions for repository management.
res/cmake/dep/caliper.cmake, res/cmake/dep/cppdict.cmake, res/cmake/dep/highfive.cmake, res/cmake/dep/phlop.cmake, res/cmake/dep/pybind.cmake, res/cmake/dep/samrai.cmake Replaced conditional logic with calls to phare_github_get_or_update for managing respective dependencies.
src/diagnostic/detail/h5writer.hpp Changed flags parameter types in H5Writer class from unsigned to HiFile::AccessMode.
src/hdf5/detail/h5/h5_file.hpp Updated HighFiveFile class to use FileOp type alias for flags parameter instead of unsigned.
tests/diagnostic/test_diagnostics.hpp Modified Hi5Diagnostic constructor to use HiFile::AccessMode for flags instead of unsigned.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
res/cmake/dep/pybind.cmake (1)

14-14: Consider using a specific version or tag instead of master.

Using a specific version or tag for PYBIND11_VERSION is generally recommended for better reproducibility and stability. The master branch may contain unstable or breaking changes.

For example, you can use the latest stable version:

set(PYBIND11_VERSION v2.10.4)

Or, you can use a specific commit hash:

set(PYBIND11_VERSION 52d2c5e0b0b5b8e1197a08c9201b79ac1a21e75a)
res/cmake/dep/highfive.cmake (1)

7-7: Consider using a specific version or tag instead of "master".

Using a specific version or tag for the HIGHFIVE_VERSION variable is generally recommended for better reproducibility and stability.

set(HIGHFIVE_VERSION v2.3.1) # Replace with the desired version or tag
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5933e40 and eb910bb.

Files selected for processing (7)
  • res/cmake/dep.cmake (1 hunks)
  • res/cmake/dep/caliper.cmake (1 hunks)
  • res/cmake/dep/cppdict.cmake (1 hunks)
  • res/cmake/dep/highfive.cmake (1 hunks)
  • res/cmake/dep/phlop.cmake (1 hunks)
  • res/cmake/dep/pybind.cmake (1 hunks)
  • res/cmake/dep/samrai.cmake (1 hunks)
Additional comments not posted (10)
res/cmake/dep/cppdict.cmake (2)

4-4: Verify the usage of the master branch for the CPPDICT_VERSION.

Using a branch name like master instead of a specific version tag might lead to unexpected changes in the future. It's generally recommended to use specific version tags for stable builds.

If you intend to use a stable version of cppdict, consider using a specific version tag instead of the master branch. You can find the available version tags in the cppdict releases.


5-5: LGTM!

The usage of the phare_github_get_or_update function simplifies the dependency management for cppdict. The function call looks correct and matches the expected usage based on the function name and arguments.

res/cmake/dep/phlop.cmake (1)

5-5: LGTM! The change simplifies the dependency management.

The change replaces the previous logic for managing the Phlop dependency with a single call to the phare_github_get_or_update function, which abstracts the cloning and updating process into one command. This simplifies the control flow and improves code reusability and maintainability.

Verify that the phare_github_get_or_update function is implemented correctly and handles all the necessary cases, such as:

  • Cloning the repository if it doesn't exist.
  • Updating the repository to the latest version if it already exists.
  • Handling any errors that may occur during the cloning or updating process.

You can use the following script to search for the function definition and analyze its implementation:

res/cmake/dep/pybind.cmake (1)

16-16: LGTM!

The changes simplify the process of managing the pybind11 subproject by using the phare_github_get_or_update function. The function call provides the necessary arguments and is in line with the PR objectives.

res/cmake/dep/caliper.cmake (1)

21-21: LGTM!

The code change simplifies the management of the Caliper dependency by replacing the conditional logic with a single call to the phare_github_get_or_update function. This improves maintainability, readability, and aligns with the PR objective of simplifying dependency handling.

res/cmake/dep.cmake (2)

3-14: LGTM!

The code changes are approved. The function is correctly implemented and handles the cloning and updating of a Git repository based on the provided arguments and the devMode variable. It uses the recommended execute_process command to run Git commands and the message command to print a helpful message when downloading the latest updates.


16-18: LGTM!

The code changes are approved. The function is correctly implemented and simplifies the process of updating a GitHub repository by constructing the URL based on the provided repository name and branch. It calls phare_git_get_or_update with the constructed URL, which is a good way to reuse the functionality of phare_git_get_or_update and avoid code duplication.

res/cmake/dep/highfive.cmake (1)

9-9: LGTM!

The phare_github_get_or_update function call simplifies the management of the HighFive dependency and improves the maintainability and readability of the CMake configuration.

res/cmake/dep/samrai.cmake (2)

13-13: LGTM!

Setting a default version for SAMRAI is a good practice for maintainability.


17-17: LGTM!

The new function call to phare_github_get_or_update simplifies the process of cloning and updating the SAMRAI repository, which enhances maintainability and reduces complexity. The function arguments are correctly passed, including the repository owner and name, and the version.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
res/cmake/dep/cppdict.cmake (1)

4-4: Consider using a specific version tag instead of the master branch.

Using a branch name like master might lead to unexpected changes in the future. For stable builds, it's generally recommended to use specific version tags.

set(CPPDICT_VERSION v1.0.0) # Replace with the desired version tag
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eb910bb and 1261097.

Files selected for processing (11)
  • res/cmake/dep.cmake (1 hunks)
  • res/cmake/dep/caliper.cmake (1 hunks)
  • res/cmake/dep/cppdict.cmake (1 hunks)
  • res/cmake/dep/highfive.cmake (1 hunks)
  • res/cmake/dep/phlop.cmake (1 hunks)
  • res/cmake/dep/pybind.cmake (1 hunks)
  • res/cmake/dep/samrai.cmake (1 hunks)
  • src/diagnostic/detail/h5writer.hpp (5 hunks)
  • src/hdf5/detail/h5/h5_file.hpp (3 hunks)
  • tests/diagnostic/test_diagnostics.hpp (3 hunks)
  • tests/simulator/test_diagnostics.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • res/cmake/dep/pybind.cmake
Files skipped from review as they are similar to previous changes (4)
  • res/cmake/dep.cmake
  • res/cmake/dep/caliper.cmake
  • res/cmake/dep/phlop.cmake
  • res/cmake/dep/samrai.cmake
Additional context used
Path-based instructions (3)
src/hdf5/detail/h5/h5_file.hpp (1)

Pattern **/*.hpp: Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.

tests/diagnostic/test_diagnostics.hpp (1)

Pattern **/*.hpp: Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.

src/diagnostic/detail/h5writer.hpp (1)

Pattern **/*.hpp: Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.

Additional comments not posted (12)
res/cmake/dep/cppdict.cmake (1)

5-5: LGTM!

The code changes are approved. The use of the phare_github_get_or_update function streamlines the dependency management and improves the maintainability of the code.

res/cmake/dep/highfive.cmake (1)

9-9: LGTM!

The code changes are approved. The phare_github_get_or_update function simplifies the process of managing the HighFive library.

tests/simulator/test_diagnostics.py (1)

209-210: LGTM!

The updated assertion for validating the highfive_version attribute is more flexible and allows for potential pre-release identifiers in the patch version while still ensuring that the major and minor versions are correctly formatted as digits.

src/hdf5/detail/h5/h5_file.hpp (2)

16-16: LGTM!

The new type alias FileOp improves code readability and type safety by providing a more descriptive name for the HighFive::File::AccessMode type.


46-46: LGTM!

The changes to use the FileOp type alias for the flags parameter in the createHighFiveFile method and the constructor of the HighFiveFile class improve type safety and clarity. The reformatting of the file() method is also fine.

Also applies to: 64-64, 72-72

tests/diagnostic/test_diagnostics.hpp (2)

19-19: LGTM!

The change simplifies the file access logic by using a single access mode for overwriting files. This aligns with the PR objective of simplifying dependency handling.


50-50: Enhance type safety and clarity.

The changes to the constructor parameter and member variable types enhance type safety and clarity:

  • Using auto const for the flags parameter allows the compiler to deduce the type while ensuring that the value cannot be modified.
  • Updating the flags_ member variable to be of type HiFile::AccessMode const ensures consistency with the constructor parameter.

These changes adhere to the principles of clean code and expressiveness.

Also applies to: 94-95

src/diagnostic/detail/h5writer.hpp (5)

53-53: Improved type safety and expressiveness.

The change from using an unsigned constant to the HiFile::AccessMode enum improves type safety and code expressiveness.


59-59: Improved type safety in the constructor.

Changing the flags parameter type to HiFile::AccessMode in the constructor enhances type safety and maintains consistency with the rest of the class.


71-72: Improved type safety in the make_unique method.

Using HiFile::AccessMode for the flags variable in the make_unique method enhances type safety and maintains consistency with the rest of the class.


97-97: Improved type safety in the makeFile method and flags member variable.

Changing the file_flag parameter type to HiFile::AccessMode in the makeFile method and the flags member variable type to HiFile::AccessMode enhances type safety and maintains consistency with the rest of the class.

Also applies to: 171-171


181-181: Improved type safety in the file_flags member variable.

Changing the mapped type of the file_flags member variable from unsigned to HiFile::AccessMode enhances type safety and maintains consistency with the rest of the class.

if(HighFive)

set (HIGHFIVE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/highfive)
set (HIGHFIVE_VERSION master)
Copy link

@coderabbitai coderabbitai bot Sep 3, 2024

Choose a reason for hiding this comment

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

Use a specific version or tag instead of "master".

Setting the version to "master" may introduce breaking changes. For stability and reproducibility, it is recommended to use a specific version or tag.

Consider using a specific version or tag, for example:

set(HIGHFIVE_VERSION v2.3.1)

Copy link
Member Author

Choose a reason for hiding this comment

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

if you look at the diff, the version was always set to master, this mechanism is to allow us to set particular versions for releasing this software, which should happen soon

Copy link

Choose a reason for hiding this comment

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

@PhilipDeegan, understood! Thanks for the clarification. It's clear that the use of "master" is intentional for now, with plans to set specific versions during the release process. This approach makes sense during the development phase.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
res/cmake/dep/samrai.cmake (1)

17-17: Simplification through phare_github_get_or_update is beneficial, but ensure robust error handling.

The introduction of phare_github_get_or_update to manage the SAMRAI repository simplifies the CMake configuration significantly. However, it's crucial to ensure that this function includes robust error handling to manage potential issues during the fetch or update processes.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1261097 and 77a3335.

Files selected for processing (7)
  • res/cmake/dep.cmake (1 hunks)
  • res/cmake/dep/caliper.cmake (1 hunks)
  • res/cmake/dep/cppdict.cmake (1 hunks)
  • res/cmake/dep/highfive.cmake (1 hunks)
  • res/cmake/dep/phlop.cmake (1 hunks)
  • res/cmake/dep/pybind.cmake (1 hunks)
  • res/cmake/dep/samrai.cmake (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • res/cmake/dep.cmake
  • res/cmake/dep/caliper.cmake
  • res/cmake/dep/cppdict.cmake
  • res/cmake/dep/phlop.cmake
  • res/cmake/dep/pybind.cmake
Additional comments not posted (2)
res/cmake/dep/highfive.cmake (1)

9-9: Streamlined dependency management with phare_github_get_or_update.

Using phare_github_get_or_update to handle the HighFive library simplifies the dependency management process significantly. This change enhances maintainability and reduces the complexity of the script.

res/cmake/dep/samrai.cmake (1)

13-15: Consider using a stable SAMRAI version for production builds.

Setting the SAMRAI version to "develop" ensures that the latest development state is used, which might not always be stable. Consider using a stable release version for production builds to avoid potential issues with unstable features.

if(HighFive)

set (HIGHFIVE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/highfive)
set (HIGHFIVE_VERSION master)
Copy link

Choose a reason for hiding this comment

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

Acknowledgment of version setting to "master".

The setting of HIGHFIVE_VERSION to "master" is noted. While this is suitable for development, it's important to switch to a stable release version in production to avoid potential breaking changes.

@PhilipDeegan PhilipDeegan merged commit 951578d into PHAREHUB:master Sep 5, 2024
@PhilipDeegan PhilipDeegan deleted the releases branch September 5, 2024 14:31
This was referenced Sep 11, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 9, 2024
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Jan 6, 2025
UCaromel pushed a commit to UCaromel/PHARE that referenced this pull request Jan 13, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 31, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 27, 2026
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.

2 participants