Skip to content

Commit

Permalink
Dependency management (#118)
Browse files Browse the repository at this point in the history
* Drop `av` as a hard dependency

* Remove av and fix tests

* Remove livecov from dev tools

* Pin ndx-pose

* Pin ndx-pose

* Bump to 0.1.9
  • Loading branch information
talmo committed Sep 28, 2024
1 parent 096eefd commit 7e91d04
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
3 changes: 1 addition & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies:
- ffmpeg
- imageio
- imageio-ffmpeg >=0.5.0
- av
- attrs
- pandas
- simplejson
Expand All @@ -17,7 +16,7 @@ dependencies:
- numpy
- opencv
- pynwb
- ndx-pose
- ndx-pose<0.2.0
- pytest
- pytest-cov
- black
Expand Down
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ dependencies = [
"attrs",
"h5py>=3.8.0",
"pynwb",
"ndx-pose",
"ndx-pose<0.2.0",
"pandas",
"simplejson",
"imageio",
"imageio-ffmpeg>=0.5.0",
"av"]
"imageio-ffmpeg>=0.5.0"]
dynamic = ["version", "readme"]

[tool.setuptools.dynamic]
Expand Down Expand Up @@ -67,9 +66,3 @@ line-length = 88
[pydocstyle]
convention = "google"
match-dir = "sleap_io"

[tool.coverage.run]
source = ["livecov"]

[tool.pytest.ini_options]
addopts = "--cov sleap_io --cov-report=lcov:lcov.info --cov-report=term"
2 changes: 1 addition & 1 deletion sleap_io/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Define package version.
# This is read dynamically by setuptools in pyproject.toml to determine the release version.
__version__ = "0.1.8"
__version__ = "0.1.9"
36 changes: 22 additions & 14 deletions tests/io/test_video_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_get_frame(centered_pair_low_quality_path):

@pytest.mark.parametrize("keep_open", [False, True])
def test_mediavideo(centered_pair_low_quality_path, keep_open):
# Test with FFMPEG backend
backend = VideoBackend.from_filename(
centered_pair_low_quality_path, plugin="FFMPEG", keep_open=keep_open
)
Expand All @@ -74,21 +75,28 @@ def test_mediavideo(centered_pair_low_quality_path, keep_open):
else:
assert backend._open_reader is None

backend = VideoBackend.from_filename(
centered_pair_low_quality_path, plugin="pyav", keep_open=keep_open
)
assert type(backend) == MediaVideo
assert backend.filename == centered_pair_low_quality_path
assert backend.shape == (1100, 384, 384, 1)
assert backend[0].shape == (384, 384, 1)
assert backend[:3].shape == (3, 384, 384, 1)
if keep_open:
assert backend._open_reader is not None
assert backend[0].shape == (384, 384, 1)
assert type(backend._open_reader).__name__ == "PyAVPlugin"
else:
assert backend._open_reader is None
# Test with pyav backend (if installed)
try:
import av

backend = VideoBackend.from_filename(
centered_pair_low_quality_path, plugin="pyav", keep_open=keep_open
)
assert type(backend) == MediaVideo
assert backend.filename == centered_pair_low_quality_path
assert backend.shape == (1100, 384, 384, 1)
assert backend[0].shape == (384, 384, 1)
assert backend[:3].shape == (3, 384, 384, 1)
if keep_open:
assert backend._open_reader is not None
assert backend[0].shape == (384, 384, 1)
assert type(backend._open_reader).__name__ == "PyAVPlugin"
else:
assert backend._open_reader is None
except ImportError:
pass

# Test with opencv backend
backend = VideoBackend.from_filename(
centered_pair_low_quality_path, plugin="opencv", keep_open=keep_open
)
Expand Down

0 comments on commit 7e91d04

Please sign in to comment.