pyiron / pyiron_ontology

Combining pyiron and owlready2 for ontologically guided workflow design
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Test docs examples #35

Closed liamhuber closed 10 months ago

liamhuber commented 10 months ago

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.

github-actions[bot] commented 10 months ago

Binder :point_left: Launch a binder notebook on branch _pyiron/pyiron_ontology/test_docsexamples

codacy-production[bot] commented 10 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +3.92% (target: -1.00%) :white_check_mark: 100.00%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (43e57167607af2ce57c6a803dc528b5ae9d3969a) | 459 | 400 | 87.15% | | | Head commit (594c6d2528a2fdfb030c63407f84608b2ad87c96) | 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: ` - `
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: `/ * 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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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.