Skip to content

Commit

Permalink
Python: update deps and switch to ruff. (#1332)
Browse files Browse the repository at this point in the history
Ruff is better, and we already use it everywhere.

Updating the deps to more recent ones that fix a few bugs.
  • Loading branch information
tasn authored Jun 10, 2024
1 parent ef04e51 commit 7fb1958
Show file tree
Hide file tree
Showing 9 changed files with 443 additions and 202 deletions.
18 changes: 7 additions & 11 deletions python/example.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import time
import whsaas.openapi_client
from pprint import pprint
from whsaas.openapi_client.api import application_api
from whsaas.openapi_client.model.application_in import ApplicationIn
from whsaas.openapi_client.model.application_out import ApplicationOut
from whsaas.openapi_client.model.http_validation_error import HTTPValidationError
from whsaas.openapi_client.model.http_error_out import HttpErrorOut
from whsaas.openapi_client.model.list_response_application_out import ListResponseApplicationOut

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = whsaas.openapi_client.Configuration(
host = "http://localhost:8040"
)
configuration = whsaas.openapi_client.Configuration(host="http://localhost:8040")

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = 'qqqqqqqq'
configuration.api_key["APIKeyHeader"] = "qqqqqqqq"

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyHeader'] = 'Bearer'
Expand All @@ -35,4 +28,7 @@
api_response = api_instance.list_applications_api_v1_app_get()
pprint(api_response)
except whsaas.openapi_client.ApiException as e:
print("Exception when calling ApplicationApi->create_application_api_v1_app_post: %s\n" % e)
print(
"Exception when calling ApplicationApi->create_application_api_v1_app_post: %s\n"
% e
)
57 changes: 13 additions & 44 deletions python/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements-dev.txt requirements.in/development.txt
#
Expand All @@ -11,13 +11,9 @@ attrs==21.4.0
# openapi-python-client
# pytest
autoflake==1.4
# via
# -r requirements.in/development.txt
# openapi-python-client
# via openapi-python-client
black==23.3.0
# via
# -r requirements.in/development.txt
# openapi-python-client
# via openapi-python-client
build==0.10.0
# via pip-tools
certifi==2023.07.22
Expand All @@ -29,15 +25,6 @@ click==8.0.1
# black
# pip-tools
# typer
flake8-polyfill==1.0.2
# via pep8-naming
flake8-print==4.0.0
# via -r requirements.in/development.txt
flake8==3.9.2
# via
# -r requirements.in/development.txt
# flake8-polyfill
# flake8-print
h11==0.12.0
# via httpcore
httpcore==0.15.0
Expand All @@ -53,23 +40,19 @@ idna==3.3
iniconfig==1.1.1
# via pytest
isort==5.8.0
# via
# -r requirements.in/development.txt
# openapi-python-client
# via openapi-python-client
jinja2==3.1.3
# via
# -r requirements.in/development.txt
# openapi-python-client
markupsafe==2.1.0
# via jinja2
mccabe==0.6.1
# via flake8
mypy==1.4.0
# via -r requirements.in/development.txt
mypy-extensions==1.0.0
# via
# black
# mypy
mypy==1.4.0
# via -r requirements.in/development.txt
openapi-python-client==0.14.1
# via -r requirements.in/development.txt
packaging==23.1
Expand All @@ -79,8 +62,6 @@ packaging==23.1
# pytest
pathspec==0.11.1
# via black
pep8-naming==0.11.1
# via -r requirements.in/development.txt
pip-tools==6.13.0
# via -r requirements.in/development.txt
platformdirs==3.5.1
Expand All @@ -89,45 +70,33 @@ pluggy==0.13.1
# via pytest
py==1.10.0
# via pytest
pycodestyle==2.7.0
# via
# flake8
# flake8-print
pydantic==1.10.0
pydantic==1.10.13
# via openapi-python-client
pyflakes==2.3.1
# via
# autoflake
# flake8
# via autoflake
pyproject-hooks==1.0.0
# via build
pytest==6.2.4
# via -r requirements.in/development.txt
python-dateutil==2.8.2
# via openapi-python-client
pyyaml==6.0
pyyaml==6.0.1
# via openapi-python-client
rfc3986[idna2008]==1.5.0
# via httpx
ruff==0.4.8
# via -r requirements.in/development.txt
shellingham==1.4.0
# via openapi-python-client
six==1.16.0
# via
# flake8-print
# python-dateutil
# via python-dateutil
sniffio==1.2.0
# via
# anyio
# httpcore
# httpx
toml==0.10.2
# via pytest
tomli==2.0.1
# via
# black
# build
# mypy
# pyproject-hooks
typer==0.7.0
# via openapi-python-client
typing-extensions==4.6.3
Expand Down
7 changes: 1 addition & 6 deletions python/requirements.in/development.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
autoflake
black
isort
flake8
flake8-print
pep8-naming
ruff
mypy>=1.4.0
pip-tools>=6.13.0
pytest
Expand Down
5 changes: 2 additions & 3 deletions python/scripts/format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/sh -e
set -x

autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place svix --exclude=__init__.py
isort svix
black svix
ruff check --fix svix
ruff format svix
5 changes: 2 additions & 3 deletions python/scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
set -ex

mypy svix
isort --check-only svix
black svix --check
flake8 svix
ruff check svix
ruff format --check svix
8 changes: 4 additions & 4 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Svix
Svix
The Svix server API documentation # noqa: E501
The Svix server API documentation # noqa: E501
The version of the OpenAPI document: 0.8.1
Generated by: https://openapi-generator.tech
The version of the OpenAPI document: 0.8.1
Generated by: https://openapi-generator.tech
"""

import os
Expand Down
Loading

0 comments on commit 7fb1958

Please sign in to comment.