Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [1.5.1]

### Fixed

- `load_python_module` fixed

## [1.5.0]

### Added

- exception handling added to `ModuleEntry`

## [1.4.0]
Expand Down
5 changes: 5 additions & 0 deletions kaizo/utils/module.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import sys
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import ModuleType
Expand All @@ -12,6 +13,10 @@ def load_python_module(path: Path) -> ModuleType:
msg = f"Local Python file not found: {path}"
raise FileNotFoundError(msg)

module_dir = str(path.parent)
if module_dir not in sys.path:
sys.path.insert(0, module_dir)

module_name = path.stem
spec = spec_from_file_location(module_name, path)
if spec is None or spec.loader is None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kaizo"
version = "1.5.0"
version = "1.5.1"
description = "declarative YAML-based configuration parser"
authors = [{ name = "Mohammad Ghazanfari", email = "mgh.5225@gmail.com" }]
readme = "README.md"
Expand Down
Loading