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

feat: a sympy backend #442

Merged
merged 45 commits into from
Apr 23, 2024
Merged

feat: a sympy backend #442

merged 45 commits into from
Apr 23, 2024

Conversation

Saransh-cpp
Copy link
Member

Description

Kindly take a look at CONTRIBUTING.md.

Please describe the purpose of this pull request. Reference and link to any relevant issues or pull requests.

Checklist

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't any other open Pull Requests for the required change?
  • Does your submission pass pre-commit? ($ pre-commit run --all-files or $ nox -s lint)
  • Does your submission pass tests? ($ pytest or $ nox -s tests)
  • Does the documentation build with your changes? ($ cd docs; make clean; make html or $ nox -s docs)
  • Does your submission pass the doctests? ($ pytest --doctest-plus src/vector/ or $ nox -s doctests)

Before Merging

  • Summarize the commit messages into a brief review of the Pull request.

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 84.81013% with 120 lines in your changes are missing coverage. Please review.

Project coverage is 86.77%. Comparing base (a16da6d) to head (2a29f81).

Files Patch % Lines
src/vector/backends/sympy.py 85.08% 108 Missing ⚠️
src/vector/_lib.py 86.44% 8 Missing ⚠️
src/vector/__init__.py 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #442      +/-   ##
==========================================
+ Coverage   86.38%   86.77%   +0.39%     
==========================================
  Files          96       98       +2     
  Lines       11139    11927     +788     
==========================================
+ Hits         9622    10350     +728     
- Misses       1517     1577      +60     

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

@Saransh-cpp
Copy link
Member Author

TODO:

  • add docs
  • create a new release once this is reviewed and merged

src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
src/vector/backends/sympy.py Outdated Show resolved Hide resolved
@Saransh-cpp Saransh-cpp marked this pull request as ready for review April 22, 2024 11:34
@Saransh-cpp Saransh-cpp changed the title (WIP) feat: a sympy backend feat: a sympy backend Apr 22, 2024
@Saransh-cpp
Copy link
Member Author

Should finally be ready for a review!

Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

All of this looks great! I made some high-level comments below, and I'm trusting the tests to ensure that the implementation is line-by-line correct.

I see that there are a lot more tests, but strangely, it's failing because Codecov says it's undershooting the target line coverage. I don't see how that's possible, considering that you added a few more classes and a lot more tests, including tests of non-SymPy functionality that wasn't tested before.

Is Codecov wrong? If not, is there a way to satisfy it with just a few more tests? If not, maybe we should just lower its threshold. Going a little under 85% is not terrible. Some lines of code will never be tested, like

    else:
        raise AssertionError(
            f"unexpected case; should never get here {data = }"
        )

@@ -54,6 +54,7 @@ dev = [
"pytest>=6",
"pytest-cov>=3",
"pytest-doctestplus",
"sympy",
]
Copy link
Member

Choose a reason for hiding this comment

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

It looks like SymPy is an optional dependency and that's good! ✔️

README.md Outdated Show resolved Hide resolved
MomentumSympy2D,
MomentumSympy3D,
MomentumSympy4D,
VectorSympy,
Copy link
Member

Choose a reason for hiding this comment

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

SymPy's preferred capitalization includes a capital "P", but we ignore NumPy's preferred capitalization, too. This is fine. ✔️

(MomentumSymPy4D would be too bumpy!)

@Saransh-cpp
Copy link
Member Author

Thank you for the review!

Is Codecov wrong? If not, is there a way to satisfy it with just a few more tests? If not, maybe we should just lower its threshold. Going a little under 85% is not terrible.

I am not sure how Codecov is processing coverage report here, but I'll try satisfying it for the lines that can be tested. I think the absolute coverage went up but the relative coverage went down.

@jpivarski
Copy link
Member

I'm just surprised because you added a lot more tests than code. I know that lines of test code don't correspond one-to-one with lines covered in the codebase, but it's still surprising to me.

@Saransh-cpp
Copy link
Member Author

Added a few more tests, coverage went up! Merging!

@Saransh-cpp Saransh-cpp merged commit 4fb4846 into main Apr 23, 2024
22 checks passed
@Saransh-cpp Saransh-cpp deleted the sympy-backend branch April 23, 2024 14:04
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