Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
pipenv install --dev
- name: lint
run: |
pipenv run python -m flake8 .
pipenv run python -m flake8 threescale_api_crd/
- name: smoke
run: |
pipenv run python -m pytest -m smoke
15 changes: 9 additions & 6 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
[dev-packages]
black = "*"
flake8 = "*"
mypy = "*"
pylint = "*"
black = "*"
pytest = "*"
python-dotenv = "*"
backoff = "*"
python-language-server = "*"

#python-language-server = "*"
#pyls-mypy = "*"
pyls-isort = "*"
#pyls-isort = "*"

python-dotenv = "*"
pytest = "*"
pytest-xdist = "*"
pytest-order = "*"

[packages]
3scale-api = "*"
openshift-client = "*"
python-backoff = "*"

[requires]
python_version = "3"
49 changes: 49 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[metadata]
name = 3scale-api-crd
version = VERSION
description = 3scale CRD Python Client
author = Martin Kudlej
author_email = kudlej.martin@gmail.com
maintainer = Matej Dujava
maintainer_email = mdujava@redhat.com
url = https://github.com/3scale-qe/3scale-api-python-crd
license = Apache-2.0
license_files = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Operating System :: OS Independent
Intended Audience :: Developers
Topic :: Utilities
Programming Language :: Python :: 3

[options]
packages = find:
include_package_data = True
install_requires =
3scale-api
openshift-client
python-backoff

[options.packages.find]
exclude = tests

[options.extras_require]
dev =
flake8
mypy
pylint
pytest
pytest-xdist
pytest-order
python-dotenv
docs = sphinx

[flake8]
max-line-length = 120
ignore = E203,W503

[mypy]
ignore_missing_imports = True
check_untyped_defs = true
local_partial_types = true
48 changes: 2 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
import re
import sys
from setuptools import setup

from setuptools import find_packages, setup

with open("README.md", "r") as fh:
long_description = fh.read()

VERSION = "devel"
if sys.argv[1] == "--release-version":
sys.argv.pop(1)
VERSION = sys.argv.pop(1)
assert re.match(
r"[0-9]+\.[0-9]+\.[0-9]+", VERSION
), "Version definition required as first arg"

requirements = ["3scale-api", "openshift-client"]

extra_requirements = {
"dev": ["flake8", "mypy", "pylint", "pytest", "python-dotenv", "backoff"],
"docs": ["sphinx"],
}

setup(
name="3scale-api-crd",
version=VERSION,
description="3scale CRD Python Client",
author="Martin Kudlej",
author_email="kudlej.martin@gmail.com",
maintainer="Matej Dujava",
maintainer_email="mdujava@redhat.com",
url="https://github.com/3scale-qe/3scale-api-python-crd",
packages=find_packages(exclude=("tests",)),
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
install_requires=requirements,
extras_require=extra_requirements,
entry_points={},
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Topic :: Utilities",
],
)
setup()
10 changes: 5 additions & 5 deletions threescale_api_crd/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Module with default objects """
"""Module with default objects"""

import logging
import copy
Expand Down Expand Up @@ -88,7 +88,7 @@ def read_by_name(self, name: str, **kwargs) -> "DefaultResourceCRD":
"""
return self.fetch_crd_entity(name) or super().read_by_name(name, **kwargs)

def read(self, entity_id: int = None, **kwargs) -> 'DefaultResourceCRD':
def read(self, entity_id: int = None, **kwargs) -> "DefaultResourceCRD":
"""Read the instance, read will just create empty resource and lazyloads only if needed
Args:
entity_id(int): Entity id
Expand Down Expand Up @@ -146,7 +146,7 @@ def exists(self, entity_id=None, **kwargs) -> bool:
)
return self.fetch(entity_id, **kwargs)

def _list(self, **kwargs) -> List["DefaultResourceCRD"]:
def _list(self, **kwargs) -> list["DefaultResourceCRD"]:
"""Internal list implementation used in list or `select` methods
Args:
**kwargs: Optional parameters
Expand Down Expand Up @@ -232,7 +232,7 @@ def create(self, params: dict = None, **kwargs) -> "DefaultResourceCRD":
# timeout = 1000

with ocp.timeout(timeout):
(success, created_objects, _) = result.until_all(
success, created_objects, _ = result.until_all(
success_func=lambda obj: self._is_ready(obj)
)
assert created_objects
Expand Down Expand Up @@ -411,7 +411,7 @@ def get_id_from_crd(self):
return None

# flake8: noqa C901
def _extract_resource_crd(self, response, collection, klass) -> Union[List, Dict]:
def _extract_resource_crd(self, response, collection, klass) -> list | dict:
extract_params = {"response": response, "entity": self._entity_name}
if collection:
extract_params["collection"] = self._entity_collection
Expand Down
2 changes: 1 addition & 1 deletion threescale_api_crd/resources.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Module with resources for CRD for Threescale client """
"""Module with resources for CRD for Threescale client"""

import logging
import copy
Expand Down
Loading