Skip to content
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9973955
skeleton: components module from dynamic text input
aaronsteers Dec 13, 2024
8309f79
refactor / clean up
aaronsteers Dec 16, 2024
399dd7b
add test resource for py_components unit test
aaronsteers Dec 19, 2024
9115757
add fixture for custom py components scenario
aaronsteers Dec 19, 2024
5dc664c
add test
aaronsteers Dec 19, 2024
5be084f
chore: add missing guard statement
aaronsteers Jan 13, 2025
7379eea
chore: remove stale comment
aaronsteers Jan 13, 2025
51cbcbd
checkpoint: passing tests with pokeapi
aaronsteers Jan 13, 2025
aaef285
chore: add `poe lock` task definition
aaronsteers Jan 13, 2025
e7c3eae
add 'source_the_guardian_api' test resources
aaronsteers Jan 13, 2025
2300f7a
checkpoint: working `check`
aaronsteers Jan 13, 2025
4efcd40
checkpoint: working discover
aaronsteers Jan 13, 2025
cb6a4ab
checkpoint: working sync
aaronsteers Jan 13, 2025
051c57b
improve module name parsing
aaronsteers Jan 13, 2025
e511a2b
remove unused files
aaronsteers Jan 13, 2025
a19b5c1
tidy up
aaronsteers Jan 13, 2025
c837745
skip if no creds
aaronsteers Jan 13, 2025
c54a73d
cosmetic: cleaner diff
aaronsteers Jan 15, 2025
3f66c46
don't fail when custom components.py is already grafted into filesystem
aaronsteers Jan 15, 2025
75332e8
clean up import code
aaronsteers Jan 15, 2025
67b84a0
clean up imports, implement safety mechanisms and blocked-by-default …
aaronsteers Jan 15, 2025
5805649
fix mypy issues
aaronsteers Jan 15, 2025
3251e5c
Update unit_tests/source_declarative_manifest/test_source_declarative…
aaronsteers Jan 15, 2025
877d721
more clean up
aaronsteers Jan 15, 2025
7531ed0
fix ruff format issue
aaronsteers Jan 15, 2025
5e7e826
add intentionally failing use case
aaronsteers Jan 15, 2025
c654ef5
validate input text
aaronsteers Jan 15, 2025
6badf7e
clean up module name parsing
aaronsteers Jan 15, 2025
b81ca33
refactor and clean up interfaces
aaronsteers Jan 16, 2025
ceab6fd
use monkeypatch for setting env vars
aaronsteers Jan 16, 2025
714360c
full code review and cleanup
aaronsteers Jan 16, 2025
c8de81a
apply suggestion
aaronsteers Jan 16, 2025
a084e7a
apply suggestion
aaronsteers Jan 16, 2025
0491b99
apply suggestion
aaronsteers Jan 16, 2025
7134340
apply suggestion
aaronsteers Jan 16, 2025
bff4dc4
fix lint issues
aaronsteers Jan 21, 2025
15cd254
clean up tests
aaronsteers Jan 21, 2025
3921341
Merge branch 'main' into aj/feat/accept-components-text-input
aaronsteers Jan 21, 2025
6c4e01f
autofix lint issue
aaronsteers Jan 21, 2025
6c81115
fix tests
aaronsteers Jan 21, 2025
1c35577
fix another test
aaronsteers Jan 21, 2025
e6b28b6
fix failing test
aaronsteers Jan 22, 2025
f29f616
mark full sync as slow test (~60s)
aaronsteers Jan 22, 2025
7ba5417
fix: use `importlib` instead of `sys.modules`
aaronsteers Jan 22, 2025
7df5801
Merge branch 'main' into aj/feat/fix-python-components-ref
aaronsteers Jan 22, 2025
6899cb1
chore: add back missing import
aaronsteers Jan 22, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import annotations

import datetime
import importlib
import inspect
import re
import sys
Expand Down Expand Up @@ -1180,14 +1181,17 @@ def _get_class_from_fully_qualified_class_name(
module_name_full = ".".join(split[:-1])
class_name = split[-1]

if module_name_full == COMPONENTS_MODULE_NAME:
# Assume "components" on its own means "source_declarative_manifest.components"
module_name_full = SDM_COMPONENTS_MODULE_NAME
try:
module_ref = importlib.import_module(module_name_full)
except ModuleNotFoundError as e:
raise ValueError(f"Could not load module `{module_name_full}`.") from e

try:
return getattr(sys.modules[module_name_full], class_name)
except (AttributeError, ModuleNotFoundError) as e:
raise ValueError(f"Could not load class {full_qualified_class_name}.") from e
return getattr(module_ref, class_name)
except AttributeError as e:
raise ValueError(
f"Could not load class `{class_name}` from module `{module_name_full}`.",
) from e

@staticmethod
def _derive_component_type_from_type_hints(field_type: Any) -> Optional[str]:
Expand Down
Loading