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

Fix Importing Frontend #13

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = [
]
description = "A yt frontend for libyt"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.7"
dependencies = ["yt"]
keywords = ["yt_libyt"]
Expand All @@ -20,6 +21,9 @@ classifiers = [
"Programming Language :: Python :: 3"
]

[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {attr = "yt_libyt._version.__version__"}

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[metadata]
long_description = file: README.md
long_description_content_type = text/markdown
license = BSD
license_files = LICENSE

[options]
include_package_data = True
Expand Down
6 changes: 5 additions & 1 deletion yt_libyt/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ def __init__(self, units_override=None, unit_system="cgs"):
for name in yt.frontends.api._frontends:
if self._code_frontend == name.lower():
# Import frontend dataset
# The naming rule of dataset class is XXXDataset, XXX doesn't necessarily need to be all capital
frontend = importlib.import_module(f"yt.frontends.{name.lower()}.api")
frontend_dataset = getattr(frontend, f"{name.upper()}Dataset")
frontend_dataset = None
for _ in dir(frontend):
if _.endswith("Dataset"):
frontend_dataset = getattr(frontend, _)

# Borrow frontend's field info
self._field_info_class = frontend_dataset._field_info_class
Expand Down
Loading