Skip to content

Commit

Permalink
build: add import formatting and sorting (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein authored Jul 29, 2024
1 parent 8c74a63 commit b04a500
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 44 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion examples/connect/dash/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion examples/connect/fastapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion examples/connect/flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions examples/connect/shiny-python/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
3 changes: 1 addition & 2 deletions examples/connect/streamlit/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
1 change: 0 additions & 1 deletion integration/tests/posit/connect/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from packaging import version

from posit import connect

client = connect.Client()
Expand Down
1 change: 0 additions & 1 deletion integration/tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from packaging import version

from posit import connect

from . import CONNECT_VERSION
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/metrics/test_shiny_usage.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/metrics/test_usage.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/metrics/test_visits.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
import responses

from posit.connect import Client

from .api import load_mock # type: ignore
Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest.mock import patch

import pytest

from posit.connect.config import Config, _get_api_key, _get_url


Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_env.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_errors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from posit.connect.errors import ClientError


Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_groups.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest.mock import Mock

import requests

from posit.connect.config import Config
from posit.connect.groups import Group

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_oauth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import responses

from posit.connect import Client


Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_tasks.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion tests/posit/connect/test_urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from posit.connect import urls


Expand Down
3 changes: 1 addition & 2 deletions tests/posit/connect/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b04a500

Please sign in to comment.