Skip to content

Commit

Permalink
Fixed missing dependency error
Browse files Browse the repository at this point in the history
Due to moving the Dataverse dependencies to "extra_requires" a ModuleNotFound error was introduced, which is now fixed by trying to import PyDaRUS when using the method
  • Loading branch information
JR-1991 committed Apr 11, 2022
1 parent 6264db1 commit 3bde834
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
pip3 install python-copasi
pip3 install -e .[test]
pip3 install -e .[test,dataverse]
- name: Test with pytest
run: |
python3 -m pytest
Expand Down
9 changes: 8 additions & 1 deletion pyenzyme/enzymeml/core/enzymemldocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from pyenzyme.enzymeml.tools.enzymemlwriter import EnzymeMLWriter
from pyenzyme.enzymeml.tools.templatereader import read_template
from pyenzyme.enzymeml.tools.validator import EnzymeMLValidator
from pyenzyme.enzymeml.databases.dataverse import uploadToDataverse

from pyenzyme.enzymeml.core.ontology import EnzymeMLPart, SBOTerm
from pyenzyme.utils.log import setup_custom_logger, log_object
Expand Down Expand Up @@ -323,6 +322,14 @@ def uploadToDataverse(
api_token (str): API Token of the dataverse to upload. Defaults to None. If None the API Token will be drawn from env vars.
"""

try:
from pyenzyme.enzymeml.databases.dataverse import uploadToDataverse
except ModuleNotFoundError:
raise ModuleNotFoundError(
"PyDaRUS has not been found. Please make sure to install 'pyDaRUS' to use the dataverse upload."
)

uploadToDataverse(
enzmldoc=self,
dataverse_name=dataverse_name,
Expand Down
1 change: 1 addition & 0 deletions pyenzyme/enzymeml/databases/dataverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pydantic

from typing import Dict, Any, Optional

from pyDaRUS import EnzymeMl, Citation, Dataset
from pyDaRUS.metadatablocks.enzymeML import Constant
from pyDaRUS.metadatablocks.citation import SubjectEnum
Expand Down

0 comments on commit 3bde834

Please sign in to comment.