Skip to content

Commit 3a06a64

Browse files
committed
Fix smoke-test build and fix linter issues
1 parent db30bfa commit 3a06a64

File tree

11 files changed

+76
-69
lines changed

11 files changed

+76
-69
lines changed

Diff for: datahub-actions/setup.py

-5
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,7 @@ def get_long_description():
120120
*base_requirements,
121121
*framework_common,
122122
*mypy_stubs,
123-
"black>=22.1.0",
124123
"coverage>=5.1",
125-
"flake8>=3.8.3",
126-
"flake8-tidy-imports>=4.3.0",
127-
"isort>=5.7.0",
128-
"mypy==1.0.0",
129124
"pytest>=6.2.2",
130125
"pytest-cov>=2.8.1",
131126
"pytest-dependency>=0.5.1",

Diff for: datahub-actions/smoke-test/build.gradle

+10-13
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,20 @@ task installDev(type: Exec) {
1919
}
2020

2121
task pythonLint(type: Exec, dependsOn: installDev) {
22-
commandLine 'bash', '-c',
23-
"source ${venv_name}/bin/activate && set -x && " +
24-
"black --check --diff tests/ && " +
25-
"isort --check --diff tests/ && " +
26-
"ruff --statistics tests/ && " +
27-
"mypy tests/"
22+
commandLine 'bash', '-c',
23+
"source ${venv_name}/bin/activate && set -x && " +
24+
"ruff check tests/ && " +
25+
"ruff format --check tests/ && " +
26+
"mypy --show-traceback --show-error-codes tests/"
2827
}
28+
2929
task pythonLintFix(type: Exec, dependsOn: installDev) {
30-
commandLine 'bash', '-c',
31-
"source ${venv_name}/bin/activate && set -x && " +
32-
"black tests/ && " +
33-
"isort tests/ && " +
34-
"ruff --fix tests/ && " +
35-
"mypy tests/"
30+
commandLine 'bash', '-c',
31+
"source ${venv_name}/bin/activate && set -x && " +
32+
"ruff check --fix tests/ && " +
33+
"ruff format tests/ "
3634
}
3735

38-
3936
task lint {
4037
dependsOn pythonLint
4138
}

Diff for: datahub-actions/smoke-test/pyproject.toml

+49-35
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,60 @@
11
[build-system]
2-
requires = ["setuptools"]
32
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools>=54.0.0", "wheel", "pip>=21.0.0"]
44

5-
[project]
6-
name = "smoke-test"
7-
version = "0.0.0"
8-
description = ""
9-
authors = [
10-
{ name="Acryl Data", email="[email protected]" },
5+
[tool.ruff]
6+
line-length = 88
7+
target-version = "py38"
8+
exclude = [
9+
".git",
10+
"venv",
11+
".tox",
12+
"__pycache__",
1113
]
12-
requires-python = ">=3.9"
13-
1414

15-
[tool.black]
16-
extend-exclude = '''
17-
# A regex preceded with ^/ will apply only to files and directories
18-
# in the root of the project.
19-
tmp
20-
venv
21-
'''
22-
include = '\.pyi?$'
23-
target-version = ['py310']
15+
[tool.ruff.format]
16+
quote-style = "double"
17+
indent-style = "space"
18+
skip-magic-trailing-comma = false
19+
line-ending = "auto"
2420

25-
[tool.isort]
26-
profile = 'black'
21+
[tool.ruff.lint.isort]
22+
combine-as-imports = true
23+
known-first-party = ["datahub"]
24+
extra-standard-library = ["__future__"]
25+
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
26+
force-sort-within-sections = false
27+
force-wrap-aliases = false
28+
split-on-trailing-comma = false
29+
order-by-type = true
30+
relative-imports-order = "closest-to-furthest"
31+
force-single-line = false
32+
single-line-exclusions = ["typing"]
33+
length-sort = false
34+
from-first = false
35+
required-imports = []
36+
classes = ["typing"]
2737

28-
[tool.ruff]
38+
[tool.ruff.lint]
39+
extend-select = [
40+
"B", # flake8-bugbear
41+
"C90", # mccabe complexity
42+
"E", # pycodestyle errors
43+
"F", # pyflakes
44+
"G010", # logging.warn -> logging.warning
45+
"I", # isort
46+
"TID", # flake8-tidy-imports
47+
"RUF100", # unused-noqa
48+
]
2949
ignore = [
30-
'E501', # Ignore line length, since black handles that.
31-
'D203', # Ignore 1 blank line required before class docstring.
50+
"E501", # Line length violations (handled by formatter)
3251
]
3352

34-
[tool.mypy]
35-
exclude = "^(venv/|build/|dist/)"
36-
ignore_missing_imports = true
37-
namespace_packages = false
38-
check_untyped_defs = true
39-
disallow_untyped_decorators = true
40-
warn_unused_configs = true
41-
# eventually we'd like to enable these
42-
disallow_incomplete_defs = false
43-
disallow_untyped_defs = false
53+
[tool.ruff.lint.mccabe]
54+
max-complexity = 15
55+
56+
[tool.ruff.lint.flake8-tidy-imports]
57+
ban-relative-imports = "all"
4458

45-
[tool.pyright]
46-
extraPaths = ['tests']
59+
[tool.ruff.lint.per-file-ignores]
60+
"__init__.py" = ["F401"]

Diff for: datahub-actions/smoke-test/requirements.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ networkx
1010
# libaries for linting below this
1111
black==23.7.0
1212
isort==5.12.0
13-
mypy==1.5.1
14-
ruff==0.0.287
13+
mypy==1.10.1
14+
ruff==0.9.7
1515
# stub version are copied from metadata-ingestion/setup.py and that should be the source of truth
1616
types-requests>=2.28.11.6,<=2.31.0.3
1717
types-PyYAML
18+
joblib-stubs
1819
# https://github.com/docker/docker-py/issues/3256
1920
requests<=2.31.0
2021
# Missing numpy requirement in 8.0.0
2122
deepdiff!=8.0.0
2223
acryl-datahub
2324
jinja2
24-
-e ../datahub-actions
25+
-e ../

Diff for: datahub-actions/smoke-test/tests/actions/doc_propagation/test_propagation.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
from pathlib import Path
88
from typing import Any, Dict, Iterator, List, Tuple
99

10-
import datahub.metadata.schema_classes as models
1110
import pytest
1211
import tenacity
12+
from jinja2 import Template
13+
from pydantic import BaseModel
14+
15+
import datahub.metadata.schema_classes as models
1316
from datahub.api.entities.dataset.dataset import Dataset
1417
from datahub.emitter.mce_builder import make_schema_field_urn
1518
from datahub.emitter.mcp import MetadataChangeProposalWrapper
@@ -18,9 +21,6 @@
1821
from datahub.ingestion.graph.client import DatahubClientConfig, DataHubGraph
1922
from datahub.ingestion.sink.file import FileSink, FileSinkConfig
2023
from datahub.utilities.urns.urn import Urn
21-
from jinja2 import Template
22-
from pydantic import BaseModel
23-
2424
from tests.utils import (
2525
delete_urns_from_file,
2626
get_gms_url,

Diff for: datahub-actions/smoke-test/tests/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
from datetime import datetime, timedelta, timezone
77
from typing import Any, Dict, List, Tuple
88

9-
from datahub.cli import cli_utils, env_utils
10-
from datahub.ingestion.graph.client import DataHubGraph, get_default_graph
11-
from datahub.ingestion.run.pipeline import Pipeline
129
from joblib import Parallel, delayed
1310

1411
import requests_wrapper as requests
12+
from datahub.cli import cli_utils, env_utils
13+
from datahub.ingestion.graph.client import DataHubGraph, get_default_graph
14+
from datahub.ingestion.run.pipeline import Pipeline
1515
from tests.consistency_utils import wait_for_writes_to_sync
1616

1717
TIME: int = 1581407189000
@@ -97,7 +97,7 @@ def check_endpoint(url):
9797
else:
9898
return f"{url}: is Not reachable, status_code: {get.status_code}"
9999
except requests.exceptions.RequestException as e:
100-
raise SystemExit(f"{url}: is Not reachable \nErr: {e}")
100+
raise SystemExit(f"{url}: is Not reachable \nErr: {e}") from e
101101

102102

103103
def ingest_file_via_rest(filename: str) -> Pipeline:

Diff for: datahub-actions/src/datahub_actions/plugin/action/propagation/docs/propagation_action.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -852,4 +852,4 @@ def _propagate_to_siblings(
852852
yield maybe_mcp
853853

854854
def close(self) -> None:
855-
return super().close()
855+
return

Diff for: datahub-actions/src/datahub_actions/plugin/action/snowflake/snowflake_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ def run_query(self, database: str, schema: str, query: str) -> None:
127127
)
128128

129129
def close(self) -> None:
130-
return super().close()
130+
return

Diff for: datahub-actions/src/datahub_actions/plugin/action/snowflake/tag_propagator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, config: SnowflakeTagPropagatorConfig, ctx: PipelineContext):
6161

6262
def close(self) -> None:
6363
self.snowflake_tag_helper.close()
64-
return super().close()
64+
return
6565

6666
@classmethod
6767
def create(cls, config_dict: dict, ctx: PipelineContext) -> "Action":

Diff for: datahub-actions/src/datahub_actions/plugin/action/tag/tag_propagation_action.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ def act(self, event: EventEnvelope) -> None:
158158
logger.debug(f"Not propagating {tag_propagation_directive.tag}")
159159

160160
def close(self) -> None:
161-
return super().close()
161+
return

Diff for: datahub-actions/src/datahub_actions/plugin/action/term/term_propagation_action.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ def act(self, event: EventEnvelope) -> None:
185185
)
186186

187187
def close(self) -> None:
188-
return super().close()
188+
return

0 commit comments

Comments
 (0)