From 61c232e8c03058cc94609b27ca95b20953dc2d01 Mon Sep 17 00:00:00 2001 From: Leon Wright Date: Wed, 18 Sep 2024 13:24:57 +0800 Subject: [PATCH] chore: Switch to PyProject.toml This switches away from setup.py to the now standardised pyproject.toml. --- netkan/.coveragerc | 7 --- netkan/.pylintrc | 14 ------ netkan/MANIFEST.in | 2 + netkan/mypy.ini | 15 ------ netkan/pyproject.toml | 110 ++++++++++++++++++++++++++++++++++++++++++ netkan/pytest.ini | 7 --- netkan/setup.py | 68 -------------------------- 7 files changed, 112 insertions(+), 111 deletions(-) delete mode 100644 netkan/.coveragerc delete mode 100644 netkan/.pylintrc create mode 100644 netkan/MANIFEST.in delete mode 100644 netkan/mypy.ini create mode 100644 netkan/pyproject.toml delete mode 100644 netkan/pytest.ini delete mode 100644 netkan/setup.py diff --git a/netkan/.coveragerc b/netkan/.coveragerc deleted file mode 100644 index c7109eec..00000000 --- a/netkan/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[report] -include = - netkan/* - -exclude_lines = - pragma: no cover - if TYPE_CHECKING: diff --git a/netkan/.pylintrc b/netkan/.pylintrc deleted file mode 100644 index 9afe8c13..00000000 --- a/netkan/.pylintrc +++ /dev/null @@ -1,14 +0,0 @@ -[MESSAGES CONTROL] -disable = - line-too-long, - duplicate-code, - missing-module-docstring, - missing-class-docstring, - missing-function-docstring, - too-few-public-methods, - too-many-instance-attributes, - too-many-statements, - too-many-return-statements, - too-many-branches, - too-many-arguments, - consider-using-with, diff --git a/netkan/MANIFEST.in b/netkan/MANIFEST.in new file mode 100644 index 00000000..09c83030 --- /dev/null +++ b/netkan/MANIFEST.in @@ -0,0 +1,2 @@ +global-include *.md *.jinja2 *.graphql +recursive-exclude tests * diff --git a/netkan/mypy.ini b/netkan/mypy.ini deleted file mode 100644 index dee230d9..00000000 --- a/netkan/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -ignore_missing_imports = true -warn_redundant_casts = true -show_error_context = true -show_column_numbers = true -show_error_codes = true - -# Don't increase strictness for tests -[mypy-netkan.*] -check_untyped_defs = true -disallow_incomplete_defs = true -disallow_untyped_defs = true -disallow_any_generics = true -warn_unreachable = true -strict_equality = true diff --git a/netkan/pyproject.toml b/netkan/pyproject.toml new file mode 100644 index 00000000..2ad5024e --- /dev/null +++ b/netkan/pyproject.toml @@ -0,0 +1,110 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "netkan" +version = "1.0" +dependencies = [ + "boto3", + "click", + "gitpython", + "pynamodb", + # 2019-11-01 capping to 2.8.0 - https://github.com/boto/botocore/commit/e87e7a745fd972815b235a9ee685232745aa94f9 + "python-dateutil>=2.1,<2.8.1", + "requests", + "flask", + "jinja2", + "internetarchive!=3.0.1", + "gunicorn>=19.9,!=20.0.0", + "discord.py>=1.6.0,<=1.7.3", + "PyGithub", + "ruamel.yaml", +] +requires-python = ">=3.8" +authors = [{ name = "Leon Wright", email = "techman83@gmail.com" }] +description = "NetKAN Infra" + +[project.urls] +Repository = "https://github.com/KSP-CKAN/NetKAN-infra/" +Issues = "https://github.com/KSP-CKAN/NetKAN-infra/issues" + +[project.scripts] +netkan = "netkan.cli:netkan" + +[project.optional-dependencies] +development = [ + "ptvsd", + "autopep8", + "boto3-stubs[essential,cloudwatch]", + "coverage", + "troposphere", + "pytest", + "mypy", + "pytest-mypy", + "pylint", + "pytest-pylint", + "types-python-dateutil", + "types-click", + "types-requests", + "types-Flask", + "types-Jinja2", +] +test = [ + "boto3-stubs[essential,cloudwatch]", + "coverage", + "pytest", + "mypy", + "pytest-mypy", + "pylint", + "pytest-pylint", + "types-python-dateutil", + "types-click", + "types-requests", + "types-Flask", + "types-Jinja2", +] + +[tool.coverage.run] +branch = true +omit = ["tests/*"] + +[tool.coverage.report] +exclude_lines = ["if TYPE_CHECKING:", " pass"] + +[tool.pytest.ini_options] +python_files = "tests/__init__.py" +addopts = "-p no:cacheprovider --mypy --pylint" +filterwarnings = ["ignore", "default:::netkan.*", "default:::tests.*"] + +[tool.mypy] +ignore_missing_imports = true +warn_redundant_casts = true +show_error_context = true +show_column_numbers = true +show_error_codes = true + +[[tool.mypy.overrides]] +module = "netkan.*" +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +disallow_any_generics = true +warn_unreachable = true +strict_equality = true + +[tool.pylint."MESSAGES CONTROL"] +disable = """ + line-too-long, + duplicate-code, + missing-module-docstring, + missing-class-docstring, + missing-function-docstring, + too-few-public-methods, + too-many-instance-attributes, + too-many-statements, + too-many-return-statements, + too-many-branches, + too-many-arguments, + consider-using-with, +""" diff --git a/netkan/pytest.ini b/netkan/pytest.ini deleted file mode 100644 index b1fbcc36..00000000 --- a/netkan/pytest.ini +++ /dev/null @@ -1,7 +0,0 @@ -[pytest] -python_files = tests/__init__.py -addopts = -p no:cacheprovider --mypy --pylint -filterwarnings = - ignore - default:::netkan.* - default:::tests.* diff --git a/netkan/setup.py b/netkan/setup.py deleted file mode 100644 index 96537803..00000000 --- a/netkan/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup, find_packages - -setup( - name='netkan_indexer', - version='1.0', - description='NetKAN Indexer', - author='Leon Wright', - author_email='techman83@gmail.com', - packages=find_packages(), - package_data={ - "": ["*.md", "*.jinja2", "*.graphql"], - }, - install_requires=[ - 'boto3', - 'click', - 'gitpython', - 'pynamodb', - # 2019-11-01 capping to 2.8.0 - https://github.com/boto/botocore/commit/e87e7a745fd972815b235a9ee685232745aa94f9 - 'python-dateutil>=2.1,<2.8.1', - 'requests', - 'flask', - 'jinja2', - 'internetarchive!=3.0.1', - 'gunicorn>=19.9,!=20.0.0', - 'discord.py>=1.6.0,<=1.7.3', - 'PyGithub', - 'ruamel.yaml', - ], - entry_points={ - 'console_scripts': [ - 'netkan=netkan.cli:netkan', - ], - }, - extras_require={ - 'development': [ - 'ptvsd', - 'autopep8', - 'boto3-stubs[essential,cloudwatch]', - 'coverage', - 'troposphere', - 'pytest', - 'pytest-mypy', - 'mypy', - 'pytest-pylint', - 'pylint', - 'types-python-dateutil', - 'types-click', - 'types-requests', - 'types-Flask', - 'types-Jinja2', - ], - 'test': [ - 'boto3-stubs[essential,cloudwatch]', - 'coverage', - 'pytest', - 'pytest-mypy', - 'mypy', - 'pytest-pylint', - 'types-python-dateutil', - 'types-click', - 'types-requests', - 'types-Flask', - 'types-Jinja2', - ] - }, -)