Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

remove unused imports #218

Merged
merged 1 commit into from
Oct 28, 2022
Merged

remove unused imports #218

merged 1 commit into from
Oct 28, 2022

Conversation

jameslamb
Copy link
Contributor

@jameslamb jameslamb commented Oct 28, 2022

Contributes to #161.

Changes

Removes unused imports to resolve the following flake8 warnings.

./hamilton/function_modifiers.py:2:1: F401 'collections' imported but unused
./hamilton/function_modifiers.py:14:1: F401 'hamilton.type_utils' imported but unused
./hamilton/node.py:3:1: F401 'typing.Collection' imported but unused
./hamilton/experimental/h_async.py:6:1: F401 'typing.Type' imported but unused
./hamilton/experimental/h_ray.py:2:1: F401 'inspect' imported but unused
./hamilton/data_quality/pandera_validators.py:1:1: F401 'typing.Any' imported but unused
./tests/test_end_to_end.py:1:1: F401 'pandas as pd' imported but unused
./tests/test_graph.py:3:1: F401 'typing' imported but unused
./tests/test_graph.py:10:1: F401 'hamilton.type_utils' imported but unused
./tests/resources/data_quality.py:1:1: F401 'numpy as np' imported but unused
./examples/ray/hello_world/run_rayworkflow.py:1:1: F401 'importlib' imported but unused
./graph_adapter_tests/h_async/test_h_async.py:2:1: F401 'pdb' imported but unused
./graph_adapter_tests/h_async/test_h_async.py:3:1: F401 'typing.Any' imported but unused
./graph_adapter_tests/h_ray/test_h_ray_workflow.py:1:1: F401 'tempfile' imported but unused

Testing

Ran the pre-commit stuff.

pre-commit run --all-files

Ran the the tests in a container using the circleci/python:3.8 image locally.

testing details (click me)
docker run \
   --rm \
    -v $(pwd):/usr/local/src \
    --workdir /usr/local/src \
    --entrypoint="" \
   -it circleci/python:3.8 \
        /bin/bash

And then installed hamilton and ran its tests.

# install dependencies
sudo apt install graphviz
python -m venv venv || virtualenv venv
. venv/bin/activate
python --version
pip --version
pip install -r requirements-test.txt
pip install pandera
pip install -r requirements.txt
pip install "dask[complete]"

# run tests
python -m pytest --cov=hamilton tests/
python -m pytest graph_adapter_tests/h_dask

Notes

In addition to all the other benefits of removing unused code, this specific change (removing unused imports) should slightly speed up the time it takes to import hamilton and to run its tests.

Thanks for your time and consideration.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Python - local testing

  • python 3.6
  • python 3.7

@jameslamb jameslamb mentioned this pull request Oct 28, 2022
@skrawcz skrawcz merged commit 37317b1 into stitchfix:main Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants