Skip to content

Commit

Permalink
chore: extensions requirements purge
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Jul 6, 2023
1 parent 2868ef3 commit f36f922
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
2 changes: 0 additions & 2 deletions popmon/extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
from popmon.extensions.profile_diptest import Diptest

extensions = [Diptest()]
for extension in extensions:
extension.check()
14 changes: 0 additions & 14 deletions popmon/extensions/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,9 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import annotations

import importlib.util
from typing import Callable


def is_installed(package) -> bool:
is_present = importlib.util.find_spec(package)
return is_present is not None


class Extension:
name: str
extension: Callable
# should also be added to `pyproject.toml` optional-dependencies
requirements: list[str]

def check(self) -> None:
if all(is_installed(package) for package in self.requirements):
func = self.extension
func = func.__func__
func()
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ dependencies = [
"htmlmin",
"pydantic>=2",
"pydantic-settings",
"typing_extensions",
"tomli >= 1.1.0 ; python_version < '3.11'"
"typing_extensions"
]
classifiers = [
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit f36f922

Please sign in to comment.