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

Updates pre-commit hooks #568

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

repos:
- repo: https://github.com/ambv/black
rev: 22.3.0
rev: 23.11.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
Expand All @@ -21,12 +21,12 @@ repos:
# valid python file
- id: check-ast
# isort python package import sorting
- repo: https://github.com/pre-commit/mirrors-isort
rev: 'v5.10.1'
- repo: https://github.com/pycqa/isort
rev: '5.12.0'
hooks:
- id: isort
args: ["--profile", "black", --line-length=100]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from tqdm import tqdm
import litellm


from hamilton.function_modifiers import config


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from tenacity import retry, stop_after_attempt, wait_random_exponential
from tqdm import tqdm


from hamilton.function_modifiers import config


Expand Down
18 changes: 13 additions & 5 deletions contrib/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
max-line-length = 100
exclude = build/,.git/,venv/
ignore =
E203, # whitespace before ':' \
E402, # module level import not at top of file \
E501, # line too long \
W503, # line break before binary operator \
W605 # invalid escape sequence
# whitespace before ':'
E203,
# module level import not at top of file
E402,
# line too long
E501,
# line break before binary operator
W503,
# invalid escape sequence
W605

[isort]
known_first_party=hamilton
1 change: 0 additions & 1 deletion examples/data_quality/pandera/run_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from hamilton.plugins import h_ray

if __name__ == "__main__":

logging.basicConfig(stream=sys.stdout)
logger = logging.getLogger(__name__)
# Setup a local cluster.
Expand Down
1 change: 0 additions & 1 deletion examples/data_quality/simple/run_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from hamilton.plugins import h_ray

if __name__ == "__main__":

logging.basicConfig(stream=sys.stdout)
logger = logging.getLogger(__name__)
# Setup a local cluster.
Expand Down
1 change: 0 additions & 1 deletion examples/decoupling_io/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

@dataclasses.dataclass
class SklearnPlotSaver(DataSaver):

path: Union[str, PathLike]
# kwargs
dpi: float = 200
Expand Down
1 change: 0 additions & 1 deletion examples/model_examples/time-series/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def reduce_mem_usage(df: pd.DataFrame, name: str, verbose=True):
for col in df.columns:
col_type = df[col].dtypes
if col_type in numerics:

c_min = df[col].min()
c_max = df[col].max()
if str(col_type)[:3] == "int":
Expand Down
2 changes: 1 addition & 1 deletion hamilton/experimental/h_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def new_fn(fn=callabl, **fn_kwargs):
task_dict = {key: process_value(value) for key, value in fn_kwargs.items()}
fn_kwargs = await await_dict_of_tasks(task_dict)
if inspect.iscoroutinefunction(fn):
return await (fn(**fn_kwargs))
return await fn(**fn_kwargs)
return fn(**fn_kwargs)

coroutine = new_fn(**kwargs)
Expand Down
1 change: 0 additions & 1 deletion hamilton/plugins/sklearn_plot_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

@dataclasses.dataclass
class SklearnPlotSaver(DataSaver):

path: Union[str, PathLike]
# kwargs
dpi: float = 200
Expand Down
2 changes: 1 addition & 1 deletion plugin_tests/h_ray/test_h_ray_workflow.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pandas as pd
import pytest
import ray
from plugin_tests.h_ray.resources import example_module, smoke_screen_module
from ray import workflow

from hamilton import base, driver
from hamilton.plugins import h_ray
from plugin_tests.h_ray.resources import example_module, smoke_screen_module


@pytest.fixture(scope="module")
Expand Down
15 changes: 10 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
max-line-length = 100
exclude = build/,.git/,venv/
ignore =
E203, # whitespace before ':' \
E402, # module level import not at top of file \
E501, # line too long \
W503, # line break before binary operator \
W605 # invalid escape sequence
# whitespace before ':'
E203,
# module level import not at top of file
E402,
# line too long
E501,
# line break before binary operator
W503,
# invalid escape sequence
W605
16 changes: 8 additions & 8 deletions tests/execution/test_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

import numpy as np
import pytest
from tests.resources.dynamic_parallelism import (
inputs_in_collect,
no_parallel,
parallel_collect_multiple_arguments,
parallel_complex,
parallel_delayed,
parallel_linear_basic,
)

import hamilton.ad_hoc_utils
from hamilton import base, driver
Expand All @@ -21,14 +29,6 @@
TaskImplementation,
)
from hamilton.htypes import Collect, Parallelizable
from tests.resources.dynamic_parallelism import (
inputs_in_collect,
no_parallel,
parallel_collect_multiple_arguments,
parallel_complex,
parallel_delayed,
parallel_linear_basic,
)

ADAPTER = base.DefaultAdapter()

