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

Remove pymoab as a Dependency #24

Merged
merged 6 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
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
21 changes: 19 additions & 2 deletions dagmc/dagnav.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
"""
This file includes the DAGModel module which is designed to manage and
manipulate hierarchical geometric data structures used in computational
modeling and simulation built upon the PyMOAB package.
"""

from __future__ import annotations
from abc import abstractmethod
from functools import cached_property
from itertools import chain
from typing import Optional, Dict
from warnings import warn

import numpy as np
from pymoab import core, types, rng, tag

try:
from pymoab import core, types, rng, tag
except ImportError as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I suggested this in #1, but the message is a overly verbose for my taste. There are (somewhat dated) instructions on how to build MOAB with PyMOAB enabled here. I think we should point to them in this message and update the installation instructions there.

Also, while we may want to add a logging capability to this project in the future, I don't see the point of importing that module for this single message. We can raise our own message from a ModuleNotFoundError

try:
    from pymoab import core, types, rng, tag
except ImportError as e:
    msg = 'PyMOAB package was not found, please install this package using the instructions found here: https://ftp.mcs.anl.gov/pub/fathom/moab-docs/building.html'
    raise ModuleNotFoundError(msg) from e

msg = '''

\033[1m\033[91mPyMOAB package was not found.\033[0m

\033[1mPlease install this package using the instructions found here:\033[0m

\033[94mhttps://ftp.mcs.anl.gov/pub/fathom/moab-docs/building.html\033[0m
'''
raise ModuleNotFoundError(msg) from e


class DAGModel:
Expand Down
Loading