Skip to content

Commit 5dfcf00

Browse files
committed
make numpy a typing-only dependency
* wrap numpy imports in TYPE_CHECKING * remove numpy from runtime dependencies * add numpy as a testing requirement * update CI/nox configuration
1 parent 162c445 commit 5dfcf00

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def test(session: nox.Session) -> None:
2929
@nox.session(name="test-cli")
3030
def test_cli(session: nox.Session) -> None:
3131
"""Test the command line interface."""
32-
session.install("-r", "requirements/requires.txt")
33-
session.install(".", "--no-deps")
32+
session.install(".")
3433
session.run("bmi-render", "--help")
3534
session.run("bmi-render", "--version")
3635

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ classifiers = [
3030
"Topic :: Scientific/Engineering :: Physics",
3131
]
3232
dependencies = [
33-
"numpy",
3433
]
3534
dynamic = [
3635
"readme",
3736
]
3837

3938
[project.optional-dependencies]
39+
dev = ["nox"]
4040
testing = [
4141
"coverage",
4242
"pytest",

requirements.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/requires.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/bmipy/bmi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
from abc import ABC
1010
from abc import abstractmethod
11+
from typing import TYPE_CHECKING
1112
from typing import Any
1213

13-
import numpy as np
14-
from numpy.typing import NDArray
14+
if TYPE_CHECKING:
15+
import numpy as np
16+
from numpy.typing import NDArray
1517

1618

1719
class Bmi(ABC):

0 commit comments

Comments
 (0)