Skip to content

Commit d35b378

Browse files
committed
chore: replace black with ruff, slim down pyproject.toml, remove editorconfig
1 parent 0e0f255 commit d35b378

23 files changed

+128
-85
lines changed

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[run]
2+
source = kb_cloud_client
3+
omit =
4+
*/kbcloud/api/*
5+
*/kbcloud/model/*
6+
*/kbcloud/admin/*
7+
8+
[report]
9+
show_missing = true
10+
skip_covered = false

.editorconfig

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@ on:
88

99
jobs:
1010
test:
11-
name: Test (Python ${{ matrix.python-version }})
11+
name: Test
1212
runs-on: ubuntu-latest
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
python-version: ["3.10", "3.11", "3.12"]
17-
1813
steps:
1914
- uses: actions/checkout@v4
2015

21-
- name: Set up Python ${{ matrix.python-version }}
16+
- name: Set up Python
2217
uses: actions/setup-python@v5
2318
with:
24-
python-version: ${{ matrix.python-version }}
19+
python-version: "3.12"
2520

2621
- name: Install dependencies
2722
run: |
@@ -49,10 +44,13 @@ jobs:
4944
- name: Install dev dependencies
5045
run: |
5146
python -m pip install --upgrade pip
52-
pip install black
47+
pip install ruff
5348
5449
- name: Check formatting
55-
run: black --check src/kb_cloud_client/*.py tests/ examples/
50+
run: ruff format --check src/kb_cloud_client/*.py tests/ examples/
51+
52+
- name: Lint
53+
run: ruff check src/kb_cloud_client/*.py tests/ examples/
5654

5755
build:
5856
name: Build package

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ install: ## Install the package in editable mode with dev extras
1515
test: ## Run tests
1616
pytest tests/ -v --tb=short
1717

18-
lint: ## Check code formatting (black --check)
19-
black --check src/kb_cloud_client/*.py tests/ examples/
18+
lint: ## Lint and check formatting (ruff)
19+
ruff check src/kb_cloud_client/*.py tests/ examples/
20+
ruff format --check src/kb_cloud_client/*.py tests/ examples/
2021

21-
fmt: ## Auto-format code with black
22-
black src/kb_cloud_client/*.py tests/ examples/
22+
fmt: ## Auto-format and fix code with ruff
23+
ruff format src/kb_cloud_client/*.py tests/ examples/
24+
ruff check --fix src/kb_cloud_client/*.py tests/ examples/
2325

2426
typecheck: ## Run mypy type checks
2527
mypy src/kb_cloud_client/ --ignore-missing-imports

examples/admin/get_current_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example: Get the currently authenticated user's information (admin portal)."""
2+
23
import os
34

45
from kb_cloud_client import ApiClient, Configuration

examples/admin/list_clusters.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example: List all clusters in an org with optional filters (admin portal)."""
2+
23
import os
34

45
from kb_cloud_client import ApiClient, Configuration
@@ -13,14 +14,17 @@ def main():
1314
)
1415

1516
org_name = os.environ.get("KB_CLOUD_ORG", "my-org")
16-
engine_filter = os.environ.get("KB_CLOUD_ENGINE") # e.g. "postgresql"
17-
environment_name = os.environ.get("KB_CLOUD_ENV_NAME") # e.g. "production"
17+
engine_filter = os.environ.get("KB_CLOUD_ENGINE") # e.g. "postgresql"
18+
environment_name = os.environ.get("KB_CLOUD_ENV_NAME") # e.g. "production"
1819

1920
with ApiClient(configuration) as api_client:
2021
cluster_api = ClusterApi(api_client)
2122

22-
print(f"Listing clusters in org '{org_name}' (admin view)" +
23-
(f", engine={engine_filter}" if engine_filter else "") + "...")
23+
print(
24+
f"Listing clusters in org '{org_name}' (admin view)"
25+
+ (f", engine={engine_filter}" if engine_filter else "")
26+
+ "..."
27+
)
2428

2529
result = cluster_api.list_cluster(
2630
org_name=org_name,

examples/admin/list_engines.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example: List all available database engines and their versions (admin portal)."""
2+
23
import os
34

45
from kb_cloud_client import ApiClient, Configuration
@@ -17,8 +18,11 @@ def main():
1718
with ApiClient(configuration) as api_client:
1819
engine_api = EngineApi(api_client)
1920

20-
print("Fetching all engines (admin view)" +
21-
(f" (filter: name={engine_name})" if engine_name else "") + "...")
21+
print(
22+
"Fetching all engines (admin view)"
23+
+ (f" (filter: name={engine_name})" if engine_name else "")
24+
+ "..."
25+
)
2226

2327
result = engine_api.list_all_engines(name=engine_name)
2428

@@ -35,8 +39,9 @@ def main():
3539
ver_str = ", ".join(str(getattr(v, "version", v)) for v in versions[:5])
3640
if len(versions) > 5:
3741
ver_str += f" ... (+{len(versions) - 5} more)"
38-
print(f" - {name} type={engine_type}" +
39-
(f" versions=[{ver_str}]" if ver_str else ""))
42+
print(
43+
f" - {name} type={engine_type}" + (f" versions=[{ver_str}]" if ver_str else "")
44+
)
4045

4146

4247
if __name__ == "__main__":

examples/admin/list_environments.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example: List all environments, optionally filtered by org or cloud provider (admin portal)."""
2+
23
import os
34

45
from kb_cloud_client import ApiClient, Configuration
@@ -18,9 +19,12 @@ def main():
1819
with ApiClient(configuration) as api_client:
1920
env_api = EnvironmentApi(api_client)
2021

21-
print("Fetching environments" +
22-
(f" for org '{org_name}'" if org_name else "") +
23-
(f" on provider '{cloud_provider}'" if cloud_provider else "") + "...")
22+
print(
23+
"Fetching environments"
24+
+ (f" for org '{org_name}'" if org_name else "")
25+
+ (f" on provider '{cloud_provider}'" if cloud_provider else "")
26+
+ "..."
27+
)
2428

2529
result = env_api.list_environment(
2630
org_name=org_name,

examples/admin/list_organizations.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example: List all organizations on the platform (admin portal)."""
2+
23
import os
34

45
from kb_cloud_client import ApiClient, Configuration
@@ -28,8 +29,11 @@ def main():
2829
name = getattr(org, "name", "?")
2930
display_name = getattr(org, "display_name", "")
3031
status = getattr(org, "status", "")
31-
print(f" - {name}" + (f" ({display_name})" if display_name else "") +
32-
(f" [{status}]" if status else ""))
32+
print(
33+
f" - {name}"
34+
+ (f" ({display_name})" if display_name else "")
35+
+ (f" [{status}]" if status else "")
36+
)
3337

3438

3539
if __name__ == "__main__":

examples/admin/manage_organization.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Example: Create, read, and delete an organization (admin portal)."""
2+
23
import os
34
import sys
45

5-
from kb_cloud_client import ApiClient, Configuration, ApiException
6+
from kb_cloud_client import ApiClient, ApiException, Configuration
67
from kb_cloud_client.kbcloud.admin import OrganizationApi
78
from kb_cloud_client.kbcloud.admin.model.org_create import OrgCreate
89

0 commit comments

Comments
 (0)