Skip to content

Commit d57e59e

Browse files
committed
Updated
1 parent 57152c8 commit d57e59e

File tree

6 files changed

+9
-52
lines changed

6 files changed

+9
-52
lines changed

Makefile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
1-
# some useful commands for developing
2-
3-
4-
update-rest-api:
5-
poetry run python dlt_init_openapi/utils/update_rest_api.py
6-
71
dev:
82
poetry install --all-extras
93

104
# lint
11-
lint: update-rest-api
5+
lint:
126
rm -rf tests/_local
137
poetry run flake8 dlt_init_openapi tests
148
poetry run mypy dlt_init_openapi tests
159
poetry run black tests dlt_init_openapi --check
1610
poetry run isort --profile black tests dlt_init_openapi --check --diff
1711

1812
# format the whole project
19-
format: update-rest-api
13+
format:
2014
rm -rf tests/_local
2115
poetry run isort --profile black tests dlt_init_openapi
2216
poetry run black tests dlt_init_openapi
2317

2418
# all tests excluding the checks on e2e tests
25-
test: update-rest-api
19+
test:
2620
poetry run python dlt_init_openapi/utils/update_rest_api.py
2721
poetry run pytest tests --ignore=tests/e2e
2822

2923
# test without running all the specs through a source
30-
test-fast: update-rest-api
24+
test-fast:
3125
poetry run pytest tests -m "not slow" --ignore=tests/e2e
3226

33-
test-slow: update-rest-api
27+
test-slow:
3428
poetry run pytest tests -m "slow" --ignore=tests/e2e
3529

3630
# dev helpers

dlt_init_openapi/cli/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from dlt_init_openapi.cli.cli_endpoint_selection import questionary_endpoint_selection
1111
from dlt_init_openapi.config import Config
1212
from dlt_init_openapi.exceptions import DltOpenAPITerminalException
13-
from dlt_init_openapi.utils import update_rest_api
1413

1514
app = typer.Typer(add_completion=False)
1615

@@ -50,7 +49,6 @@ def init(
5049
"--allow-openapi-2",
5150
help="Allow to use OpenAPI v2. specs. Migration of the spec to 3.0 is recommended though.",
5251
),
53-
update_rest_api_source: bool = typer.Option(False, help="Update the locally cached rest_api verified source."),
5452
version: bool = typer.Option(False, "--version", callback=_print_version, help="Print the version and exit"),
5553
) -> None:
5654
"""Generate a new dlt pipeline"""
@@ -64,7 +62,6 @@ def init(
6462
interactive=interactive,
6563
log_level=log_level,
6664
global_limit=global_limit,
67-
update_rest_api_source=update_rest_api_source,
6865
allow_openapi_2=allow_openapi_2,
6966
)
7067

@@ -100,7 +97,6 @@ def _init_command_wrapped(
10097
try:
10198

10299
# sync rest api
103-
update_rest_api.update_rest_api(force=update_rest_api_source)
104100

105101
config = _load_config(
106102
path=config_path,

dlt_init_openapi/config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111

1212
from .typing import TEndpointFilter
1313

14-
# In dlt>=1.11.0, the rest_api is part of the main package
15-
# For backwards compatibility, we keep a stub directory
16-
REST_API_SOURCE_LOCATION = str(pathlib.Path(__file__).parent / "rest_api")
14+
1715

1816
# Placeholder for SecretsTomlConfig to resolve ImportError in tests
19-
SecretsTomlConfig = Dict[str, Any]
17+
# SecretsTomlConfig = Dict[str, Any]
2018

2119

2220
class Config(BaseModel):

dlt_init_openapi/renderer/default/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from jinja2 import Environment, PackageLoader
99
from loguru import logger
1010

11-
from dlt_init_openapi.config import REST_API_SOURCE_LOCATION, Config
11+
from dlt_init_openapi.config import Config
1212
from dlt_init_openapi.parser.openapi_parser import OpenapiParser
1313
from dlt_init_openapi.renderer.base_renderer import BaseRenderer
1414
from dlt_init_openapi.utils import misc
@@ -67,8 +67,6 @@ def run(self, openapi: OpenapiParser, dry: bool = False) -> None:
6767
self._build_meta_files()
6868
self._run_post_hooks()
6969

70-
# copy rest api source into project dir
71-
shutil.copytree(REST_API_SOURCE_LOCATION, str(self.config.project_dir / "rest_api"))
7270

7371
def _build_meta_files(self) -> None:
7472
requirements_template = self.env.get_template("requirements.txt.j2")

dlt_init_openapi/utils/update_rest_api.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/integration/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from dlt.sources.rest_api.typing import ClientConfig, EndpointResource, RESTAPIConfig
99

1010
from dlt_init_openapi import Project, _get_project_for_url_or_path
11-
from dlt_init_openapi.config import REST_API_SOURCE_LOCATION, Config, SecretsTomlConfig
12-
from dlt_init_openapi.parser.context import OpenapiContext
11+
from dlt_init_openapi.config import Config
1312
from tests.cases import case_path
1413

1514
LOCAL_DIR = "tests/_local/"
@@ -43,7 +42,6 @@ def get_source_or_dict_from_open_api(
4342
This function renders the source into a string and returns the extracted
4443
dict for further inspection
4544
"""
46-
shutil.copytree(REST_API_SOURCE_LOCATION, LOCAL_DIR + "rest_api", dirs_exist_ok=True)
4745

4846
TOP = """
4947
# type: ignore
@@ -83,8 +81,6 @@ def get_source_or_dict_from_open_api(
8381
module = importlib.import_module(local.replace("/", "."))
8482
importlib.reload(module)
8583

86-
shutil.rmtree(LOCAL_DIR + "rest_api")
87-
8884
return cast(DltSource, module.test_source())
8985

9086

0 commit comments

Comments
 (0)