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

fix #216: angle parameters are not being read from topology file #264

Conversation

jandom
Copy link
Collaborator

@jandom jandom commented Nov 5, 2023

This will be a fair amount of work actually, to update the parser and support all the different angletypes defined by gromacs... I'm treating this documentation as authoritative source of what to expect for each angletype https://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html#tab-topfile2

@jandom
Copy link
Collaborator Author

jandom commented Nov 5, 2023

@orbeckst oh I see that we're still supporting python2.7 in this repo – is that intentional, or do you not actually care?

E     File "/home/runner/work/GromacsWrapper/GromacsWrapper/tests/fileformats/top/test_TOP.py", line 26
E       def create_topology_data() -> str:
E                                  ^
E   SyntaxError: invalid syntax

@orbeckst
Copy link
Member

orbeckst commented Nov 7, 2023

Looking at it, we still do support 2.7 — mainly because it was no real effort to do so. However, that could go by the wayside eventually, but that requires a last release with 2.7, a dedicated cleanup PR etc so for right now, just throw out anything modern and make the tests pass.

(Have a look at #offtopic in the MDAnalysis discord if you want to hear opinions on Python's development cycles...)

@orbeckst
Copy link
Member

orbeckst commented Nov 7, 2023

Please ping me when you need a quick review @jandom . I don't have a lot of free side project time at the moment.

@orbeckst
Copy link
Member

orbeckst commented Nov 7, 2023

And PS: Many thanks for taking on the issue!!!!

@jandom
Copy link
Collaborator Author

jandom commented Nov 7, 2023 via email

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #264 (6664d77) into main (fa64735) will increase coverage by 0.29%.
The diff coverage is 89.47%.

@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
+ Coverage   68.88%   69.18%   +0.29%     
==========================================
  Files          22       22              
  Lines        3944     3946       +2     
  Branches      708      715       +7     
==========================================
+ Hits         2717     2730      +13     
+ Misses       1047     1036      -11     
  Partials      180      180              
Files Coverage Δ
gromacs/fileformats/blocks.py 72.35% <100.00%> (+1.38%) ⬆️
gromacs/fileformats/top.py 86.89% <86.04%> (+1.27%) ⬆️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@orbeckst
Copy link
Member

orbeckst commented Nov 8, 2023

do we need to continue and support python 2.7?

I am looking at #259 where we/I apparently decided to finally drop 2.7. And I even made the 0.8.5 release that was officially the last one to also support "old Python".

Therefore — you'll be overjoyed to hear — we can rip out any (very) legacy Python ≤ 3.7. I would, however, prefer to do the ripping in a separate PR; for a start just removing the testing in CI and updating the CHANGELOG would be sufficient.

@orbeckst
Copy link
Member

orbeckst commented Nov 8, 2023

If you review PR #265 then you can just use Python ≥3.8 in this PR ;-).

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Add an entry to CHANGES. Possibly improve testing.

I trust that you actually fixed the issue :-).

@@ -0,0 +1,67 @@
import gromacs as gmx
from unittest.mock import patch, mock_open
Copy link
Member

Choose a reason for hiding this comment

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

Can you use pytest's mocking support https://docs.pytest.org/en/7.1.x/how-to/monkeypatch.html so that it stays within pytest? Alternatively, we could install pytest-mock.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, what's the motivation here – is it just consistency? I really, really don't enjoy how monkeypatch solves the problem. unittest is mock is basically a built-in and I see it used more frequently.

Happy to add more tests – that's always a good idea – but i will need some direction as to what to cover? My tests already covered all the possible fu values.

Copy link
Member

Choose a reason for hiding this comment

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

consistency to stay within one testing framework

Copy link
Member

Choose a reason for hiding this comment

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

test coverage itself looks decent enough

@jandom
Copy link
Collaborator Author

jandom commented Nov 8, 2023

If you review PR #265 then you can just use Python ≥3.8 in this PR ;-).

Approved! But of course I coded first and read second so I already factored out the enum import...

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Please fix the CHANGES but looks good in principle! Thanks a lot @jandom !!

CHANGES Outdated Show resolved Hide resolved
CHANGES Outdated Show resolved Hide resolved
@orbeckst orbeckst self-assigned this Nov 8, 2023
@orbeckst orbeckst merged commit 691393c into Becksteinlab:main Nov 9, 2023
14 checks passed
@orbeckst
Copy link
Member

orbeckst commented Nov 9, 2023

Thank you @jandom !!!

@orbeckst orbeckst linked an issue Nov 9, 2023 that may be closed by this pull request
@jandom jandom deleted the jandom/fix/issue-261-angle-parameters-not-read-from-topology-file branch November 9, 2023 10:34
@jandom
Copy link
Collaborator Author

jandom commented Nov 9, 2023

Many thanks for your help with this PR @orbeckst – I will note that ChatGPT was heavily used to write this code, with a few adjustments! 🤖

@orbeckst
Copy link
Member

orbeckst commented Nov 9, 2023

I am just relying on you claiming proper authorship of the code and having the knowledge to know when something coming out of a LLM is correct.

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.

angle parameters are not being read from topology file
2 participants