-
Notifications
You must be signed in to change notification settings - Fork 876
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
Missing structure files #3874
Comments
please stop calling other people's contributions irrelevant (i assume you're referring to #3831).
in my opinion, having a publicly exported if you really want those structures in the package, there should be a clearly user-facing API like if it was important that external packages can load these structures, there should have been tests for that. you often told me yourself, if people don't write tests for things they added to finally, i would like to point out that you were the one to do a massive (in your own words apparently irrelevant) migration of test files into the |
|
Hi thanks for pinging me. Yes indeed I relocated those structure files in #3831, and I was not expecting them to be needed outside Moving such files might not be a major concern/improvement here, but from my side, As per the module docstring (and everything else I could infer from), it should not be accessed externally: pymatgen/pymatgen/util/testing/__init__.py Lines 1 to 6 in 4542689
|
@shyuep yes, that's exactly what i'm expecting for any external API!
no need to explain, i'm well aware of that.
so what is the good reason? like i said, those files were there to support an antipattern which is hardly a good reason. and because it was an antipattern neither i nor @DanielYang59 suspected that there was a reason at all. given there were no tests or documentation to inform us otherwise, i think you should tone down your language |
@DanielYang59 Thanks for the thoughtful response. The intent is for PymatgenTest to be an public utility class to be used for testing materials science code, not just within pymatgen. There are some packages that use PymatgenTest to load example structures to simplify testing. E.g., matcalc, maml, pymatgen.analysis.diffusion. That change broke the CI of multiple downstream codes. It is really no different from something like the built-in datasets for something like scikit-learn or seaborn. It is a good practice to find out who the original author of the code is (which is available from Git) and then clarify intent first before making breaking changes. I am not a newbie. I know the difference between a private class and a public class. I know the difference between test files and code files. There are reasons why I left the json files in pymatgen/utils/files and not pymatgen/utils/tests/files. When I consolidated the test files, I did not move them like all the other test files. Perhaps let me outline the guidelines:
I am not going to dignify the rest of the comments from others with a response. |
I appreciate your sharing this, which certainly would help me become a better contributor :) Also I'm beginning to feel the same as I gain more experience in open-source.
Thanks for explaining this, I was not expecting this in the first place. As per its name If I were to realize (or even just suspect) it might be access externally, I would certainly follow the guidelines you mentioned above :) With all these said, perhaps those packages should consider trying to get structures (even for unit test) through the |
sounds more like you lost the argument on its merit... |
@DanielYang59 Sure, perhaps naming can be modified (with a deprecation period because this is purely aesthetic change), but even just for Pymatgen add-on packages, it is expected that PymatgenTest would be useful. As for getting structures, you can use the mp-api of course but it is more involved. You need to set up an API key as a Github secret. And online access is always needed. Why not simply have some example files within code? I would note for example that codes like seaborn, scikit-learn, all have example data within the code for ease of testing, tutorials, etc. There was a method called get_mp_structure in PymatgenTest previously. Anyway, I added a Structure.from_id, which is a more robust solution for other applications. |
That's a fair point to me!
Yes it's less "convenient", but for CI environment, Internet access is usually available anyway (installing
I have a feeling that this is not "best practice", but I'm not quite certain yet. Perhaps we can do better than others :)
Thanks for adding this! It sounds much more reasonable :) |
Hi everyone - I need to add a note to this thread. I am glad to have discussions and disagreements, but we have to maintain a standard of civil and kind communication throughout these disagreements. There are some examples in this thread where this standard is not met. I want the pymatgen community to be a welcoming place to all contributors, without whom pymatgen would not be what it is today. We also want to encourage voices to speak up when they think something is done badly, or a mistake has been made. We will only encourage useful, critical feedback if people feel safe to make it, and know that we can collectively tackle the problem and not the person (no "you" statements that are used to attack an individual please). Thank you everyone for your work here on the underlying issue. |
Python version
any
Pymatgen version
2024.6.4
Operating system version
No response
Current behavior
PymatgenTest.get_structure fail if
tests
is not are not present, e.g., if it is installed from pip.@DanielYang59 @janosh You cannot do this kind of thing. PymatgenTest is used not just within Pymatgen but a lot of downstream packages. Some of those packages rely on having PymatgenTest to generate a structure. I have to ask that you stop with all these irrelevant moving of files around and causing breakages. STRICTLY keep backwards compatiblity! Revert this change and issue a release immediately.
Expected Behavior
PymatgenTest.get_structure actually does not result in a failure.
Minimal example
No response
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: