Skip to content

Commit

Permalink
is_package_lite demo
Browse files Browse the repository at this point in the history
  • Loading branch information
gvarnavi committed Jul 10, 2024
1 parent 7b60b13 commit 1e8278f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions py4DSTEM/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from py4DSTEM.version import __version__
from emdfile import tqdmnd

from importlib.metadata import metadata

is_package_lite = "lite" in metadata("py4DSTEM")["Keywords"].lower().split(",")

### io

Expand Down Expand Up @@ -54,9 +57,9 @@

try:
from py4DSTEM.process import classification
except (ImportError, ModuleNotFoundError):
pass

except (ImportError, ModuleNotFoundError) as exc:
if not is_package_lite:
raise exc

# diffraction
from py4DSTEM.process.diffraction import Crystal, Orientation
Expand All @@ -75,8 +78,9 @@

try:
from py4DSTEM.process import wholepatternfit
except (ImportError, ModuleNotFoundError):
pass
except (ImportError, ModuleNotFoundError) as exc:
if not is_package_lite:
raise exc


### more submodules
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
author="Benjamin H. Savitzky",
author_email="[email protected]",
license="GNU GPLv3",
keywords="STEM 4DSTEM",
keywords="STEM,4DSTEM",
python_requires=">=3.10",
install_requires=[
"numpy >= 1.19",
Expand Down

0 comments on commit 1e8278f

Please sign in to comment.