dlt-hub / dlt-hub/dlt

feat(qol): `WorkspaceRunContext.module` should be a method

Open
#3,942 0 comments 0 reactions 1 assignee Claimed by @rudolfix View on GitHub
needs decision QoL
Dominant language
Python
Stars
5.9k
Forks
600
Avg merge
1d 14h
Merged PRs (30d)
38

Description

Given that `WorkspaceRunContext.module` tries to import a Python module, which can be expensive and can have extensive side-effects, it should be a method.

```python
# current code
@property
def module(self) -> Optional[ModuleType]:
try:
return self.import_run_dir_module(self.run_dir)
except (ImportError, TypeError):
return None
```

Calling `dlt.current.workspace().module()` or `.get_module()` better communicates the intent of this operation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.