Skip to content

Migrate to pyproject.toml #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/kentik-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install requirements
- name: Install dependencies
working-directory: ./kentik_api_library
run: pip3 install -r requirements.txt
- name: PyTest
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements-dev.txt
- name: Code formatting
working-directory: ./kentik_api_library
run: python3 setup.py pytest
- name: Black
uses: piotrpawlaczek/python-blacken@release/stable
with:
path: './kentik_api_library'
line-length: '120'
run: python3 setup.py format --check
- name: Mypy
working-directory: ./kentik_api_library
run: python3 setup.py mypy
- name: PyLint
working-directory: ./kentik_api_library
run: python3 setup.py pylint
- name: Mypy
- name: PyTest
working-directory: ./kentik_api_library
run: python3 setup.py mypy
run: python3 setup.py pytest

build:
needs: python-versions-setup
Expand Down
8 changes: 0 additions & 8 deletions kentik_api_library/.pylintrc

This file was deleted.

2 changes: 1 addition & 1 deletion kentik_api_library/examples/alerting_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from datetime import datetime

from kentik_api import KentikAPI, ManualMitigation, AlertFilter
from kentik_api import AlertFilter, KentikAPI, ManualMitigation
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/examples/applications_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""

import logging
from kentik_api import KentikAPI, CustomApplication

from kentik_api import CustomApplication, KentikAPI
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/examples/batch_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"""

import logging
from kentik_api import KentikAPI, Criterion, Upsert, Deletion, BatchOperationPart

from kentik_api import BatchOperationPart, Criterion, Deletion, KentikAPI, Upsert
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/bulk_user_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

import yaml

import kentik_api


Expand Down
12 changes: 6 additions & 6 deletions kentik_api_library/examples/devices_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

import logging

from kentik_api.public.types import ID
from kentik_api import (
KentikAPI,
Device,
SNMPv3Conf,
AuthenticationProtocol,
PrivacyProtocol,
DeviceSubtype,
CDNAttribute,
Device,
DeviceSubtype,
Interface,
KentikAPI,
PrivacyProtocol,
SNMPv3Conf,
)
from kentik_api.public.types import ID
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/examples/dimensions_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import logging
import random
import string
from kentik_api import KentikAPI, CustomDimension, Populator

from kentik_api import CustomDimension, KentikAPI, Populator
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/examples/error_handling_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging

from kentik_api import KentikAPI, AuthError, NotFoundError, IncompleteObjectError, Device, RateLimitExceededError
from kentik_api import AuthError, Device, IncompleteObjectError, KentikAPI, NotFoundError, RateLimitExceededError
from kentik_api.public.types import ID
from kentik_api.utils import get_credentials

Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/examples/labels_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""

import logging
from kentik_api import KentikAPI, DeviceLabel

from kentik_api import DeviceLabel, KentikAPI
from kentik_api.public.types import ID
from kentik_api.utils import get_credentials

Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/my_kentik_portal_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import logging

from kentik_api import KentikAPI
from kentik_api.utils import get_credentials

Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/plans_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import logging

from kentik_api import KentikAPI
from kentik_api.utils import get_credentials

Expand Down
18 changes: 10 additions & 8 deletions kentik_api_library/examples/queries_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@

import logging
from io import BytesIO

from PIL import Image # type: ignore

from kentik_api import (
KentikAPI,
QuerySQL,
QueryObject,
QueryArrayItem,
Query,
Aggregate,
AggregateFunctionType,
FastDataType,
MetricType,
ChartViewType,
DimensionType,
FastDataType,
ImageType,
ChartViewType,
KentikAPI,
MetricType,
Query,
QueryArrayItem,
QueryObject,
QuerySQL,
)
from kentik_api.utils import get_credentials

Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/examples/saved_filters_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""

import logging
from kentik_api import KentikAPI, SavedFilter, Filters, FilterGroups, Filter

from kentik_api import Filter, FilterGroups, Filters, KentikAPI, SavedFilter
from kentik_api.utils import get_credentials

logging.basicConfig(level=logging.INFO)
Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/sites_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import logging

from kentik_api import KentikAPI, Site
from kentik_api.utils import get_credentials

Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/tags_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import logging

from kentik_api import KentikAPI, Tag
from kentik_api.utils import get_credentials

Expand Down
1 change: 1 addition & 0 deletions kentik_api_library/examples/users_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import logging

from kentik_api import KentikAPI, User
from kentik_api.utils import get_credentials

Expand Down
3 changes: 2 additions & 1 deletion kentik_api_library/kentik_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from requests.packages.urllib3.util.retry import Retry

from .kentik_api import KentikAPI
from .public import *
from requests.packages.urllib3.util.retry import Retry
13 changes: 1 addition & 12 deletions kentik_api_library/kentik_api/analytics/mapped_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@
import re
from collections import defaultdict
from dataclasses import dataclass
from typing import (
Any,
Callable,
Dict,
Generator,
List,
Optional,
Tuple,
Type,
TypeVar,
Union,
)
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Type, TypeVar, Union

import yaml
from pandas import DataFrame, to_datetime
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/active_alerts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, payload_type
from kentik_api.api_calls.api_call import APICall
from kentik_api.api_calls.api_call_decorators import get, payload_type


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/alerts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional

from kentik_api.api_calls.api_call_decorators import get, post, payload_type
from kentik_api.api_calls.api_call import APICall
from kentik_api.api_calls.api_call_decorators import get, payload_type, post


@post
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/batch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from kentik_api.api_calls.api_call_decorators import get, post, payload_type
from kentik_api.api_calls.api_call import APICall
from kentik_api.api_calls.api_call_decorators import get, payload_type, post


@post
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/device_labels.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/devices.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/plans.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get
from kentik_api.api_calls.api_call import APICall
from kentik_api.api_calls.api_call_decorators import get


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/query_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import post, payload_type
from kentik_api.api_calls.api_call import APICall
from kentik_api.api_calls.api_call_decorators import payload_type, post


@post
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/saved_filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/sites.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/kentik_api/api_calls/users.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local application imports
from kentik_api.api_calls.api_call_decorators import get, post, put, delete, payload_type
from kentik_api.api_calls.api_call import APICall, ResourceID
from kentik_api.api_calls.api_call_decorators import delete, get, payload_type, post, put


@get
Expand Down
7 changes: 4 additions & 3 deletions kentik_api_library/kentik_api/api_connection/api_connector.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Standard library imports
import logging
from http import HTTPStatus
from typing import Union, Tuple, Optional, Dict, Any
from typing import Any, Dict, Optional, Tuple, Union

# Third party imports
from requests import Timeout, RequestException, Response
from requests import RequestException, Response, Timeout

# Local application imports
from kentik_api.api_calls.api_call import APICall, APICallMethods
Expand All @@ -20,7 +20,8 @@
TimedOutError,
UnavailabilityError,
)
from .retryable_session import RetryableSession, Retry

from .retryable_session import Retry, RetryableSession

PROTOCOL_HTTP = "HTTP"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional, Dict, Any
from typing import Any, Dict, Optional

from typing_extensions import Protocol

from kentik_api.api_calls.api_call import APICall
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging
from typing import Optional

from requests import Session
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from typing import Optional

log = logging.getLogger(__name__)

Expand Down
Loading