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 ab23b3db..3191f435 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,8 @@ dev: docs: $(MAKE) -C ./docs -fix: - $(PYTHON) -m ruff check --fix - fmt: + $(PYTHON) -m ruff check --fix $(PYTHON) -m ruff format . install: 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/pyproject.toml b/pyproject.toml index 427ab6d5..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"] +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/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