Skip to content

Commit d1184ee

Browse files
authored
Merge pull request #836 from atlanhq/BLDX-711
BLDX-711 | Regenerate v9 models, fix tests, add lazy_loader + IDE stubs
2 parents 2f35fa5 + 1d5a2eb commit d1184ee

454 files changed

Lines changed: 11195 additions & 5215 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/generate-v9-models/SKILL.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ Copy generated files from the staging dir to the SDK, **excluding** these files
6161

6262
| File | Reason |
6363
|------|--------|
64-
| `__init__.py` | Hand-written init with `__all__` |
64+
| `__init__.py` | Generated post-sync by `_generate_pkg_init.py` |
65+
| `__init__.pyi` | Generated post-sync by `_generate_pkg_init.py` |
6566
| `entity.py` | Patched: `_metadata_proxies`, `type_name: Any`, `SaveSemantic` |
6667
| `referenceable.py` | Patched: `InternalKeywordField`, field descriptors, helper exports |
6768
| `atlas_glossary.py` | Patched: GTC anchor-in-attributes handling |
@@ -75,6 +76,7 @@ Copy generated files from the staging dir to the SDK, **excluding** these files
7576
```bash
7677
rsync -av \
7778
--exclude='__init__.py' \
79+
--exclude='__init__.pyi' \
7880
--exclude='entity.py' \
7981
--exclude='referenceable.py' \
8082
--exclude='atlas_glossary.py' \
@@ -102,7 +104,20 @@ rm -rf "$STAGING_DIR"
102104
"""Attributes of the relationship itself (e.g., description, status, etc.)."""
103105
```
104106

105-
### 5. Run ruff auto-fix and format
107+
### 5. Regenerate `__init__.py` and `__init__.pyi`
108+
109+
After syncing, regenerate the package init files from the `_init_*.py` modules:
110+
111+
```bash
112+
cd "${SDK_DIR}"
113+
uv run python pyatlan_v9/model/assets/_generate_pkg_init.py
114+
```
115+
116+
This scans all `_init_*.py` files and generates:
117+
- `__init__.py` with `lazy_loader.attach()` for lazy imports
118+
- `__init__.pyi` with explicit imports for IDE type hints
119+
120+
### 6. Run ruff auto-fix and format
106121

107122
After syncing and patching, run ruff to fix unused imports and format the generated files:
108123

@@ -112,13 +127,13 @@ uv run ruff check --fix --select F401,F811 pyatlan_v9/
112127
uv run ruff format pyatlan_v9/
113128
```
114129

115-
### 6. Run tests (if args contain "test")
130+
### 7. Run tests (if args contain "test")
116131

117132
```bash
118133
cd "${SDK_DIR}" && python -m pytest tests_v9/unit/ -x -q
119134
```
120135

121-
### 7. Report summary
136+
### 8. Report summary
122137

123138
Report: how many files were generated, how many synced, how many excluded, and test results if applicable.
124139

pyatlan/generator/class_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import json
1212
import os
1313
import re
14+
from collections.abc import Iterable
1415
from enum import Enum
1516
from pathlib import Path
16-
from collections.abc import Iterable
1717
from typing import Any, Dict, List, NamedTuple, Optional, Set
1818

1919
import networkx as nx

pyatlan_v9/client/aio/asset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,9 +2073,9 @@ async def add_dq_rule_schedule(
20732073
updated_asset = asset_type.updater(
20742074
qualified_name=asset_qualified_name, name=asset_name
20752075
)
2076-
updated_asset.asset_d_q_schedule_time_zone = schedule_time_zone
2077-
updated_asset.asset_d_q_schedule_crontab = schedule_crontab
2078-
updated_asset.asset_d_q_schedule_type = DataQualityScheduleType.CRON
2076+
updated_asset.asset_dq_schedule_time_zone = schedule_time_zone
2077+
updated_asset.asset_dq_schedule_crontab = schedule_crontab
2078+
updated_asset.asset_dq_schedule_type = DataQualityScheduleType.CRON
20792079
return await self.save(updated_asset)
20802080

20812081
@validate_arguments
@@ -2099,7 +2099,7 @@ async def set_dq_row_scope_filter_column(
20992099
updated_asset = asset_type.updater(
21002100
qualified_name=asset_qualified_name, name=asset_name
21012101
)
2102-
updated_asset.asset_d_q_row_scope_filter_column_qualified_name = (
2102+
updated_asset.asset_dq_row_scope_filter_column_qualified_name = (
21032103
row_scope_filter_column_qualified_name
21042104
)
21052105
return await self.save(updated_asset)

pyatlan_v9/client/asset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,9 +2234,9 @@ def add_dq_rule_schedule(
22342234
updated_asset = asset_type.updater(
22352235
qualified_name=asset_qualified_name, name=asset_name
22362236
)
2237-
updated_asset.asset_d_q_schedule_time_zone = schedule_time_zone
2238-
updated_asset.asset_d_q_schedule_crontab = schedule_crontab
2239-
updated_asset.asset_d_q_schedule_type = DataQualityScheduleType.CRON
2237+
updated_asset.asset_dq_schedule_time_zone = schedule_time_zone
2238+
updated_asset.asset_dq_schedule_crontab = schedule_crontab
2239+
updated_asset.asset_dq_schedule_type = DataQualityScheduleType.CRON
22402240
return self.save(updated_asset)
22412241

22422242
@validate_arguments
@@ -2260,7 +2260,7 @@ def set_dq_row_scope_filter_column(
22602260
updated_asset = asset_type.updater(
22612261
qualified_name=asset_qualified_name, name=asset_name
22622262
)
2263-
updated_asset.asset_d_q_row_scope_filter_column_qualified_name = (
2263+
updated_asset.asset_dq_row_scope_filter_column_qualified_name = (
22642264
row_scope_filter_column_qualified_name
22652265
)
22662266
return self.save(updated_asset)

pyatlan_v9/model/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33

44
from __future__ import annotations
55

6-
# Re-export all asset models from the assets subpackage
6+
from typing import Any
7+
8+
# Re-export eagerly loaded base classes from the assets subpackage
79
from .assets import * # noqa: F401, F403
810

911
# Re-export all names from the assets __all__
1012
from .assets import __all__ as _assets_all
1113

1214
__all__ = list(_assets_all)
15+
16+
17+
def __getattr__(name: str) -> Any:
18+
"""Delegate lazy imports to the assets subpackage."""
19+
from . import assets
20+
21+
return getattr(assets, name)

0 commit comments

Comments
 (0)