Expand Down
3 changes: 2 additions & 1 deletion tests/execution/test_node_grouping.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from tests.resources.dynamic_parallelism import no_parallel, parallel_complex, parallel_linear_basic

from hamilton import ad_hoc_utils, base, graph, node
from hamilton.execution import grouping
from hamilton.execution.grouping import (
Expand All @@ -9,7 +11,6 @@
)
from hamilton.graph import FunctionGraph
from hamilton.node import NodeType
from tests.resources.dynamic_parallelism import no_parallel, parallel_complex, parallel_linear_basic


def test_group_individually():
Expand Down
2 changes: 1 addition & 1 deletion tests/function_modifiers/test_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import pandas as pd
import pytest
import tests.resources.pipe

import hamilton.function_modifiers
import tests.resources.pipe
from hamilton import base, driver, function_modifiers, models, node
from hamilton.function_modifiers import does
from hamilton.function_modifiers.dependencies import source, value
Expand Down
2 changes: 1 addition & 1 deletion tests/function_modifiers/test_recursive.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Tuple

import pytest

import tests.resources.reuse_subdag

from hamilton import ad_hoc_utils, graph
from hamilton.function_modifiers import (
InvalidDecoratorException,
Expand Down
10 changes: 5 additions & 5 deletions tests/function_modifiers/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import numpy as np
import pandas as pd
import pytest
from tests.resources.dq_dummy_examples import (
DUMMY_VALIDATORS_FOR_TESTING,
SampleDataValidator2,
SampleDataValidator3,
)

from hamilton import node
from hamilton.data_quality.base import DataValidationError, ValidationResult
Expand All @@ -11,11 +16,6 @@
check_output_custom,
)
from hamilton.node import DependencyType
from tests.resources.dq_dummy_examples import (
DUMMY_VALIDATORS_FOR_TESTING,
SampleDataValidator2,
SampleDataValidator3,
)


def test_check_output_node_transform():
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_materialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from typing import Any, Collection, Dict, List, Optional, Tuple, Type

import pytest

import tests.resources.cyclic_functions
import tests.resources.test_default_args

from hamilton import base, graph, node, registry
from hamilton.function_modifiers import load_from, save_to, value
from hamilton.io import materialization
Expand Down
2 changes: 1 addition & 1 deletion tests/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import pandas as pd
import pytest
from tests import nodes

from hamilton import base
from hamilton.driver import Driver
from hamilton.experimental import h_cache
from tests import nodes


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import tests.resources.cyclic_functions
import tests.resources.test_default_args

from hamilton import common, driver


Expand Down
12 changes: 6 additions & 6 deletions tests/test_default_data_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import numpy as np
import pandas as pd
import pytest
from tests.resources.dq_dummy_examples import (
DUMMY_VALIDATORS_FOR_TESTING,
SampleDataValidator1,
SampleDataValidator2,
SampleDataValidator3,
)

import hamilton.data_quality.base
from hamilton.data_quality import default_validators
Expand All @@ -14,12 +20,6 @@
AVAILABLE_DEFAULT_VALIDATORS,
resolve_default_validators,
)
from tests.resources.dq_dummy_examples import (
DUMMY_VALIDATORS_FOR_TESTING,
SampleDataValidator1,
SampleDataValidator2,
SampleDataValidator3,
)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from typing import Any, Callable, Dict, List, Type

import pytest

import tests.resources.data_quality
import tests.resources.dynamic_config
import tests.resources.overrides

from hamilton import ad_hoc_utils, base, driver, settings
from hamilton.base import DefaultAdapter
from hamilton.data_quality.base import DataValidationError, ValidationResult
Expand Down
6 changes: 3 additions & 3 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

import pandas as pd
import pytest

import hamilton.graph_utils
import hamilton.htypes
import tests.resources.bad_functions
import tests.resources.config_modifier
import tests.resources.cyclic_functions
Expand All @@ -22,6 +19,9 @@
import tests.resources.parametrized_nodes
import tests.resources.test_default_args
import tests.resources.typing_vs_not_typing

import hamilton.graph_utils
import hamilton.htypes
from hamilton import ad_hoc_utils, base, graph, node
from hamilton.execution import graph_functions
from hamilton.node import NodeType
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hamilton_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import pandas as pd
import pytest

import tests.resources.cyclic_functions
import tests.resources.dummy_functions
import tests.resources.dynamic_parallelism.parallel_linear_basic
import tests.resources.tagging
import tests.resources.test_default_args
import tests.resources.very_simple_dag

from hamilton import base, node
from hamilton.driver import (
Builder,
Expand Down
1 change: 0 additions & 1 deletion writeups/garbage_collection/memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def foo_i(foo_i_minus_one: pd.DataFrame) -> pd.DataFrame:


if __name__ == "__main__":

import os

import psutil
Expand Down
Loading