Skip to content

Commit

Permalink
Made opencv dependency optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoel-bagard committed Apr 21, 2023
1 parent 6086874 commit 7a017e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ These stubs are a temporary help until official ones are made (see [this issue](

## Installation

The package is available on pypi [here](https://pypi.org/project/opencv-stubs/), you can install it with:

```
pip install opencv-stubs
```

The dependency on opencv is optional, and be accessed with `pip install opencv-stubs[opencv]` or `pip install opencv-stubs[opencv-headless]`.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
]
license = {text = "MIT"}
dynamic = ["version"]
dependencies = ["numpy>=1.21", "opencv-python>=4.7.0.0"]
dependencies = ["numpy>=1.21"]
requires-python = ">=3.8"
packages = [
{ "include" = "cv2-stubs"}
Expand All @@ -34,6 +34,9 @@ packages = [
[project.optional-dependencies]
dev = ["pre-commit", "pip-tools", "ruff", "pyright"]
build = ["hatch"]
# I couldn't figure out how to have "opencv or opencv-headless" as dependency, so they are both optional.
opencv = ["opencv-python>=4.7.0"]
opencv-headless = ["opencv-python-headless>=4.7.0"]

[tool.hatch.version]
path = "src/cv2-stubs/__init__.pyi"
Expand Down
2 changes: 1 addition & 1 deletion src/cv2-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.0.3"
__version__ = "0.0.4"

from collections.abc import Iterable, Sequence
from typing import TypeVar
Expand Down

0 comments on commit 7a017e6

Please sign in to comment.