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

Made semsimian an optional dependency #704

Merged
merged 40 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f0f6dc9
Made semsimian an optional dependency
hrshdhgd Mar 6, 2024
5952482
latest version of semsimian
hrshdhgd Mar 6, 2024
6fe1a86
Address semsimian being optional dependency
hrshdhgd Mar 6, 2024
40b7544
formatted
hrshdhgd Mar 6, 2024
fe2f06b
updated message
hrshdhgd Mar 6, 2024
0d21385
formatted
hrshdhgd Mar 6, 2024
1c8e1bb
Merge branch 'main' into semsimian-optional
hrshdhgd Mar 8, 2024
6857a11
Use TYPE_CHECKING
hrshdhgd Mar 8, 2024
f1d9bc1
Merge branch 'semsimian-optional' of https://github.com/INCATools/ont…
hrshdhgd Mar 8, 2024
5752f41
roll back init
hrshdhgd Mar 8, 2024
9de6ed3
Merge branch 'main' into semsimian-optional
hrshdhgd Mar 8, 2024
cf1959e
formatted
hrshdhgd Mar 8, 2024
e9b8fb7
Merge branch 'semsimian-optional' of https://github.com/INCATools/ont…
hrshdhgd Mar 8, 2024
18c2e44
add sesmimian as dependency in tox
hrshdhgd Mar 8, 2024
b91038d
duplicate
hrshdhgd Mar 8, 2024
2cfa6b5
add semsimian install
hrshdhgd Mar 8, 2024
d4cb659
add semsimian install
hrshdhgd Mar 8, 2024
b7db86a
edit semsimian install
hrshdhgd Mar 8, 2024
89e736f
undo semsimian install
hrshdhgd Mar 8, 2024
3c2214d
fixed semsimian mystery
hrshdhgd Mar 8, 2024
05ee23b
semsimian as a group not an extra
hrshdhgd Mar 8, 2024
90a70c9
optional semsimian possible solution
hrshdhgd Mar 8, 2024
b1f9b2c
formatted
hrshdhgd Mar 8, 2024
290fb48
formatted
hrshdhgd Mar 8, 2024
f5ddd46
formatted
hrshdhgd Mar 8, 2024
194280a
updated gitignore
hrshdhgd Mar 8, 2024
6e61ac4
Merge branch 'main' into semsimian-optional
hrshdhgd Mar 8, 2024
2b61946
corrected branch diff madness
hrshdhgd Mar 8, 2024
61c1b3a
Merge branch 'main' into semsimian-optional
hrshdhgd Mar 11, 2024
d9e2d2f
don't initialize it to be None
hrshdhgd Mar 11, 2024
40dc230
formatted
hrshdhgd Mar 11, 2024
5b8758d
Should fix the gh action error thanks @justaddcoffee
hrshdhgd Mar 11, 2024
af0e1f3
update pip dependency
hrshdhgd Mar 11, 2024
d3803e7
cleanup+formatted
hrshdhgd Mar 11, 2024
2bcfb86
semsimian as extra not group
hrshdhgd Mar 11, 2024
415b217
formatted
hrshdhgd Mar 12, 2024
7f14f28
formatted
hrshdhgd Mar 12, 2024
582f5a5
formatted
hrshdhgd Mar 12, 2024
f3b2326
Merge branch 'main' into semsimian-optional
hrshdhgd Mar 14, 2024
efd8858
formatted
hrshdhgd Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction --extras "gilda"
run: poetry install --no-interaction --extras "gilda semsimian"

- name: Get Gilda resources
run: |
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ kgcl-schema = "^0.6.5"

funowl = ">=0.2.0"
gilda = {version = ">=1.0.0", optional = true}
semsimian = {version = ">=0.1.0", optional = true}
kgcl-rdflib = "0.5.0"
llm = {version = "*", optional = true}
aiohttp = {version = "*", optional = true}
Expand All @@ -37,7 +38,6 @@ pysolr = "^3.9.0"
eutils = ">=0.6.0"
requests-cache = "^1.0.1"
click = "*"
semsimian = "^0.2.1"
urllib3 = {version = "< 2", optional = true}
pydantic = "*"
jsonlines = "^4.0.0"
Expand Down Expand Up @@ -75,6 +75,7 @@ docs = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-mermaid", "sphinx-copybutto
gilda = ["scipy", "gilda", "urllib3"]
llm = ["llm", "aiohttp"]
seaborn = ["seaborn"]
semsimian = ["semsimian"]

[tool.black]
line-length = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from dataclasses import dataclass, field
from typing import ClassVar, Dict, Iterable, Iterator, List, Optional, Tuple, Union

from semsimian import Semsimian

from oaklib.datamodels.similarity import (
BestMatch,
TermInfo,
Expand Down Expand Up @@ -51,7 +49,7 @@ class SemSimianImplementation(SearchInterface, SemanticSimilarityInterface, OboG
SemanticSimilarityInterface.information_content_scores,
]

semsimian_object_cache: Dict[Tuple[PRED_CURIE], Semsimian] = field(default_factory=dict)
semsimian_object_cache: Dict[Tuple[PRED_CURIE], Optional["Semsimian"]] = field(default_factory=dict) # type: ignore # noqa

def __post_init__(self):
slug = self.resource.slug
Expand Down Expand Up @@ -81,13 +79,15 @@ def _get_semsimian_object(
predicates: List[PRED_CURIE] = None,
attributes: List[str] = None,
resource_path: str = None,
) -> Semsimian:
) -> "Semsimian": # type: ignore # noqa
"""
Get Semsimian object from "semsimian_object_cache" or add a new one.

:param predicates: collection of predicates, defaults to None
:return: A Semsimian object.
"""
from semsimian import Semsimian

predicates = tuple(sorted(predicates))
if predicates not in self.semsimian_object_cache:
# spo = [
Expand Down
Loading