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

New sssom==0.3.42 breaks oaklib #664

Closed
rly opened this issue Oct 3, 2023 · 5 comments
Closed

New sssom==0.3.42 breaks oaklib #664

rly opened this issue Oct 3, 2023 · 5 comments

Comments

@rly
Copy link

rly commented Oct 3, 2023

sssom==0.3.42 was released a few hours ago but breaks importing of oaklib.

In a clean python 3.11 environment on Mac M1:

$ pip install oaklib
$ python -c "import oaklib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/oaklib/__init__.py", line 7, in <module>
    from oaklib.interfaces import BasicOntologyInterface  # noqa:F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/oaklib/interfaces/__init__.py", line 8, in <module>
    from oaklib.interfaces.text_annotator_interface import TextAnnotatorInterface
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/oaklib/interfaces/text_annotator_interface.py", line 22, in <module>
    from oaklib.utilities.lexical.lexical_indexer import create_or_load_lexical_index
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/oaklib/utilities/lexical/lexical_indexer.py", line 18, in <module>
    from sssom.context import get_default_metadata
ImportError: cannot import name 'get_default_metadata' from 'sssom.context' (/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/sssom/context.py)

In mapping-commons/sssom-py#421 it looks like get_default_metadata was removed from sssom/src/sssom/context.py but this function is used in oaklib/src/oaklib/utilities/lexical/lexical_indexer.py

It looks like oaklib should use instead:

from .typehints import Metadata
default_metadata = Metadata.default()

I think either oaklib should be updated with the above, or sssom should be updated to maintain the old get_default_metadata function while it is being deprecated.

@matentzn
Copy link
Contributor

matentzn commented Oct 3, 2023

@rly thanks a ton.

This should not ever happen, I am not sure how I missed this but somehow I must have allowed a PR in sssom-py through that removes a method (which I would not do usually if I had my full mental capacity).

@hrshdhgd can you re-introduce that method in SSSOM, formally @deprecate it and make a new release? Also, before you make a release, can you run all the OAK tests with the new sssom version so we can be sure that nothing else has broken?

@cthoyt
Copy link
Collaborator

cthoyt commented Oct 3, 2023

@hrshdhgd I will take care of it

@cthoyt
Copy link
Collaborator

cthoyt commented Oct 3, 2023

Alternatively,

if meta is None:
meta = get_default_metadata()
if prefix_map:
meta.prefix_map.update(
{k: v for k, v in prefix_map.items() if k not in meta.prefix_map.keys()}
)
mapping_set_id = meta.metadata[MAPPING_SET_ID]
license = meta.metadata[LICENSE]
mset = MappingSet(mapping_set_id=mapping_set_id, mappings=mappings, license=license)
# doc = MappingSetDocument(prefix_map=oi.prefix_map(), mapping_set=mset)
doc = MappingSetDocument(prefix_map=meta.prefix_map, mapping_set=mset)
msdf = to_mapping_set_dataframe(doc)
can all refactored to only use high-level functionality from sssom-py instead of duplicating its functionality for management of metadata/prefix maps

@cthoyt
Copy link
Collaborator

cthoyt commented Oct 4, 2023

We yanked the 0.3.42 release, these breaking changes will get put into a 0.4.0 series and OAK will be updated to use the new code in #666

@rly
Copy link
Author

rly commented Oct 4, 2023

Thanks for the update!

@rly rly closed this as completed Oct 4, 2023
cthoyt added a commit to mapping-commons/sssom-py that referenced this issue Oct 5, 2023
Closes #439

This PR adds three methods to the `MappingSetDataFrame` class that allow
instantiation from LinkML objects such as `MappingSetDocument`,
`MappingSet`, or a list of `Mapping`.

It has the benefit of pre-baking in logic for dealing with default
metadata and converters, meaning that nobody has to roll this themselves
downstream

This is going to help us address
https://github.com/INCATools/ontology-access-kit/blob/75940bfa883001afb0e4aebb339fd62583c13844/src/oaklib/utilities/lexical/lexical_indexer.py#L313-L325,
specifically in
INCATools/ontology-access-kit#664
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

No branches or pull requests

3 participants