diff --git a/extras.json b/extras.json deleted file mode 100644 index 35033643..00000000 --- a/extras.json +++ /dev/null @@ -1 +0,0 @@ -{"diptest": ["diptest"]} \ No newline at end of file diff --git a/popmon/extensions/extension.py b/popmon/extensions/extension.py index 7c8695b2..ad53218d 100644 --- a/popmon/extensions/extension.py +++ b/popmon/extensions/extension.py @@ -19,14 +19,8 @@ from __future__ import annotations import importlib.util -from pathlib import Path from typing import Callable -try: - import tomllib -except ModuleNotFoundError: - import tomli as tomllib - def is_installed(package): is_present = importlib.util.find_spec(package) @@ -36,19 +30,8 @@ def is_installed(package): class Extension: name: str extension: Callable - - @property - def requirements(self): - pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml" - with pyproject_path.open("rb") as f: - data = tomllib.load(f) - - project = data["project"] - extras = project.get("optional-dependencies", {}) - if self.name not in extras: - return [] - - return extras[self.name] + # should also be added to `pyproject.toml` optional-dependencies + requirements: list[str] def check(self): if all(is_installed(package) for package in self.requirements): diff --git a/popmon/extensions/profile_diptest.py b/popmon/extensions/profile_diptest.py index 92118655..21b597c3 100644 --- a/popmon/extensions/profile_diptest.py +++ b/popmon/extensions/profile_diptest.py @@ -68,3 +68,4 @@ def diptest_profile(bin_centers, bin_values, bin_width, rng=None): class Diptest(Extension): name = "diptest" extension = extension + requirements = ["diptest"] diff --git a/pyproject.toml b/pyproject.toml index 9de7ffd4..61b0083b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,7 @@ dependencies = [ "joblib>=0.14.0", "htmlmin", "pydantic", - "typing_extensions", - "tomli >= 1.1.0 ; python_version < '3.11'" + "typing_extensions" ] classifiers = [ "Programming Language :: Python :: 3",