Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: remove black in favor of ruff for formatting #12378

Merged
merged 24 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
2 changes: 0 additions & 2 deletions metadata-ingestion-modules/airflow-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ task lint(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"find ${venv_name}/lib -path *airflow/_vendor/connexion/spec.py -exec sed -i.bak -e '169,169s/ # type: List\\[str\\]//g' {} \\; && " +
"source ${venv_name}/bin/activate && set -x && " +
"black --check --diff src/ tests/ && " +
"ruff check src/ tests/ && " +
"mypy --show-traceback --show-error-codes src/ tests/"
}
task lintFix(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black src/ tests/ && " +
anshbansal marked this conversation as resolved.
Show resolved Hide resolved
"ruff check --fix src/ tests/"
"mypy src/ tests/ "
}
Expand Down
45 changes: 22 additions & 23 deletions metadata-ingestion-modules/airflow-plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
build-backend = "setuptools.build_meta"
requires = ["setuptools>=54.0.0", "wheel", "pip>=21.0.0"]

[tool.black]
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
^/tmp
'''
include = '\.pyi?$'
[tool.ruff]
line-length = 88
target-version = "py38"
exclude = [
".git",
"venv",
".tox",
"__pycache__",
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.isort]
combine-as-imports = true
Expand All @@ -29,30 +37,21 @@ classes = ["typing"]

[tool.ruff.lint]
select = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw we should be using extend-select everywhere instead of select

https://docs.astral.sh/ruff/settings/#lint_extend-select

"B",
"C90",
"E",
"F",
"I", # For isort
"TID",
"B", # flake8-bugbear
"C90", # mccabe complexity
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"TID", # flake8-tidy-imports
]
ignore = [
# Ignore line length violations (handled by Black)
"E501",
# Ignore whitespace before ':' (matches Black)
"E203",
"E203",
# Allow usages of functools.lru_cache
"B019",
# Allow function call in argument defaults
"B008",
"E501", # Line length violations (handled by formatter)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

]

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
Expand Down
1 change: 0 additions & 1 deletion metadata-ingestion-modules/airflow-plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def get_long_description():
dev_requirements = {
*base_requirements,
*mypy_stubs,
"black==22.12.0",
"coverage>=5.1",
"ruff==0.9.2",
"mypy==1.10.1",
Expand Down
6 changes: 2 additions & 4 deletions metadata-ingestion-modules/dagster-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ task installDev(type: Exec, dependsOn: [install]) {
task lint(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black --check --diff src/ tests/ examples/ && " +
"ruff check src/ tests/ && " +
"ruff check src/ tests/ examples/ && " +
"mypy --show-traceback --show-error-codes src/ tests/ examples/"
}
task lintFix(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-x', '-c',
"source ${venv_name}/bin/activate && " +
"black src/ tests/ examples/ && " +
"ruff check --fix src/ tests/"
"ruff check --fix src/ tests/ examples/ && " +
"mypy src/ tests/ examples/"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
job,
op,
)

from datahub.ingestion.graph.client import DatahubClientConfig, DataHubGraph
from datahub.utilities.urns.dataset_urn import DatasetUrn

from datahub_dagster_plugin.client.dagster_generator import (
DagsterGenerator,
DatasetLineage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
define_asset_job,
multi_asset,
)

from datahub.ingestion.graph.config import DatahubClientConfig
from datahub.utilities.urns.dataset_urn import DatasetUrn

from datahub_dagster_plugin.sensors.datahub_sensors import (
DatahubDagsterSourceConfig,
make_datahub_sensor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dagster import Definitions
from datahub.ingestion.graph.client import DatahubClientConfig

from datahub.ingestion.graph.client import DatahubClientConfig
from datahub_dagster_plugin.sensors.datahub_sensors import (
DatahubDagsterSourceConfig,
make_datahub_sensor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dagster import Definitions, In, Out, PythonObjectDagsterType, job, op

from datahub.ingestion.graph.config import DatahubClientConfig
from datahub.utilities.urns.dataset_urn import DatasetUrn

from datahub_dagster_plugin.sensors.datahub_sensors import (
DatahubDagsterSourceConfig,
make_datahub_sensor,
Expand Down
45 changes: 22 additions & 23 deletions metadata-ingestion-modules/dagster-plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
build-backend = "setuptools.build_meta"
requires = ["setuptools>=54.0.0", "wheel", "pip>=21.0.0"]

[tool.black]
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
^/tmp
'''
include = '\.pyi?$'
[tool.ruff]
line-length = 88
target-version = "py38"
exclude = [
".git",
"venv",
".tox",
"__pycache__",
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.isort]
combine-as-imports = true
Expand All @@ -29,30 +37,21 @@ classes = ["typing"]

