Skip to content

Commit 82e91cd

Browse files
committed
feat: Lin with ruff
1 parent cf58ebe commit 82e91cd

File tree

13 files changed

+45
-130
lines changed

13 files changed

+45
-130
lines changed

Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,11 @@ test-python-universal:
317317
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration sdk/python/tests
318318

319319
format-python:
320-
# Sort
321-
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/
322-
323-
# Format
324-
cd ${ROOT_DIR}/sdk/python; python -m black --target-version py38 feast tests
320+
cd ${ROOT_DIR}/sdk/python; python -m ruff check --fix feast/ tests/
325321

326322
lint-python:
327323
cd ${ROOT_DIR}/sdk/python; python -m mypy feast
328-
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/ --check-only
329-
cd ${ROOT_DIR}/sdk/python; python -m flake8 feast/ tests/
330-
cd ${ROOT_DIR}/sdk/python; python -m black --check feast tests
324+
cd ${ROOT_DIR}/sdk/python; python -m ruff check feast/ tests/
331325

332326
# Java
333327

docs/project/development-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ docker build -t docker-whale -f ./sdk/python/feast/infra/feature_servers/multicl
168168
Feast Python SDK / CLI codebase:
169169
- Conforms to [Black code style](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html)
170170
- Has type annotations as enforced by `mypy`
171-
- Has imports sorted by `isort`
172-
- Is lintable by `flake8`
171+
- Has imports sorted by `ruff` (see [isort (I) rules](https://docs.astral.sh/ruff/rules/#isort-i))
172+
- Is lintable by `ruff`
173173

174174
To ensure your Python code conforms to Feast Python code standards:
175175
- Autoformat your code to conform to the code style:

sdk/python/feast/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from importlib.metadata import PackageNotFoundError
33
from importlib.metadata import version as _version
44
except ModuleNotFoundError:
5-
from importlib_metadata import PackageNotFoundError, version as _version # type: ignore
5+
from importlib_metadata import PackageNotFoundError # type: ignore
6+
from importlib_metadata import version as _version
67

78
from feast.infra.offline_stores.bigquery_source import BigQuerySource
89
from feast.infra.offline_stores.contrib.athena_offline_store.athena_source import (

sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_dataflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
import pyarrow as pa
66
import pyarrow.parquet as pq
7+
78
from bytewax.dataflow import Dataflow # type: ignore
89
from bytewax.execution import cluster_main
910
from bytewax.inputs import ManualInputConfig
1011
from bytewax.outputs import ManualOutputConfig
11-
1212
from feast import FeatureStore, FeatureView, RepoConfig
1313
from feast.utils import _convert_arrow_to_proto, _run_pyarrow_field_mapping
1414

sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
from typing import Callable, List, Literal, Sequence, Union
66

77
import yaml
8-
from kubernetes import client
8+
from kubernetes import client, utils
99
from kubernetes import config as k8s_config
10-
from kubernetes import utils
1110
from kubernetes.client.exceptions import ApiException
1211
from kubernetes.utils import FailToCreateError
1312
from pydantic import StrictStr

sdk/python/feast/infra/materialization/contrib/spark/spark_materialization_engine.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Callable, List, Literal, Optional, Sequence, Union, cast
44

55
import dill
6-
import pandas
76
import pandas as pd
87
import pyarrow
98
from tqdm import tqdm

sdk/python/pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.ruff]
2+
exclude = [".git","__pycache__","docs/conf.py","dist","feast/protos","feast/embedded_go/lib","feast/infra/utils/snowflake/snowpark/snowflake_udfs.py"]
3+
4+
[tool.ruff.lint]
5+
select = ["E","F","W","I"]
6+
ignore = ["E203", "E266", "E501", "E721"]
7+
8+
[tool.ruff.lint.isort]
9+
known-first-party = ["feast", "feast", "feast_serving_server", "feast_core_server"]
10+
default-section = "third-party"
11+
12+
[tool.mypy]
13+
files = ["feast","tests"]
14+
ignore_missing_imports = true
15+
exclude = ["feast/embedded_go/lib"]

sdk/python/requirements/py3.10-ci-requirements.txt

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ anyio==4.3.0
1818
# watchfiles
1919
appdirs==1.4.4
2020
# via fissix
21+
appnope==0.1.4
22+
# via ipykernel
2123
argon2-cffi==23.1.0
2224
# via jupyter-server
2325
argon2-cffi-bindings==21.2.0
@@ -57,8 +59,6 @@ beautifulsoup4==4.12.3
5759
# via nbconvert
5860
bidict==0.23.1
5961
# via ibis-framework
60-
black==22.12.0
61-
# via feast (setup.py)
6262
bleach==6.1.0
6363
# via nbconvert
6464
boto3==1.34.65
@@ -105,7 +105,6 @@ charset-normalizer==3.3.2
105105
# snowflake-connector-python
106106
click==8.1.7
107107
# via
108-
# black
109108
# bowler
110109
# dask
111110
# feast (setup.py)
@@ -187,8 +186,6 @@ firebase-admin==5.4.0
187186
# via feast (setup.py)
188187
fissix==21.11.13
189188
# via bowler
190-
flake8==6.0.0
191-
# via feast (setup.py)
192189
fqdn==1.5.1
193190
# via jsonschema
194191
fsspec==2023.12.2
@@ -348,8 +345,6 @@ isodate==0.6.1
348345
# via azure-storage-blob
349346
isoduration==20.11.0
350347
# via jsonschema
351-
isort==5.13.2
352-
# via feast (setup.py)
353348
jedi==0.19.1
354349
# via ipython
355350
jinja2==3.1.3
@@ -441,8 +436,6 @@ matplotlib-inline==0.1.6
441436
# via
442437
# ipykernel
443438
# ipython
444-
mccabe==0.7.0
445-
# via flake8
446439
mdurl==0.1.2
447440
# via markdown-it-py
448441
minio==7.1.0
@@ -476,9 +469,7 @@ mypy==1.9.0
476469
# feast (setup.py)
477470
# sqlalchemy
478471
mypy-extensions==1.0.0
479-
# via
480-
# black
481-
# mypy
472+
# via mypy
482473
mypy-protobuf==3.3.0
483474
# via feast (setup.py)
484475
nbclient==0.10.0
@@ -553,8 +544,6 @@ parsy==2.1
553544
# via ibis-framework
554545
partd==1.4.1
555546
# via dask
556-
pathspec==0.12.1
557-
# via black
558547
pbr==6.0.0
559548
# via mock
560549
pexpect==4.9.0
@@ -563,7 +552,6 @@ pip-tools==7.4.1
563552
# via feast (setup.py)
564553
platformdirs==3.11.0
565554
# via
566-
# black
567555
# jupyter-core
568556
# snowflake-connector-python
569557
# virtualenv
@@ -640,8 +628,6 @@ pyasn1-modules==0.3.0
640628
# via google-auth
641629
pybindgen==0.22.1
642630
# via feast (setup.py)
643-
pycodestyle==2.10.0
644-
# via flake8
645631
pycparser==2.21
646632
# via cffi
647633
pydantic==2.6.4
@@ -651,8 +637,6 @@ pydantic==2.6.4
651637
# great-expectations
652638
pydantic-core==2.16.3
653639
# via pydantic
654-
pyflakes==3.0.1
655-
# via flake8
656640
pygments==2.17.2
657641
# via
658642
# feast (setup.py)
@@ -797,6 +781,8 @@ rsa==4.9
797781
# via google-auth
798782
ruamel-yaml==0.17.17
799783
# via great-expectations
784+
ruff==0.3.4
785+
# via feast (setup.py)
800786
s3transfer==0.10.1
801787
# via boto3
802788
scipy==1.12.0
@@ -874,7 +860,6 @@ toml==0.10.2
874860
# via feast (setup.py)
875861
tomli==2.0.1
876862
# via
877-
# black
878863
# build
879864
# coverage
880865
# jupyterlab

sdk/python/requirements/py3.8-ci-requirements.txt

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ anyio==4.3.0
1818
# watchfiles
1919
appdirs==1.4.4
2020
# via fissix
21+
appnope==0.1.4
22+
# via
23+
# ipykernel
24+
# ipython
2125
argon2-cffi==23.1.0
2226
# via jupyter-server
2327
argon2-cffi-bindings==21.2.0
@@ -41,8 +45,6 @@ attrs==23.2.0
4145
# bowler
4246
# jsonschema
4347
# referencing
44-
avro==1.11.3
45-
# via feast (setup.py)
4648
azure-core==1.30.1
4749
# via
4850
# azure-identity
@@ -63,8 +65,6 @@ backports-zoneinfo==0.2.1
6365
# tzlocal
6466
beautifulsoup4==4.12.3
6567
# via nbconvert
66-
black==22.12.0
67-
# via feast (setup.py)
6868
bleach==6.1.0
6969
# via nbconvert
7070
boto3==1.34.60
@@ -111,7 +111,6 @@ charset-normalizer==3.3.2
111111
# snowflake-connector-python
112112
click==8.1.7
113113
# via
114-
# black
115114
# bowler
116115
# dask
117116
# feast (setup.py)
@@ -192,8 +191,6 @@ firebase-admin==5.4.0
192191
# via feast (setup.py)
193192
fissix==21.11.13
194193
# via bowler
195-
flake8==6.0.0
196-
# via feast (setup.py)
197194
fqdn==1.5.1
198195
# via jsonschema
199196
fsspec==2023.12.2
@@ -365,8 +362,6 @@ isodate==0.6.1
365362
# via azure-storage-blob
366363
isoduration==20.11.0
367364
# via jsonschema
368-
isort==5.13.2
369-
# via feast (setup.py)
370365
jedi==0.19.1
371366
# via ipython
372367
jinja2==3.1.3
@@ -458,8 +453,6 @@ matplotlib-inline==0.1.6
458453
# via
459454
# ipykernel
460455
# ipython
461-
mccabe==0.7.0
462-
# via flake8
463456
mdurl==0.1.2
464457
# via markdown-it-py
465458
minio==7.1.0
@@ -493,9 +486,7 @@ mypy==1.9.0
493486
# feast (setup.py)
494487
# sqlalchemy
495488
mypy-extensions==1.0.0
496-
# via
497-
# black
498-
# mypy
489+
# via mypy
499490
mypy-protobuf==3.3.0
500491
# via feast (setup.py)
501492
nbclient==0.9.1
@@ -553,7 +544,7 @@ packaging==24.0
553544
# pytest
554545
# snowflake-connector-python
555546
# sphinx
556-
pandas==1.5.3 ; python_version < "3.9"
547+
pandas==1.5.3
557548
# via
558549
# altair
559550
# db-dtypes
@@ -570,8 +561,6 @@ parsy==2.1
570561
# via ibis-framework
571562
partd==1.4.1
572563
# via dask
573-
pathspec==0.12.1
574-
# via black
575564
pbr==6.0.0
576565
# via mock
577566
pexpect==4.9.0
@@ -584,7 +573,6 @@ pkgutil-resolve-name==1.3.10
584573
# via jsonschema
585574
platformdirs==3.11.0
586575
# via
587-
# black
588576
# jupyter-core
589577
# snowflake-connector-python
590578
# virtualenv
@@ -602,7 +590,6 @@ prompt-toolkit==3.0.43
602590
# via ipython
603591
proto-plus==1.23.0
604592
# via
605-
# feast (setup.py)
606593
# google-cloud-bigquery
607594
# google-cloud-bigquery-storage
608595
# google-cloud-bigtable
@@ -659,8 +646,6 @@ pyasn1-modules==0.3.0
659646
# via google-auth
660647
pybindgen==0.22.1
661648
# via feast (setup.py)
662-
pycodestyle==2.10.0
663-
# via flake8
664649
pycparser==2.21
665650
# via cffi
666651
pydantic==2.6.4
@@ -670,8 +655,6 @@ pydantic==2.6.4
670655
# great-expectations
671656
pydantic-core==2.16.3
672657
# via pydantic
673-
pyflakes==3.0.1
674-
# via flake8
675658
pygments==2.17.2
676659
# via
677660
# feast (setup.py)
@@ -819,6 +802,8 @@ ruamel-yaml==0.17.17
819802
# via great-expectations
820803
ruamel-yaml-clib==0.2.8
821804
# via ruamel-yaml
805+
ruff==0.3.4
806+
# via feast (setup.py)
822807
s3transfer==0.10.0
823808
# via boto3
824809
scipy==1.10.1
@@ -866,7 +851,9 @@ sphinxcontrib-qthelp==1.0.3
866851
sphinxcontrib-serializinghtml==1.1.5
867852
# via sphinx
868853
sqlalchemy[mypy]==1.4.52
869-
# via feast (setup.py)
854+
# via
855+
# feast (setup.py)
856+
# sqlalchemy
870857
sqlalchemy2-stubs==0.0.2a38
871858
# via sqlalchemy
872859
sqlglot==10.6.4
@@ -893,7 +880,6 @@ toml==0.10.2
893880
# via feast (setup.py)
894881
tomli==2.0.1
895882
# via
896-
# black
897883
# build
898884
# coverage
899885
# jupyterlab
@@ -973,7 +959,6 @@ typing-extensions==4.10.0
973959
# async-lru
974960
# azure-core
975961
# azure-storage-blob
976-
# black
977962
# fastapi
978963
# great-expectations
979964
# ibis-framework

0 commit comments

Comments
 (0)