patch-torchcodec 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patch-torchcodec
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Patch TorchCodec to use PyAV's bundled FFmpeg — one command, no system FFmpeg needed
5
- Project-URL: Homepage, https://github.com/open-world-agents/MediaRef
6
- Project-URL: Repository, https://github.com/open-world-agents/MediaRef
7
- Author: MediaRef Contributors
5
+ Author-email: Suhwan Choi <milkclouds00@gmail.com>
8
6
  License-Expression: MIT
9
7
  Keywords: decoder,ffmpeg,patchelf,pyav,torchcodec,video
10
8
  Classifier: Development Status :: 4 - Beta
@@ -4,13 +4,13 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "patch-torchcodec"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "Patch TorchCodec to use PyAV's bundled FFmpeg — one command, no system FFmpeg needed"
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  requires-python = ">=3.9"
12
12
  authors = [
13
- { name = "MediaRef Contributors" }
13
+ { name = "Suhwan Choi", email = "milkclouds00@gmail.com" }
14
14
  ]
15
15
  keywords = ["torchcodec", "ffmpeg", "pyav", "video", "decoder", "patchelf"]
16
16
  classifiers = [
@@ -33,10 +33,6 @@ dependencies = [
33
33
  [project.scripts]
34
34
  patch-torchcodec = "patch_torchcodec.__main__:main"
35
35
 
36
- [project.urls]
37
- Homepage = "https://github.com/open-world-agents/MediaRef"
38
- Repository = "https://github.com/open-world-agents/MediaRef"
39
-
40
36
  [tool.hatch.build.targets.wheel]
41
37
  packages = ["src/patch_torchcodec"]
42
38
 
@@ -15,7 +15,7 @@ Alternative (no binary patching):
15
15
 
16
16
  from __future__ import annotations
17
17
 
18
- __version__ = "0.1.1"
18
+ __version__ = "0.1.3"
19
19
 
20
20
  from .core import (
21
21
  create_all_symlinks,
@@ -143,15 +143,20 @@ def setup(verbose: bool = False) -> bool:
143
143
  def find_torchcodec_libs() -> list[Path]:
144
144
  """Find TorchCodec shared libraries.
145
145
 
146
+ Uses importlib.util.find_spec to locate the package without importing it,
147
+ avoiding the chicken-and-egg problem where import torchcodec fails because
148
+ FFmpeg libraries aren't available yet (which is the whole reason for patching).
149
+
146
150
  Returns:
147
151
  List of paths to TorchCodec .so files.
148
152
  """
149
- try:
150
- import torchcodec
151
- torchcodec_dir = Path(torchcodec.__file__).parent
152
- return list(torchcodec_dir.glob("libtorchcodec_*.so"))
153
- except ImportError:
153
+ import importlib.util
154
+
155
+ spec = importlib.util.find_spec("torchcodec")
156
+ if spec is None or spec.origin is None:
154
157
  return []
158
+ torchcodec_dir = Path(spec.origin).parent
159
+ return list(torchcodec_dir.glob("libtorchcodec_*.so"))
155
160
 
156
161
 
157
162
  def find_patchelf() -> Path | None: