From 32363c27ff08f7ec3cffa1b6415848c6cdfc39c7 Mon Sep 17 00:00:00 2001 From: jo Date: Thu, 22 Jun 2023 14:53:18 +0200 Subject: [PATCH] chore: merge configuration files --- .flake8 | 5 +++++ .pre-commit-config.yaml | 1 - Makefile | 4 ++-- pyproject.toml | 4 ++++ requirements/base.txt | 1 - requirements/test.txt | 4 ---- setup.cfg | 19 ----------------- setup.py | 46 +++++++++++++++++++++++++---------------- tox.ini | 2 +- 9 files changed, 40 insertions(+), 46 deletions(-) create mode 100644 .flake8 delete mode 100644 requirements/base.txt delete mode 100644 requirements/test.txt delete mode 100644 setup.cfg mode change 100755 => 100644 setup.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..09ecbe1 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +extend-ignore = + E501 +extend-exclude = + docs diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb75a7e..d759c06 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,6 @@ repos: rev: 5.12.0 hooks: - id: isort - args: [--profile=black] - repo: https://github.com/psf/black rev: 23.3.0 diff --git a/Makefile b/Makefile index 859965a..bf175fb 100644 --- a/Makefile +++ b/Makefile @@ -51,10 +51,10 @@ clean-test: ## remove test and coverage artifacts rm -fr .pytest_cache lint: ## check code with pre-commit - tox -e pre-commit + $(VENV)/bin/tox -e pre-commit test: ## run tests quickly with the default Python - py.test + $(VENV)/bin/pytest test-all: ## run tests on every Python version with tox tox diff --git a/pyproject.toml b/pyproject.toml index 9787c3b..62d19cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[tool.isort] +profile = "black" +combine_as_imports = true + [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" diff --git a/requirements/base.txt b/requirements/base.txt deleted file mode 100644 index 9c558e3..0000000 --- a/requirements/base.txt +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index 3f71ee4..0000000 --- a/requirements/test.txt +++ /dev/null @@ -1,4 +0,0 @@ --r base.txt - -pytest -tox==3.23.1 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0b67081..0000000 --- a/setup.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[bdist_wheel] -universal = 1 - - -[pep8] -ignore = E501,E722,W503 - -[flake8] -ignore = E501,E722,W503 -exclude = - .git, - docs, - - -[aliases] -test = pytest - -[tool:pytest] -collect_ignore = ['setup.py'] diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index d6ddfec..ecd271d --- a/setup.py +++ b/setup.py @@ -1,7 +1,3 @@ -#!/usr/bin/env python - -"""The setup script.""" - from setuptools import find_packages, setup with open("README.rst") as readme_file: @@ -10,17 +6,26 @@ with open("CHANGELOG.rst") as changelog_file: changelog = changelog_file.read() -requirements = ["python-dateutil>=2.7.5", "requests>=2.20"] - -extras_require = {"docs": ["Sphinx==1.8.1", "sphinx-rtd-theme==0.4.2"]} - version = {} with open("hcloud/__version__.py") as fp: exec(fp.read(), version) setup( + name="hcloud", + version=version["VERSION"], + keywords="hcloud hetzner cloud", + description="Official Hetzner Cloud python library", + long_description=readme + "\n\n" + changelog, author="Hetzner Cloud GmbH", author_email="support-cloud@hetzner.com", + url="https://github.com/hetznercloud/hcloud-python", + project_urls={ + "Bug Tracker": "https://github.com/hetznercloud/hcloud-python/issues", + "Documentation": "https://hcloud-python.readthedocs.io/en/stable/", + "Changelog": "https://github.com/hetznercloud/hcloud-python/blob/main/CHANGELOG.md", + "Source Code": "https://github.com/hetznercloud/hcloud-python", + }, + license="MIT license", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -34,17 +39,22 @@ "Programming Language :: Python :: 3.11", ], python_requires=">=3.7", - description="Official Hetzner Cloud python library", - install_requires=requirements, - extras_require=extras_require, - license="MIT license", - long_description=readme + "\n\n" + changelog, + install_requires=[ + "python-dateutil>=2.7.5", + "requests>=2.20", + ], + extras_require={ + "docs": [ + "sphinx==1.8.1", + "sphinx-rtd-theme==0.4.2", + ], + "test": [ + "coverage>=7.2.7,<7.3", + "pytest>=7.3.2,<7.4", + "tox>=4.6.3,<4.7", + ], + }, include_package_data=True, - keywords="hcloud hetzner cloud", - name="hcloud", packages=find_packages(exclude=["examples", "tests*", "docs"]), - test_suite="tests", - url="https://github.com/hetznercloud/hcloud-python", - version=version["VERSION"], zip_safe=False, ) diff --git a/tox.ini b/tox.ini index cae4dcf..191a98d 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ commands = pre-commit run --verbose --all-files --show-diff-on-failure [testenv] passenv = FAKE_API_ENDPOINT deps = - -r{toxinidir}/requirements/test.txt + -e.[test] commands = pytest tests/unit {posargs}