From 6175ee2c4cef03988cc3c7f78f99fc1a3431cf94 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Thu, 23 Feb 2023 11:30:14 +0000 Subject: [PATCH 1/6] chore: drop MANIFEST --- MANIFEST.in | 1 - setup.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1aba38f..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE diff --git a/setup.py b/setup.py index b51aa93..4428228 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from setuptools import setup -from setuptools import find_packages +from setuptools import find_packages, setup + extras = {} extras["quality"] = ["black ~= 22.0", "isort >= 5.5.4", "flake8 >= 3.8.3"] @@ -24,6 +24,7 @@ setup( name="peft", version="0.2.0.dev0", description="Parameter-Efficient Fine-Tuning (PEFT)", + license_files=["LICENSE"], long_description=open("README.md", "r", encoding="utf-8").read(), long_description_content_type="text/markdown", keywords="deep learning", From a78f8a0495c5d8e516912ae4be77e3a4af2e4ea8 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Thu, 23 Feb 2023 11:34:18 +0000 Subject: [PATCH 2/6] style: move isort and pytest config to pyproject --- pyproject.toml | 24 ++++++++++++++++++++++++ setup.cfg | 20 -------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b7465bb..1947fa5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,27 @@ [tool.black] line-length = 119 target-version = ['py36'] + +[tool.isort] +line_length = 119 +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +lines_after_imports = 2 +default_section = "FIRSTPARTY" +known_first_party = "pet" +known_third_party = [ + "numpy", + "torch", + "accelerate", + "transformers", +] + +[tool.pytest.ini_options] +doctest_optionflags = [ + "NUMBER", + "NORMALIZE_WHITESPACE", + "ELLIPSIS", +] diff --git a/setup.cfg b/setup.cfg index 6b26312..ab1382c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,23 +1,3 @@ -[isort] -default_section = FIRSTPARTY -ensure_newline_before_comments = True -force_grid_wrap = 0 -include_trailing_comma = True -known_first_party = pet -known_third_party = - numpy - torch - accelerate - transformers - -line_length = 119 -lines_after_imports = 2 -multi_line_output = 3 -use_parentheses = True - [flake8] ignore = E203, E722, E501, E741, W503, W605 max-line-length = 119 - -[tool:pytest] -doctest_optionflags=NUMBER NORMALIZE_WHITESPACE ELLIPSIS \ No newline at end of file From 99901896ccea794fd012b81fbf747c3476d98388 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Mon, 27 Feb 2023 10:50:10 +0000 Subject: [PATCH 3/6] style: switch to ruff --- pyproject.toml | 27 ++++++++++++++++----------- setup.py | 3 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1947fa5..34ea10c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,14 +2,12 @@ line-length = 119 target-version = ['py36'] -[tool.isort] -line_length = 119 -multi_line_output = 3 -include_trailing_comma = true -force_grid_wrap = 0 -use_parentheses = true -ensure_newline_before_comments = true -lines_after_imports = 2 +[tool.ruff] +ignore = ["C901", "E501", "E741", "W605"] +select = ["C", "E", "F", "I", "W"] +line-length = 119 + +[tool.ruff.isort] default_section = "FIRSTPARTY" known_first_party = "pet" known_third_party = [ @@ -18,10 +16,17 @@ known_third_party = [ "accelerate", "transformers", ] +line_length = 119 +lines_after_imports = 2 +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true -[tool.pytest.ini_options] +[tool.pytest] doctest_optionflags = [ - "NUMBER", "NORMALIZE_WHITESPACE", "ELLIPSIS", -] + "NUMBER", +] \ No newline at end of file diff --git a/setup.py b/setup.py index 4428228..6b26477 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,8 @@ from setuptools import find_packages, setup - extras = {} -extras["quality"] = ["black ~= 22.0", "isort >= 5.5.4", "flake8 >= 3.8.3"] +extras["quality"] = ["black ~= 22.0", "ruff>=0.0.241"] extras["docs_specific"] = ["hf-doc-builder"] extras["dev"] = extras["quality"] + extras["docs_specific"] From 47601bab7c4e41899e4ca135e5922c4863182e34 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Tue, 28 Feb 2023 02:58:12 +0530 Subject: [PATCH 4/6] chore: drop `setup.cfg` as we shifted to `ruff` --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ab1382c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = E203, E722, E501, E741, W503, W605 -max-line-length = 119 From 7820a539dd712788efd7ef107338ea3b1279ec7a Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Tue, 28 Feb 2023 16:10:38 +0530 Subject: [PATCH 5/6] fix(pyproject.toml): update `known_first_party` Co-authored-by: Sourab Mangrulkar <13534540+pacman100@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 34ea10c..a135358 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ line-length = 119 [tool.ruff.isort] default_section = "FIRSTPARTY" -known_first_party = "pet" +known_first_party = "peft" known_third_party = [ "numpy", "torch", From 94f00b7d272932ba8f16e6b3ec485eefe900bc70 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Tue, 28 Feb 2023 10:46:07 +0000 Subject: [PATCH 6/6] chore: update Makefile with ruff commands --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8d8148e..ff8ed42 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,12 @@ check_dirs := src tests examples # this target runs checks on all files quality: black --check $(check_dirs) - isort --check-only $(check_dirs) - flake8 $(check_dirs) + ruff $(check_dirs) doc-builder style src tests --max_len 119 --check_only # Format source code automatically and check is there are any problems left that need manual fixing style: black $(check_dirs) - isort $(check_dirs) + ruff $(check_dirs) --fix doc-builder style src tests --max_len 119 \ No newline at end of file