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

add get_string->get_str alias for Poscar #3763

Merged

Conversation

timurbazhirov
Copy link
Contributor

@timurbazhirov timurbazhirov commented Apr 16, 2024

Summary

Minor changes:

  • add get_string alias for get_str function in Poscar class for convenience/compatibility purposes with earlier implementation(s)

Major changes:

  • none

Checklist

(.venv) ➜  pymatgen git:(chore/add-poscar-get-string-alias) pre-commit run --all-files                                           
ruff.....................................................................Passed
ruff-format..............................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
mypy.....................................................................Passed
codespell................................................................Passed
cython-lint..............................................................Passed
double-quote Cython strings..............................................Passed
blacken-docs.............................................................Passed
markdownlint.............................................................Passed
nbstripout...............................................................Passed

and

(.venv) ➜  pymatgen git:(chore/add-poscar-get-string-alias) pip list                  
Package            Version
------------------ -----------
beautifulsoup4     4.12.2
certifi            2024.2.2
cfgv               3.4.0
charset-normalizer 3.3.2
contourpy          1.2.1
cycler             0.12.1
Cython             3.0.2
distlib            0.3.8
filelock           3.13.4
fonttools          4.51.0
future             1.0.0
identify           2.5.35
idna               3.7
joblib             1.3.2
kiwisolver         1.4.5
latexcodec         3.0.0
matplotlib         3.8.0
monty              2024.2.26
mpmath             1.3.0
networkx           3.1
nodeenv            1.8.0
numpy              1.26.0
packaging          24.0
palettable         3.3.3
pandas             2.1.1
pillow             10.3.0
pip                24.0
platformdirs       4.2.0
plotly             5.17.0
pre-commit         3.7.0
pybtex             0.24.0
pyparsing          3.1.2
python-dateutil    2.9.0.post0
pytz               2024.1
PyYAML             6.0.1
requests           2.31.0
ruamel.yaml        0.18.6
ruamel.yaml.clib   0.2.8
scipy              1.11.3
setuptools         69.2.0
six                1.16.0
soupsieve          2.5
spglib             2.1.0
sympy              1.12
tabulate           0.9.0
tenacity           8.2.3
tqdm               4.66.2
tzdata             2024.1
uncertainties      3.1.7
urllib3            2.2.1
virtualenv         20.25.1
wheel              0.43.0

Summary by CodeRabbit

  • New Features
    • Introduced a new method alias get_string for enhanced usability in accessing string representations.

Copy link

coderabbitai bot commented Apr 16, 2024

Walkthrough

A new method named get_string has been introduced in the pymatgen/io/vasp/inputs.py as an alias to the existing get_str method. This update enhances usability without impacting the existing functionality of the class.

Changes

File Path Change Summary
pymatgen/.../inputs.py Added get_string method as an alias to get_str.

🐇✨
In the land of code and byte,
A new alias shines so bright.
get_string joins the fray,
With get_str it will stay.
Hopping through the lines of code,
A rabbit leaves its whimsy ode. 🌟
🐇💻


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0e57abf and d08f40f.
Files selected for processing (1)
  • pymatgen/io/vasp/inputs.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • pymatgen/io/vasp/inputs.py

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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@shyuep
Copy link
Member

shyuep commented Apr 16, 2024

@janosh Can we please for the love of god keep backward compatibility when it is trivial to do so? There is no reason for this backward incompatibility to exist.

@shyuep shyuep enabled auto-merge (squash) April 16, 2024 22:35
@janosh
Copy link
Member

janosh commented Apr 17, 2024

@timurbazhirov apologies for the trouble. are you using another package that depends on pymatgen which didn't update to get_str?

@shyuep you green-lighted this change last year including the deprecation period.

looks like monty@v2024.4.16 didn't keep backwards compatibility as deserialization is failing across the code base.

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

@janosh I green lighted the change for sure. But I was under the impression the deprecation period is longer? The Monty issue has nothing to do with deprecation but a bug introduced that were not caught by existing tests. Those I accept.

@janosh
Copy link
Member

janosh commented Apr 17, 2024

But I was under the impression the deprecation period is longer?

sorry about that, i probably could have been clearer.

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

Incidentally, keep your comments related to the existing bug report and package. Arguing by using equivalence on other packages is petty. If you have a problem with a bug on Monty, feel free to comment over at the Monty Issues.

@janosh
Copy link
Member

janosh commented Apr 17, 2024

re this PR: adding back get_string class by class is probably not ideal. better to ask why there's no migration path for @timurbazhirov

@timurbazhirov
Copy link
Contributor Author

Thank you. This seemed like a benign workaround to avoid having to handle the function signature(s) when using py3.8-compatible earlier version(s) like in https://github.com/Exabyte-io/made/blob/main/src/py/mat3ra/made/tools/convert.py#L121. For production workloads, it's often good to have compatibility with earlier versions for longer.

Not sure what you mean by:

adding back get_string class by class is probably not ideal

but either way, feel free to close this PR if you don't like it.

BTW - are test failures related to the change in this PR, or caused by something else?

@JaGeo
Copy link
Member

JaGeo commented Apr 17, 2024

BTW - are test failures related to the change in this PR, or caused by something else?

No, they aren't. An issue with a dependency. 😅 (I also asked about this earlier today)

@shyuep shyuep disabled auto-merge April 17, 2024 17:09
@shyuep shyuep merged commit 7f96ef2 into materialsproject:master Apr 17, 2024
4 of 22 checks passed
@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

I merged. Thanks for reporting this. My view is that this is a trivial thing to support and there is no reason why we can't keep the get_string = get_str line. I am a practical person. Code cleanliness exists to support functionality, not to hamper it.

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

I don't quite understand why the test suite is installing monty 2024.4.*. The pinned dependency says monty==2024.2.26

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

@Andrew-S-Rosen Can you investigate the serialization issue? Seems related to the latest msonable changes.

@Andrew-S-Rosen
Copy link
Member

Andrew-S-Rosen commented Apr 17, 2024

@shyuep: I'm unavailable until the weekend so can't look at it until then, unfortunately (I'm just posting from phone).

I can't see the test fail from GitHub Mobile but my guess is it's linked to materialsvirtuallab/monty#654.

@Andrew-S-Rosen
Copy link
Member

Ah, I see the fail now. @matthewcarbone: at first glance, this looks similar to materialsvirtuallab/monty#659 (just as a heads up!).

@matthewcarbone
Copy link
Contributor

@Andrew-S-Rosen this one can't be my fault right? monty from February is well before I broke MSONable 😁

Happy to help look into this if you'd like though!

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

@matthewcarbone There are two fails here:

  1. The CI is installing 2024.4.x monty, which includes your changes. This is not what the CI is supposed to do. Not sure what is happening. I have no idea what micromamba is. This needs to be fixed by @janosh .
  2. Monty 2024.4.x itself has a bug which broke serialization. This needs to be fixed asap.

@matthewcarbone
Copy link
Contributor

@shyuep I absolutely am going to fix this and add new test cases to try and deal with it, but why was monty 2024.4 released when we knew it had this bug? If you're on a schedule here we should simply roll back my changes (which only affected monty.json) and hotfix until I can get to it.

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

@matthewcarbone I didn't know the bug existed when 2024.4.* was released. I will roll back the changes for now.

@matthewcarbone
Copy link
Contributor

@shyuep you beat me to it! I was just about to open a PR to do this. Thanks!

In the meantime I'll work on implementing the changes back in monty in a backwards compatible way.

@matthewcarbone
Copy link
Contributor

@shyuep @janosh the issue with the wrong install version of monty might be in setup.py.

"monty>=2024.2.2",

Looks like the version there is different than that pinned in requirements.txt. Even if this isn't the issue the setup.py file should probably read from requirements.txt so there's only one source of truth. Thoughts?

Btw a new version of monty which rolls back my bug was just released and should fix this issue. Apologies!

@shyuep
Copy link
Member

shyuep commented Apr 17, 2024

You generally do not pin setup.py. The CI should install from the requirements.txt file. For some reason, it is not.

@matthewcarbone
Copy link
Contributor

Could be this maybe?

uv pip install --editable '.[dev,optional]'

This would appear to install the package itself likely from setup.py?

That said, why would the CI install requirements from a different file than what's being deployed? That could lead to bugs due to dependency mismatches, right?

@matthewcarbone
Copy link
Contributor

I have no idea what uv is though 😁

@JaGeo
Copy link
Member

JaGeo commented Apr 17, 2024

I have no idea what uv is though 😁

Just a software to make pip install faster. (https://pypi.org/project/uv/)

@janosh janosh added the docs Documentation, examples, user guides label May 1, 2024
@janosh janosh changed the title chore: add get_string alias for Poscar add get_string->get_str alias for Poscar May 1, 2024
@janosh janosh added io Input/output functionality vasp Vienna Ab initio Simulation Package ux User experience and removed docs Documentation, examples, user guides labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Input/output functionality ux User experience vasp Vienna Ab initio Simulation Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants