Skip to content

Commit 7dd76af

Browse files
committed
chore: Matplotlib/plotting should be an optional dependency #10
- Remove matplotlib from requirements.txt - Add extras_require for plotting in setup.py - Update contact email in setup.py - Add import error handling for matplotlib in classes.py for missing optional requirement
1 parent 72c8eb2 commit 7dd76af

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#python >= 3.7
22
numpy
3-
matplotlib
43
hypothesis
54
pandas

setup.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
from setuptools import find_packages, setup
66

7+
from src.fuzzylogic import __version__
8+
79
here = os.path.abspath(os.path.dirname(__file__))
810
src = os.path.join(here, "src/fuzzylogic")
911
sys.path.append(src)
1012

11-
1213
__license__ = "MIT"
13-
__version__ = "1.4.0"
1414
__author__ = "Anselm Kiefner"
15-
__contact__ = "fuzzylogic-pypi@anselm.kiefner.de"
15+
__contact__ = "[email protected]"
1616

1717
classifiers = [
1818
"Development Status :: 5 - Production/Stable",
@@ -39,10 +39,13 @@
3939
description="Fuzzy Logic for Python 3",
4040
license=__license__,
4141
url="https://github.com/amogorkon/fuzzylogic",
42-
version=__version__,
42+
version=".".join(str(c) for c in __version__),
4343
author=__author__,
4444
author_email=__contact__,
4545
python_requires=">=3.12",
4646
keywords="fuzzy logic",
4747
classifiers=classifiers,
48+
extras_require={
49+
"plotting": ["matplotlib"],
50+
},
4851
)

src/fuzzylogic/classes.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@
55
adding logical operaitons for easier handling.
66
"""
77

8-
from typing import Callable
8+
from typing import Callable, Iterable
9+
10+
try:
11+
import matplotlib.pyplot as plt
12+
except ImportError:
13+
14+
def plt(*args, **kwargs):
15+
raise ImportError(
16+
"matplotlib not available. Please re-install with 'pip install fuzzylogic[plotting]'"
17+
)
18+
919

10-
import matplotlib.pyplot as plt
1120
import numpy as np
1221

1322
from .combinators import MAX, MIN, bounded_sum, product, simple_disjoint_sum

0 commit comments

Comments
 (0)