[tool.ruff.lint]
select = [
"B",
"C90",
"E",
"F",
"I", # For isort
"TID",
"B", # flake8-bugbear
"C90", # mccabe complexity
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"TID", # flake8-tidy-imports
]
ignore = [
# Ignore line length violations (handled by Black)
"E501",
# Ignore whitespace before ':' (matches Black)
"E203",
"E203",
# Allow usages of functools.lru_cache
"B019",
# Allow function call in argument defaults
"B008",
"E501", # Line length violations (handled by formatter)
]

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
Expand Down
1 change: 0 additions & 1 deletion metadata-ingestion-modules/dagster-plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def get_long_description():
"dagster-aws >= 0.11.0",
"dagster-snowflake >= 0.11.0",
"dagster-snowflake-pandas >= 0.11.0",
"black==22.12.0",
"coverage>=5.1",
"ruff==0.9.2",
"mypy>=1.4.0",
Expand Down
2 changes: 0 additions & 2 deletions metadata-ingestion-modules/gx-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ task installDev(type: Exec, dependsOn: [install]) {
task lint(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black --check --diff src/ tests/ && " +
"ruff check src/ tests/ && " +
"mypy --show-traceback --show-error-codes src/ tests/"
}
task lintFix(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-x', '-c',
"source ${venv_name}/bin/activate && " +
"black src/ tests/ && " +
"ruff check --fix src/ tests/"
"mypy src/ tests/"
}
Expand Down
45 changes: 22 additions & 23 deletions metadata-ingestion-modules/gx-plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
build-backend = "setuptools.build_meta"
requires = ["setuptools>=54.0.0", "wheel", "pip>=21.0.0"]

[tool.black]
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
^/tmp
'''
include = '\.pyi?$'
[tool.ruff]
line-length = 88
target-version = "py38"
exclude = [
".git",
"venv",
".tox",
"__pycache__",
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.isort]
combine-as-imports = true
Expand All @@ -29,30 +37,21 @@ classes = ["typing"]

[tool.ruff.lint]
select = [
"B",
"C90",
"E",
"F",
"I", # For isort
"TID",
"B", # flake8-bugbear
"C90", # mccabe complexity
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"TID", # flake8-tidy-imports
]
ignore = [
# Ignore line length violations (handled by Black)
"E501",
# Ignore whitespace before ':' (matches Black)
"E203",
"E203",
# Allow usages of functools.lru_cache
"B019",
# Allow function call in argument defaults
"B008",
"E501", # Line length violations (handled by formatter)
]

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
Expand Down
1 change: 0 additions & 1 deletion metadata-ingestion-modules/gx-plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def get_long_description():
base_dev_requirements = {
*base_requirements,
*mypy_stubs,
"black==22.12.0",
"coverage>=5.1",
"ruff==0.9.2",
"mypy>=1.4.0",
Expand Down
2 changes: 0 additions & 2 deletions metadata-ingestion-modules/prefect-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ task installDev(type: Exec, dependsOn: [install]) {
task lint(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black --check --diff src/ tests/ && " +
"ruff check src/ tests/ && " +
"mypy --show-traceback --show-error-codes src/ tests/"
}
task lintFix(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-x', '-c',
"source ${venv_name}/bin/activate && " +
"black src/ tests/ && " +
"ruff check --fix src/ tests/"
"mypy src/ tests/ "
}
Expand Down
45 changes: 22 additions & 23 deletions metadata-ingestion-modules/prefect-plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
build-backend = "setuptools.build_meta"
requires = ["setuptools>=54.0.0", "wheel", "pip>=21.0.0"]

[tool.black]
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
^/tmp
'''
include = '\.pyi?$'
[tool.ruff]
line-length = 88
target-version = "py38"
exclude = [
".git",
"venv",
".tox",
"__pycache__",
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.isort]
combine-as-imports = true
Expand All @@ -29,30 +37,21 @@ classes = ["typing"]

[tool.ruff.lint]
select = [
"B",
"C90",
"E",
"F",
"I", # For isort
"TID",
"B", # flake8-bugbear
"C90", # mccabe complexity
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"TID", # flake8-tidy-imports
]
ignore = [
# Ignore line length violations (handled by Black)
"E501",
# Ignore whitespace before ':' (matches Black)
"E203",
"E203",
# Allow usages of functools.lru_cache
"B019",
# Allow function call in argument defaults
"B008",
"E501", # Line length violations (handled by formatter)
]

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
Expand Down
Loading
Loading