Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename mesh.points -> mesh.cells #508

Merged
merged 4 commits into from Nov 22, 2023
Merged

Rename mesh.points -> mesh.cells #508

merged 4 commits into from Nov 22, 2023

Conversation

swapneelap
Copy link
Member

No description provided.

Copy link
Contributor

PR Analysis

  • 🎯 Main theme: Renaming 'points' to 'cells' in the discretisedfield package
  • 📝 PR summary: This PR involves a significant renaming operation across multiple files in the discretisedfield package. The term 'points' has been replaced with 'cells', which has led to changes in variable names, function names, and comments.
  • 📌 Type of PR: Refactoring
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR involves a straightforward renaming operation, but it spans across multiple files and functions, which requires some time to review.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The renaming operation seems to be consistent across all the files. However, it would be beneficial to add a brief explanation in the PR description about why this renaming was necessary, and how it improves the codebase. This will help reviewers and future contributors understand the rationale behind this change. Also, it would be good to ensure that all related documentation is updated to reflect this change.

  • 🤖 Code feedback:

    • relevant file: discretisedfield/mesh.py
      suggestion: Consider adding a deprecation warning for the 'points' attribute to guide users towards the new 'cells' attribute. This can be done by re-adding a 'points' property that returns the 'cells' attribute and raises a DeprecationWarning. [important]
      relevant line: '+ def cells(self):'

    • relevant file: discretisedfield/field.py
      suggestion: Ensure that the renaming of 'points' to 'cells' does not affect any external dependencies or break any interfaces that might be expecting the 'points' attribute. [medium]
      relevant line: '+ if len(coords := getattr(self.mesh.cells, dim)) > 1'

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback.
/ask <QUESTION>: Pose a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a828938) 93.49% compared to head (a194301) 93.49%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #508   +/-   ##
=======================================
  Coverage   93.49%   93.49%           
=======================================
  Files          28       28           
  Lines        3027     3027           
=======================================
  Hits         2830     2830           
  Misses        197      197           

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

@swapneelap
Copy link
Member Author

Should we add a deprecation warning for the 'points' attribute to guide users towards the new 'cells' attribute by re-adding the points property that returns the cells attribute and raises a DeprecationWarning as the bot says? @samjrholt @lang-m

@samjrholt
Copy link
Member

Should we add a deprecation warning for the 'points' attribute to guide users towards the new 'cells' attribute by re-adding the points property that returns the cells attribute and raises a DeprecationWarning as the bot says? @samjrholt @lang-m

I would be in favour of using DeprecationWarning in general as it makes it easier for the users to transition.

@lang-m
Copy link
Member

lang-m commented Nov 20, 2023

I would re-add points to make the transition easier. What we could consider however is raising an AttributeError with a meaningful message that points to cells (instead of just the warning). That is what we did for most breaking changes in the previous release. This is of course quite harsh but forces quick adoption of the new interface. Thoughts (also @fangohr)?

@lang-m
Copy link
Member

lang-m commented Nov 22, 2023

/review -i

Copy link
Contributor

Incremental PR Review

  • ⏮️ Review for commits since previous PR-Agent review: Starting from commit a194301
    (fix(docs): replace mesh.points -> mesh.cells)

PR Analysis

  • 🎯 Main theme: Renaming of 'points' to 'cells' in the mesh module and updating the documentation accordingly.
  • 📝 PR summary: This PR involves renaming the 'points' attribute to 'cells' in the mesh module. The changes are reflected in the code and the documentation. The PR also includes some minor changes in the code comments and the version of Python used in the notebook.
  • 📌 Type of PR: Refactoring
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 2, because the changes are mostly renaming and minor updates in the comments and documentation. There are no complex code changes.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR is well-structured and the changes are clear. However, it would be beneficial to include tests that verify the correct functioning of the renamed attribute. Additionally, the PR description is missing, which could make it harder for others to understand the purpose and impact of the changes.

  • 🤖 Code feedback:

    • relevant file: discretisedfield/mesh.py
      suggestion: Consider adding a deprecation warning for the 'points' attribute to inform users about the change and give them time to update their code. [important]
      relevant line: "+ _removed_attributes = {"midpoints": "cells", "points": "cells"}"

    • relevant file: discretisedfield/mesh.py
      suggestion: It would be helpful to add more detailed comments explaining why the 'points' attribute was renamed to 'cells'. This can provide valuable context for future contributors. [medium]
      relevant line: "+ def cells(self):"

How to use

Instructions

To invoke the PR-Agent, add a comment using one of the following commands:
/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs: Generate docstring for new components introduced in the PR.
/generate_labels: Generate labels for the PR based on the PR's contents.
see the tools guide for more details.

To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

@lang-m lang-m merged commit 8e515bb into master Nov 22, 2023
8 checks passed
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.

mesh.midpoints -> mesh.cells (coordinate of the midpoint of that cell)
4 participants