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

Test docs examples #35

Merged
merged 11 commits into from
Jan 11, 2024
Merged

Test docs examples #35

merged 11 commits into from
Jan 11, 2024

Conversation

liamhuber
Copy link
Member

Rename the "notebooks" env more properly to reflect it is just pyiron_atomistics, and it is used for both docs and notebooks. Then format the README examples for doctest and test them.

To better reflect purpose
Particularly for the README examples test, which explicitly imports `pyiron_atomistics.Project`
Tabs are screwing up the example test
We don't want to compare against that
Copy link

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_ontology/test_docs_examples

Copy link

codacy-production bot commented Jan 11, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+3.92% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (43e5716) 459 400 87.15%
Head commit (594c6d2) 459 (+0) 418 (+18) 91.07% (+3.92%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#35) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@liamhuber
Copy link
Member Author

On windows:

Looking for: ['coverage', "coveralls[version='>=3.3.1']", 'codacy-coverage', 'numpy=1.26.3', 'openjdk', 'owlready2=0.45', 'pandas=2.1.4', 'pint=0.23', "python[version='>=3.8']", 'lammps', 'pyiron_atomistics', 'pyiron-data']

Could not solve for environment specs
The following package could not be installed
└─ lammps   does not exist (perhaps a typo or a missing channel).
Error: Process completed with exit code 1.

Riiight. The lammps package is architecture-specific and precludes windows. So I can't just dump the docs and notebooks envs together like that.

liamhuber and others added 2 commits January 11, 2024 12:54
So we can get pyiron_atomistics for the README docs example, but save lammps (unavailable on windows) for just the notebooks
@liamhuber
Copy link
Member Author

Doc test is failing, but it looks at first glance like the problem is up-stream:

File "/home/runner/work/pyiron_ontology/pyiron_ontology/tests/integration/../../docs/README.md", line 336, in README.md
Failed example:
    from pyiron_atomistics import Project
Exception raised:
    Traceback (most recent call last):
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/doctest.py", line 1353, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest README.md[45]>", line 1, in <module>
        from pyiron_atomistics import Project
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/pyiron_atomistics/__init__.py", line 1, in <module>
        from pyiron_atomistics.project import Project
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/pyiron_atomistics/project.py", line 37, in <module>
        from pyiron_atomistics.atomistics.structure.factory import StructureFactory
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/pyiron_atomistics/atomistics/structure/factory.py", line 40, in <module>
        from pyiron_atomistics.atomistics.structure.factories.materialsproject import (
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/pyiron_atomistics/atomistics/structure/factories/materialsproject.py", line 2, in <module>
        from mp_api.client import MPRester
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/mp_api/client/__init__.py", line 7, in <module>
        from .core import MPRestError
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/mp_api/client/core/__init__.py", line 3, in <module>
        from .client import BaseRester, MPRestError
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/mp_api/client/core/client.py", line 31, in <module>
        from mp_api.client.core.utils import api_sanitize, validate_ids
      File "/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/mp_api/client/core/utils.py", line 7, in <module>
        from maggma.utils import get_flat_models_from_model
    ImportError: cannot import name 'get_flat_models_from_model' from 'maggma.utils' (/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/maggma/utils.py)

Installed versions in that stack:

pyiron_atomistics                 0.4.4  pyhd8ed1ab_0             conda-forge/noarch 
mp-api                           0.37.2  pyhd8ed1ab_0             conda-forge/noarch
maggma                           0.38.1  pyhd8ed1ab_0             conda-forge/noarch

@liamhuber
Copy link
Member Author

Yeah, pyiron_atomistics 0.4.4 specifies mp-api =0.39.4 so I guess that's the problem. The conda package permits anything >=0.37

@liamhuber
Copy link
Member Author

The latest version of mp-api (0.39.5) puts a hard lower limit of 0.57.1, so I guess this is pyiron's fault for permitting older versions of mp-api when their dependency control was suckier.

liamhuber and others added 2 commits January 11, 2024 13:20
To get a version of mp-api that handles its dependencies well.
@liamhuber liamhuber merged commit 64d7422 into main Jan 11, 2024
18 checks passed
@liamhuber liamhuber deleted the test_docs_examples branch January 11, 2024 21:48
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