Skip to content

Commit da2f866

Browse files
authored
Merge branch 'main' into MINOR-Fix-Logging
2 parents c6a0d5e + fb0d5ec commit da2f866

1,685 files changed

Lines changed: 21550 additions & 43653 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.

.pre-commit-config.yaml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,30 @@ default_language_version:
22
python: python3
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v2.3.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-json
8-
exclude: vscode
9-
- repo: https://github.com/hadialqattan/pycln
10-
rev: v2.5.0
8+
# TODO: investigate and fix or remove the excluded files. The first
9+
# three carry real JSON issues (duplicate keys, malformed/empty
10+
# content) that pre-commit-hooks v2.3.0 didn't catch; v5.0.0 does.
11+
# The last is an intentionally malformed test fixture.
12+
exclude: |
13+
(?x)^(
14+
.*vscode.*|
15+
openmetadata-spec/src/main/resources/rdf/contexts/dataAsset\.jsonld|
16+
ingestion/examples/sample_data/pipelines/tasks\.json|
17+
openmetadata-service/src/main/resources/dataInsights/opensearch/indexSettingsTemplate\.json|
18+
openmetadata-ui/src/main/resources/ui/playwright/test-data/odcs-examples/invalid-malformed\.json
19+
)$
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.15.12
1122
hooks:
12-
- id: pycln
23+
- id: ruff-check
1324
files: ^(ingestion|openmetadata-airflow-apis)/
14-
args: [ "--config", "ingestion/pyproject.toml" ]
15-
- repo: https://github.com/timothycrosley/isort
16-
rev: 5.12.0
17-
hooks:
18-
- id: isort
19-
files: ^(ingestion|openmetadata-airflow-apis)/
20-
args: [ "--settings-file", "ingestion/pyproject.toml" ]
21-
- repo: https://github.com/ambv/black
22-
rev: 22.3.0
23-
hooks:
24-
- id: black
25+
args: ["--fix", "--config", "ingestion/pyproject.toml"]
26+
- id: ruff-format
2527
files: ^(ingestion|openmetadata-airflow-apis)/
26-
args: [ "--config", "ingestion/pyproject.toml" ]
28+
args: ["--config", "ingestion/pyproject.toml"]
2729
- repo: https://github.com/pre-commit/mirrors-prettier
2830
rev: v2.5.1
2931
hooks:

ingestion/Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ precommit_install: ## Install the project's precommit hooks from .pre-commit-co
6262
pre-commit install
6363

6464
.PHONY: py_format
65-
py_format: ## Run black and isort to format the Python codebase
66-
pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
67-
isort $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --settings-file $(INGESTION_DIR)/pyproject.toml
68-
black $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
65+
py_format: ## Run ruff to lint-fix and format the Python codebase
66+
ruff check --fix $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
67+
ruff format $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
6968

7069
.PHONY: py_format_check
7170
py_format_check: ## Check if Python sources are correctly formatted
72-
pycln $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --diff --config $(INGESTION_DIR)/pyproject.toml
73-
isort --check-only $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --settings-file $(INGESTION_DIR)/pyproject.toml
74-
black --check --diff $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
71+
ruff check $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
72+
ruff format --check $(INGESTION_DIR)/ $(ROOT_DIR)/openmetadata-airflow-apis/ --config $(INGESTION_DIR)/pyproject.toml
7573
PYTHONPATH="${PYTHONPATH}:$(INGESTION_DIR)/plugins" pylint --rcfile=$(INGESTION_DIR)/pyproject.toml --fail-under=10 $(PY_SOURCE)/metadata || (echo "PyLint error code $$?"; exit 1)
7674

7775
.PHONY: unit_ingestion

ingestion/examples/airflow/dags/airflow_docker_operator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212
You can run this DAG from the default OM installation
1313
"""
14+
1415
from datetime import datetime
1516

1617
from airflow import models

ingestion/examples/airflow/dags/airflow_lineage_example.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
This is an example to demonstrate on how to configure a Airflow DAG's inlets and outlets.
3030
"""
3131

32-
3332
from datetime import datetime, timedelta
3433

3534
from airflow.decorators import dag, task
@@ -76,9 +75,7 @@ def generate_data():
7675

7776
# Example 2: Using OMEntity objects
7877
@task(
79-
inlets=[
80-
OMEntity(entity=Container, fqn="s3_storage_sample.transactions", key="test")
81-
],
78+
inlets=[OMEntity(entity=Container, fqn="s3_storage_sample.transactions", key="test")],
8279
outlets=[
8380
OMEntity(
8481
entity=Table,

ingestion/examples/airflow/dags/airflow_metadata_extraction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
is to connect to the underlying database, retrieve the information
1616
and push it to OpenMetadata.
1717
"""
18+
1819
from datetime import datetime, timedelta
1920

2021
import yaml

ingestion/examples/airflow/test_dags/airflow_lineage_operator.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
For this DAG to run properly we expected an OpenMetadata
1515
Airflow connection named `openmetadata_conn_id`.
1616
"""
17+
1718
from datetime import datetime
1819
from textwrap import dedent
1920

@@ -152,13 +153,7 @@ def get_airflow_headers():
152153
t1 = BashOperator(
153154
task_id="print_date",
154155
bash_command="date",
155-
outlets=[
156-
{
157-
"tables": [
158-
"test-service-table-lineage.test-db.test-schema.lineage-test-outlet"
159-
]
160-
}
161-
],
156+
outlets=[{"tables": ["test-service-table-lineage.test-db.test-schema.lineage-test-outlet"]}],
162157
)
163158

164159
t2 = BashOperator(
@@ -176,9 +171,7 @@ def get_airflow_headers():
176171
],
177172
)
178173

179-
dag.doc_md = (
180-
__doc__ # providing that you have a docstring at the beginning of the DAG
181-
)
174+
dag.doc_md = __doc__ # providing that you have a docstring at the beginning of the DAG
182175
dag.doc_md = """
183176
This is a documentation placed anywhere
184177
""" # otherwise, type it like this

ingestion/noxfile.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212
Nox sessions for testing and formatting checks.
1313
"""
14+
1415
import os
1516

1617
import nox
@@ -62,9 +63,7 @@ def lint(session):
6263
# Some work is required to import plugins correctly
6364

6465

65-
@nox.session(
66-
name="unit", reuse_venv=True, venv_backend="uv|venv", python=get_python_versions()
67-
)
66+
@nox.session(name="unit", reuse_venv=True, venv_backend="uv|venv", python=get_python_versions())
6867
def unit(session):
6968
session.install(".[all-dev-env, test-unit]")
7069
# TODO: we need to install pip so that spaCy can install its dependencies

0 commit comments

Comments
 (0)