Skip to content

Commit bd338e3

Browse files
authored
Merge pull request #5 from FujitsuResearch/feature/pypi
v1.0.2: Fix ImportError when matplotlib is not installed
2 parents 637a22c + 74d61c0 commit bd338e3

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change log
22

3+
## [v1.0.2] 2026-03-31
4+
5+
### Bug Fix
6+
7+
- Fixed `ImportError` when running `onecomp` CLI without matplotlib installed; `AutoBitQuantizer._visualize()` now catches the import error and logs a warning instead of crashing
8+
39
## [v1.0.1] 2026-03-31
410

511
### Packaging

onecomp/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
77
"""
88

9-
__version__ = "1.0.1"
9+
__version__ = "1.0.2"

onecomp/quantizer/autobit/_autobit.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,14 @@ def _assign_layer(self, name, module, child_q):
402402
child_q.module_to_name[module] = name
403403

404404
def _visualize(self, assignments):
405-
from .visualize import visualize_bit_assignment # lazy: heavy matplotlib dep
405+
try:
406+
from .visualize import visualize_bit_assignment
407+
except ImportError:
408+
self.logger.warning(
409+
"matplotlib is not installed; skipping visualization. "
410+
"Install with: pip install onecomp[visualize]"
411+
)
412+
return
406413

407414
layer_names = [name for name, _, _ in assignments]
408415
layer_bits = [

0 commit comments

Comments
 (0)