From 9322761efb5473d5b232362269c767a377986136 Mon Sep 17 00:00:00 2001 From: tdstein Date: Thu, 25 Jul 2024 22:24:53 -0400 Subject: [PATCH 1/8] refactor: class facade for urls module --- src/posit/connect/urls.py | 52 +++++++++++---------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/src/posit/connect/urls.py b/src/posit/connect/urls.py index fdf6884a..c6bd71f1 100644 --- a/src/posit/connect/urls.py +++ b/src/posit/connect/urls.py @@ -5,48 +5,24 @@ class Url(str): - """URL representation for Connect. + def __new__(cls, value): + if not isinstance(value, str): + raise ValueError("Value must be a string") + return super(Url, cls).__new__(cls, create(value)) - An opinionated URL representation of a Connect URL. Maintains various - conventions: - - It begins with a scheme. - - It is absolute. - - It contains '__api__'. - - Supports Python builtin __add__ for append. - - Methods - ------- - append(path: str) - Append a path to the URL. - - Examples - -------- - >>> url = Url("http://connect.example.com/") - http://connect.example.com/__api__ - >>> url + "endpoint" - http://connect.example.com/__api__/endpoint - - Append works with string-like objects (e.g., objects that support casting to string) - >>> url = Url("http://connect.example.com/__api__/endpoint") - http://connect.example.com/__api__/endpoint - >>> url + 1 - http://connect.example.com/__api__/endpoint/1 - """ - - def __new__(cls, value: str): - url = _create(value) - return super(Url, cls).__new__(cls, url) + def __init__(self, value): + # Call the parent class's __init__ method + super(Url, self).__init__() def __add__(self, path: str): return self.append(path) def append(self, path: str) -> Url: - return Url(_append(self, path)) + return Url(append(self, path)) -def _create(url: str) -> str: - """Create a URL. +def create(url: str) -> str: + """Create a Url. Asserts that the URL is a proper Posit Connect endpoint. The path '__api__' is appended to the URL if it is missing. @@ -87,12 +63,12 @@ def _create(url: str) -> str: url = url.rstrip("/") if "/__api__" not in url: - url = _append(url, "__api__") + url = append(url, "__api__") return url -def _append(url: str, path) -> str: +def append(url: str, path: str) -> str: """Append a path to a Url. Parameters @@ -109,8 +85,8 @@ def _append(url: str, path) -> str: Examples -------- - >>> url = _create("http://example.com/__api__") - >>> _append(url, "path") + >>> url = urls.create("http://example.com/__api__") + >>> url + "path" http://example.com/__api__/path """ path = str(path).strip("/") From 5fd8e3ed41c26849ead0152d3fe5d8ca81bd6850 Mon Sep 17 00:00:00 2001 From: tdstein Date: Thu, 25 Jul 2024 22:26:01 -0400 Subject: [PATCH 2/8] refactor: mark urls module methods as internal --- src/posit/connect/urls.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/posit/connect/urls.py b/src/posit/connect/urls.py index c6bd71f1..21bcc774 100644 --- a/src/posit/connect/urls.py +++ b/src/posit/connect/urls.py @@ -8,20 +8,19 @@ class Url(str): def __new__(cls, value): if not isinstance(value, str): raise ValueError("Value must be a string") - return super(Url, cls).__new__(cls, create(value)) + return super(Url, cls).__new__(cls, _create(value)) def __init__(self, value): - # Call the parent class's __init__ method super(Url, self).__init__() def __add__(self, path: str): return self.append(path) def append(self, path: str) -> Url: - return Url(append(self, path)) + return Url(_append(self, path)) -def create(url: str) -> str: +def _create(url: str) -> str: """Create a Url. Asserts that the URL is a proper Posit Connect endpoint. The path '__api__' is appended to the URL if it is missing. @@ -63,12 +62,12 @@ def create(url: str) -> str: url = url.rstrip("/") if "/__api__" not in url: - url = append(url, "__api__") + url = _append(url, "__api__") return url -def append(url: str, path: str) -> str: +def _append(url: str, path: str) -> str: """Append a path to a Url. Parameters From cbdc92fc77e1ebf17fd496fcd63d5b36a879f31c Mon Sep 17 00:00:00 2001 From: tdstein Date: Thu, 25 Jul 2024 22:47:43 -0400 Subject: [PATCH 3/8] docs: add docstrings for url class --- src/posit/connect/urls.py | 66 ++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/src/posit/connect/urls.py b/src/posit/connect/urls.py index 21bcc774..eb7dcc3d 100644 --- a/src/posit/connect/urls.py +++ b/src/posit/connect/urls.py @@ -5,9 +5,54 @@ class Url(str): - def __new__(cls, value): - if not isinstance(value, str): - raise ValueError("Value must be a string") + """URL representation for Connect. + + An opinionated URL representation of a Connect URL. Maintains various + conventions: + - It begins with a scheme. + - It is absolute. + - It contains '__api__'. + + Supports Python builtin __add__ for append. + + Methods + ------- + append(path: str) + Append a path to the URL. + + Examples + -------- + >>> url = Url("http://connect.example.com/) + http://connect.example.com/__api__ + >>> url + "endpoint" + http://connect.example.com/__api__/endpoint + + Append works with string-like objects (e.g., objects that support casting to string) + >>> url = Url("http://connect.example.com/__api__/endpoint) + http://connect.example.com/__api__/endpoint + >>> url + 1 + http://connect.example.com/__api__/endpoint/1 + """ + + def __new__(cls, value: str): + """New. + + Parameters + ---------- + value : str + Any URL. + + Returns + ------- + Url + + Raises + ------ + ValueError + `value` is missing a scheme. + ValueError + `value` is missing a network location (i.e., a domain name). + """ return super(Url, cls).__new__(cls, _create(value)) def __init__(self, value): @@ -21,7 +66,7 @@ def append(self, path: str) -> Url: def _create(url: str) -> str: - """Create a Url. + """Create a URL. Asserts that the URL is a proper Posit Connect endpoint. The path '__api__' is appended to the URL if it is missing. @@ -67,7 +112,7 @@ def _create(url: str) -> str: return url -def _append(url: str, path: str) -> str: +def _append(url: str, path) -> str: """Append a path to a Url. Parameters @@ -84,11 +129,16 @@ def _append(url: str, path: str) -> str: Examples -------- - >>> url = urls.create("http://example.com/__api__") - >>> url + "path" + >>> url = _create("http://example.com/__api__") + >>> _append(url, "path") http://example.com/__api__/path """ - path = str(path).strip("/") + path = str(path) + # Removes leading '/' from path to avoid double slashes. + path = path.lstrip("/") + # Removes trailing '/' from path to avoid double slashes. + path = path.rstrip("/") + # See https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit split = urlsplit(url, allow_fragments=False) new_path = posixpath.join(split.path, path) return urlunsplit( From 055ecd715766d7e467e3e96f5fc3cfd4ab40f09a Mon Sep 17 00:00:00 2001 From: tdstein Date: Thu, 25 Jul 2024 22:56:59 -0400 Subject: [PATCH 4/8] refactor: optimizations --- src/posit/connect/urls.py | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/posit/connect/urls.py b/src/posit/connect/urls.py index eb7dcc3d..fdf6884a 100644 --- a/src/posit/connect/urls.py +++ b/src/posit/connect/urls.py @@ -22,41 +22,21 @@ class Url(str): Examples -------- - >>> url = Url("http://connect.example.com/) + >>> url = Url("http://connect.example.com/") http://connect.example.com/__api__ >>> url + "endpoint" http://connect.example.com/__api__/endpoint Append works with string-like objects (e.g., objects that support casting to string) - >>> url = Url("http://connect.example.com/__api__/endpoint) + >>> url = Url("http://connect.example.com/__api__/endpoint") http://connect.example.com/__api__/endpoint >>> url + 1 http://connect.example.com/__api__/endpoint/1 """ def __new__(cls, value: str): - """New. - - Parameters - ---------- - value : str - Any URL. - - Returns - ------- - Url - - Raises - ------ - ValueError - `value` is missing a scheme. - ValueError - `value` is missing a network location (i.e., a domain name). - """ - return super(Url, cls).__new__(cls, _create(value)) - - def __init__(self, value): - super(Url, self).__init__() + url = _create(value) + return super(Url, cls).__new__(cls, url) def __add__(self, path: str): return self.append(path) @@ -133,12 +113,7 @@ def _append(url: str, path) -> str: >>> _append(url, "path") http://example.com/__api__/path """ - path = str(path) - # Removes leading '/' from path to avoid double slashes. - path = path.lstrip("/") - # Removes trailing '/' from path to avoid double slashes. - path = path.rstrip("/") - # See https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit + path = str(path).strip("/") split = urlsplit(url, allow_fragments=False) new_path = posixpath.join(split.path, path) return urlunsplit( From f2c89b5a5626b7eb7a447bef4d6a4619f4e36a9e Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 26 Jul 2024 10:25:56 -0400 Subject: [PATCH 5/8] build: add import formatting with autoflake and isort --- Makefile | 2 ++ requirements-dev.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Makefile b/Makefile index ab23b3db..3269528f 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ fix: fmt: $(PYTHON) -m ruff format . + $(PYTHON) -m autoflake --remove-all-unused-imports --in-place --recursive . + $(PYTHON) -m isort . install: $(PIP) install dist/*.whl diff --git a/requirements-dev.txt b/requirements-dev.txt index 92cc2a3d..7c5680a7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,7 @@ +autoflake build coverage +isort mypy pandas pre-commit From dad1c058f229bc9d7ac2e069192983280ec0ae04 Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 26 Jul 2024 11:46:16 -0400 Subject: [PATCH 6/8] use ruff instead of isort, and combine make fmt and make fix. --- .pre-commit-config.yaml | 4 ---- CONTRIBUTING.md | 2 +- Makefile | 7 ++----- examples/connect/dash/app.py | 1 - examples/connect/fastapi/app.py | 1 - examples/connect/flask/app.py | 1 - examples/connect/shiny-python/app.py | 3 +-- examples/connect/streamlit/app.py | 3 +-- integration/tests/posit/connect/__init__.py | 1 - integration/tests/posit/connect/test_content.py | 1 - tests/posit/connect/metrics/test_shiny_usage.py | 3 +-- tests/posit/connect/metrics/test_usage.py | 3 +-- tests/posit/connect/metrics/test_visits.py | 3 +-- tests/posit/connect/test_bundles.py | 3 +-- tests/posit/connect/test_client.py | 1 - tests/posit/connect/test_config.py | 1 - tests/posit/connect/test_content.py | 3 +-- tests/posit/connect/test_env.py | 3 +-- tests/posit/connect/test_errors.py | 1 - tests/posit/connect/test_groups.py | 1 - tests/posit/connect/test_hooks.py | 3 +-- tests/posit/connect/test_oauth.py | 1 - tests/posit/connect/test_permissions.py | 3 +-- tests/posit/connect/test_tasks.py | 3 +-- tests/posit/connect/test_urls.py | 1 - tests/posit/connect/test_users.py | 3 +-- 26 files changed, 15 insertions(+), 45 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37a13007..142941f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,10 +7,6 @@ repos: name: format entry: bash -c "make fmt" language: system - - id: fix - name: fix - entry: bash -c "make fix" - language: system - id: lint name: lint entry: bash -c "make lint" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12a68b11..1a71d3cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ Before contributing to the `posit-sdk`, ensure that the following prerequisites 1. Create a new branch for your feature or bug fix. 1. Run `make` to run the default development workflow. 1. Make your changes and test them thoroughly using `make test` -1. Run `make fmt`, `make lint`, and `make fix` to verify adherence to the project style guide. +1. Run `make fmt` and `make lint` to verify adherence to the project style guide. 1. Commit your changes and push them to your forked repository. 1. Submit a pull request to the main repository. diff --git a/Makefile b/Makefile index 3269528f..e70d1c90 100644 --- a/Makefile +++ b/Makefile @@ -38,13 +38,10 @@ dev: docs: $(MAKE) -C ./docs -fix: - $(PYTHON) -m ruff check --fix - fmt: - $(PYTHON) -m ruff format . $(PYTHON) -m autoflake --remove-all-unused-imports --in-place --recursive . - $(PYTHON) -m isort . + $(PYTHON) -m ruff check --select I --fix + $(PYTHON) -m ruff format . install: $(PIP) install dist/*.whl diff --git a/examples/connect/dash/app.py b/examples/connect/dash/app.py index e84d15b1..a1bf7893 100644 --- a/examples/connect/dash/app.py +++ b/examples/connect/dash/app.py @@ -8,7 +8,6 @@ from databricks import sql from databricks.sdk.core import ApiClient, Config from databricks.sdk.service.iam import CurrentUserAPI - from posit.connect.external.databricks import viewer_credentials_provider DATABRICKS_HOST = os.getenv("DATABRICKS_HOST") diff --git a/examples/connect/fastapi/app.py b/examples/connect/fastapi/app.py index 25a8fb38..8be3ece2 100644 --- a/examples/connect/fastapi/app.py +++ b/examples/connect/fastapi/app.py @@ -6,7 +6,6 @@ from databricks import sql from fastapi import FastAPI, Header from fastapi.responses import JSONResponse - from posit.connect.external.databricks import viewer_credentials_provider DATABRICKS_HOST = os.getenv("DATABRICKS_HOST") diff --git a/examples/connect/flask/app.py b/examples/connect/flask/app.py index 9239d02c..d95fa19f 100644 --- a/examples/connect/flask/app.py +++ b/examples/connect/flask/app.py @@ -4,7 +4,6 @@ from databricks import sql from flask import Flask, request - from posit.connect.external.databricks import viewer_credentials_provider DATABRICKS_HOST = os.getenv("DATABRICKS_HOST") diff --git a/examples/connect/shiny-python/app.py b/examples/connect/shiny-python/app.py index e1d6292e..4a1cb695 100644 --- a/examples/connect/shiny-python/app.py +++ b/examples/connect/shiny-python/app.py @@ -6,9 +6,8 @@ from databricks import sql from databricks.sdk.core import ApiClient, Config from databricks.sdk.service.iam import CurrentUserAPI -from shiny import App, Inputs, Outputs, Session, render, ui - from posit.connect.external.databricks import viewer_credentials_provider +from shiny import App, Inputs, Outputs, Session, render, ui DATABRICKS_HOST = os.getenv("DATABRICKS_HOST") DATABRICKS_HOST_URL = f"https://{DATABRICKS_HOST}" diff --git a/examples/connect/streamlit/app.py b/examples/connect/streamlit/app.py index a7081d06..ffc084c4 100644 --- a/examples/connect/streamlit/app.py +++ b/examples/connect/streamlit/app.py @@ -7,9 +7,8 @@ from databricks import sql from databricks.sdk.core import ApiClient, Config from databricks.sdk.service.iam import CurrentUserAPI -from streamlit.web.server.websocket_headers import _get_websocket_headers - from posit.connect.external.databricks import viewer_credentials_provider +from streamlit.web.server.websocket_headers import _get_websocket_headers DATABRICKS_HOST = os.getenv("DATABRICKS_HOST") DATABRICKS_HOST_URL = f"https://{DATABRICKS_HOST}" diff --git a/integration/tests/posit/connect/__init__.py b/integration/tests/posit/connect/__init__.py index 7d8dd0b3..53b720f2 100644 --- a/integration/tests/posit/connect/__init__.py +++ b/integration/tests/posit/connect/__init__.py @@ -1,5 +1,4 @@ from packaging import version - from posit import connect client = connect.Client() diff --git a/integration/tests/posit/connect/test_content.py b/integration/tests/posit/connect/test_content.py index 0e520c1d..575e5d00 100644 --- a/integration/tests/posit/connect/test_content.py +++ b/integration/tests/posit/connect/test_content.py @@ -2,7 +2,6 @@ import pytest from packaging import version - from posit import connect from . import CONNECT_VERSION diff --git a/tests/posit/connect/metrics/test_shiny_usage.py b/tests/posit/connect/metrics/test_shiny_usage.py index 037bed08..7d832acd 100644 --- a/tests/posit/connect/metrics/test_shiny_usage.py +++ b/tests/posit/connect/metrics/test_shiny_usage.py @@ -1,9 +1,8 @@ import requests import responses -from responses import matchers - from posit.connect import config from posit.connect.metrics import shiny_usage +from responses import matchers from ..api import load_mock # type: ignore diff --git a/tests/posit/connect/metrics/test_usage.py b/tests/posit/connect/metrics/test_usage.py index 003762cc..ff557b29 100644 --- a/tests/posit/connect/metrics/test_usage.py +++ b/tests/posit/connect/metrics/test_usage.py @@ -1,9 +1,8 @@ import pytest import responses -from responses import matchers - from posit import connect from posit.connect.metrics import shiny_usage, usage, visits +from responses import matchers from ..api import load_mock # type: ignore diff --git a/tests/posit/connect/metrics/test_visits.py b/tests/posit/connect/metrics/test_visits.py index a5737497..2a1e7132 100644 --- a/tests/posit/connect/metrics/test_visits.py +++ b/tests/posit/connect/metrics/test_visits.py @@ -1,9 +1,8 @@ import requests import responses -from responses import matchers - from posit.connect import config from posit.connect.metrics import visits +from responses import matchers from ..api import load_mock # type: ignore diff --git a/tests/posit/connect/test_bundles.py b/tests/posit/connect/test_bundles.py index 959cfcb5..4ba544fb 100644 --- a/tests/posit/connect/test_bundles.py +++ b/tests/posit/connect/test_bundles.py @@ -4,11 +4,10 @@ import pytest import requests import responses -from responses import matchers - from posit.connect import Client from posit.connect.bundles import Bundle from posit.connect.config import Config +from responses import matchers from .api import get_path, load_mock # type: ignore diff --git a/tests/posit/connect/test_client.py b/tests/posit/connect/test_client.py index 0709f965..e873ce8e 100644 --- a/tests/posit/connect/test_client.py +++ b/tests/posit/connect/test_client.py @@ -2,7 +2,6 @@ import pytest import responses - from posit.connect import Client from .api import load_mock # type: ignore diff --git a/tests/posit/connect/test_config.py b/tests/posit/connect/test_config.py index 3f1dacf4..a8f24195 100644 --- a/tests/posit/connect/test_config.py +++ b/tests/posit/connect/test_config.py @@ -1,7 +1,6 @@ from unittest.mock import patch import pytest - from posit.connect.config import Config, _get_api_key, _get_url diff --git a/tests/posit/connect/test_content.py b/tests/posit/connect/test_content.py index 208f9d5d..60ac4222 100644 --- a/tests/posit/connect/test_content.py +++ b/tests/posit/connect/test_content.py @@ -1,12 +1,11 @@ import pytest import requests import responses -from responses import matchers - from posit.connect.client import Client from posit.connect.config import Config from posit.connect.content import ContentItem, ContentItemOwner from posit.connect.permissions import Permissions +from responses import matchers from .api import load_mock # type: ignore diff --git a/tests/posit/connect/test_env.py b/tests/posit/connect/test_env.py index df0b20a7..afd0367c 100644 --- a/tests/posit/connect/test_env.py +++ b/tests/posit/connect/test_env.py @@ -1,8 +1,7 @@ import pytest import responses -from responses import matchers - from posit.connect import Client +from responses import matchers from .api import load_mock # type: ignore diff --git a/tests/posit/connect/test_errors.py b/tests/posit/connect/test_errors.py index 429e4dd9..9443f035 100644 --- a/tests/posit/connect/test_errors.py +++ b/tests/posit/connect/test_errors.py @@ -1,5 +1,4 @@ import pytest - from posit.connect.errors import ClientError diff --git a/tests/posit/connect/test_groups.py b/tests/posit/connect/test_groups.py index 067a5037..0c6d4751 100644 --- a/tests/posit/connect/test_groups.py +++ b/tests/posit/connect/test_groups.py @@ -1,7 +1,6 @@ from unittest.mock import Mock import requests - from posit.connect.config import Config from posit.connect.groups import Group diff --git a/tests/posit/connect/test_hooks.py b/tests/posit/connect/test_hooks.py index 6945bc7a..a3c32176 100644 --- a/tests/posit/connect/test_hooks.py +++ b/tests/posit/connect/test_hooks.py @@ -3,11 +3,10 @@ import pytest import responses -from requests import HTTPError, Response - from posit.connect import Client from posit.connect.errors import ClientError from posit.connect.hooks import handle_errors +from requests import HTTPError, Response def test_success(): diff --git a/tests/posit/connect/test_oauth.py b/tests/posit/connect/test_oauth.py index 28f77b58..f4b6a4e8 100644 --- a/tests/posit/connect/test_oauth.py +++ b/tests/posit/connect/test_oauth.py @@ -1,5 +1,4 @@ import responses - from posit.connect import Client diff --git a/tests/posit/connect/test_permissions.py b/tests/posit/connect/test_permissions.py index d158dab8..346501af 100644 --- a/tests/posit/connect/test_permissions.py +++ b/tests/posit/connect/test_permissions.py @@ -3,10 +3,9 @@ import requests import responses -from responses import matchers - from posit.connect.config import Config from posit.connect.permissions import Permission, Permissions +from responses import matchers from .api import load_mock # type: ignore diff --git a/tests/posit/connect/test_tasks.py b/tests/posit/connect/test_tasks.py index 48b81fa7..4b8162df 100644 --- a/tests/posit/connect/test_tasks.py +++ b/tests/posit/connect/test_tasks.py @@ -1,8 +1,7 @@ import responses -from responses import matchers - from posit import connect from posit.connect import tasks +from responses import matchers from .api import load_mock # type: ignore diff --git a/tests/posit/connect/test_urls.py b/tests/posit/connect/test_urls.py index 0ce45775..0877dcb1 100644 --- a/tests/posit/connect/test_urls.py +++ b/tests/posit/connect/test_urls.py @@ -1,5 +1,4 @@ import pytest - from posit.connect import urls diff --git a/tests/posit/connect/test_users.py b/tests/posit/connect/test_users.py index ae8a586c..14f97c3c 100644 --- a/tests/posit/connect/test_users.py +++ b/tests/posit/connect/test_users.py @@ -3,10 +3,9 @@ import pytest import requests import responses -from responses import matchers - from posit.connect.client import Client from posit.connect.users import User +from responses import matchers from .api import load_mock # type: ignore From 2b7c7615acadab96aaebb35d517d2c38731ae094 Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 26 Jul 2024 11:48:34 -0400 Subject: [PATCH 7/8] move ruff rule selection to pyproject.toml --- Makefile | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e70d1c90..44528e01 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ docs: fmt: $(PYTHON) -m autoflake --remove-all-unused-imports --in-place --recursive . - $(PYTHON) -m ruff check --select I --fix + $(PYTHON) -m ruff check --fix $(PYTHON) -m ruff format . install: diff --git a/pyproject.toml b/pyproject.toml index 427ab6d5..58860fa0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ docstring-code-format = true docstring-code-line-length = "dynamic" [tool.ruff.lint] -select = ["D"] +select = ["D", "I"] ignore = [ # NumPy style docstring convention with noted exceptions. # https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings From 5acdd24d1c459c99b9b76b18607c662f22a4066c Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 26 Jul 2024 11:52:13 -0400 Subject: [PATCH 8/8] replace autoflake8 with ruff rule F401 --- Makefile | 1 - pyproject.toml | 2 +- requirements-dev.txt | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 44528e01..3191f435 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,6 @@ docs: $(MAKE) -C ./docs fmt: - $(PYTHON) -m autoflake --remove-all-unused-imports --in-place --recursive . $(PYTHON) -m ruff check --fix $(PYTHON) -m ruff format . diff --git a/pyproject.toml b/pyproject.toml index 58860fa0..a2989b6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ docstring-code-format = true docstring-code-line-length = "dynamic" [tool.ruff.lint] -select = ["D", "I"] +select = ["D", "F401", "I"] ignore = [ # NumPy style docstring convention with noted exceptions. # https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings diff --git a/requirements-dev.txt b/requirements-dev.txt index 7c5680a7..92cc2a3d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,5 @@ -autoflake build coverage -isort mypy pandas pre-commit