From 5e93203d99b3e0412a81057bd88102113ab6e457 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna <43019056+aMahanna@users.noreply.github.com> Date: Fri, 1 Dec 2023 04:32:58 -0500 Subject: [PATCH] Migrate to `pyproject.toml` (#302) * migrate to `pyproject.toml` * `pytest` instead of `py.test` * run `black` * update build process in `pypi.yaml` (PEP518) * `pip install` before pre-commit check trying to see if this would resolve https://github.com/ArangoDB-Community/python-arango/actions/runs/6981788512/job/18999651142?pr=302 * revert 1f4d5f7 * add `args` to flake8 hook * bring back `setup.cfg` don't feel like fighting with https://github.com/ArangoDB-Community/python-arango/actions/runs/6981939895/job/19000084077?pr=302 * eof --- .github/workflows/pypi.yaml | 4 +- CONTRIBUTING.md | 2 +- arango/http.py | 2 +- pyproject.toml | 87 ++++++++++++++++++++++++++++++++----- setup.py | 57 +----------------------- 5 files changed, 81 insertions(+), 71 deletions(-) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 3aec5ff8..a24652fc 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -34,10 +34,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine setuptools-scm[toml] + pip install build twine - name: Build distribution - run: python setup.py sdist bdist_wheel + run: python -m build - name: Publish to PyPI Test env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f698c30..375d8b0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ pre-commit install # Install git pre-commit hooks Run unit tests with coverage: ```shell -py.test --cov=arango --cov-report=html # Open htmlcov/index.html in your browser +pytest --cov=arango --cov-report=html # Open htmlcov/index.html in your browser ``` To start and ArangoDB instance locally, run: diff --git a/arango/http.py b/arango/http.py index b05182d4..c5eb0acd 100644 --- a/arango/http.py +++ b/arango/http.py @@ -100,7 +100,7 @@ def __init__( pool_connections: int = DEFAULT_POOLSIZE, pool_maxsize: int = DEFAULT_POOLSIZE, pool_timeout: Union[int, float, None] = None, - **kwargs: Any + **kwargs: Any, ) -> None: self._connection_timeout = connection_timeout self._pool_timeout = pool_timeout diff --git a/pyproject.toml b/pyproject.toml index 944923f5..7c0d1244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,81 @@ [build-system] -requires = [ +requires = ["setuptools>=42", "wheel", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +normalize = true + +[project] +name = "python-arango" +description = "Python Driver for ArangoDB" +authors = [ {name= "Joohwan Oh", email = "joohwan.oh@outlook.com" }] +maintainers = [ + {name = "Joohwan Oh", email = "joohwan.oh@outlook.com"}, + {name = "Alexandru Petenchea", email = "alexandru.petenchea@arangodb.com"}, + {name = "Anthony Mahanna", email = "anthony.mahanna@arangodb.com"} +] +keywords = ["arangodb", "python", "driver"] +readme = "README.md" +dynamic = ["version"] +license = { file = "LICENSE" } +requires-python = ">=3.8" + +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Documentation :: Sphinx", + "Typing :: Typed", +] + +dependencies = [ + "urllib3>=1.26.0", + "requests", + "requests_toolbelt", + "PyJWT", "setuptools>=42", - "setuptools_scm[toml]>=6.2", - "wheel", + "importlib_metadata>=4.7.1", + "packaging>=23.1", ] -build-backend = "setuptools.build_meta" + +[project.optional-dependencies] +dev = [ + "black>=22.3.0", + "flake8>=4.0.1", + "isort>=5.10.1", + "mypy>=0.942", + "mock", + "pre-commit>=2.17.0", + "pytest>=7.1.1", + "pytest-cov>=3.0.0", + "sphinx", + "sphinx_rtd_theme", + "types-pkg_resources", + "types-requests", + "types-setuptools", +] + +[tool.setuptools.package-data] +"arango" = ["py.typed"] + +[project.urls] +homepage = "https://github.com/ArangoDB-Community/python-arango" + +[tool.setuptools] +packages = ["arango"] + + +[tool.pytest.ini_options] +addopts = "-s -vv -p no:warnings" +minversion = "6.0" +testpaths = ["tests"] [tool.coverage.run] omit = [ @@ -16,16 +87,8 @@ omit = [ [tool.isort] profile = "black" -[tool.pytest.ini_options] -addopts = "-s -vv -p no:warnings" -minversion = "6.0" -testpaths = ["tests"] - [tool.mypy] warn_return_any = true warn_unused_configs = true ignore_missing_imports = true strict = true - -[tool.setuptools_scm] -write_to = "arango/version.py" diff --git a/setup.py b/setup.py index 0c765ae4..60684932 100644 --- a/setup.py +++ b/setup.py @@ -1,56 +1,3 @@ -from setuptools import find_packages, setup +from setuptools import setup -with open("./README.md") as fp: - long_description = fp.read() - -setup( - name="python-arango", - description="Python Driver for ArangoDB", - long_description=long_description, - long_description_content_type="text/markdown", - author="Joohwan Oh", - author_email="joohwan.oh@outlook.com", - url="https://github.com/ArangoDB-Community/python-arango", - keywords=["arangodb", "python", "driver"], - packages=find_packages(exclude=["tests"]), - package_data={"arango": ["py.typed"]}, - include_package_data=True, - python_requires=">=3.8", - license="MIT", - install_requires=[ - "urllib3>=1.26.0", - "requests", - "requests_toolbelt", - "PyJWT", - "setuptools>=42", - "importlib_metadata>=4.7.1", - "packaging>=23.1", - ], - extras_require={ - "dev": [ - "black>=22.3.0", - "flake8>=4.0.1", - "isort>=5.10.1", - "mypy>=0.942", - "mock", - "pre-commit>=2.17.0", - "pytest>=7.1.1", - "pytest-cov>=3.0.0", - "sphinx", - "sphinx_rtd_theme", - "types-pkg_resources", - "types-requests", - "types-setuptools", - ], - }, - classifiers=[ - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Operating System :: MacOS", - "Operating System :: Microsoft :: Windows", - "Operating System :: Unix", - "Programming Language :: Python :: 3", - "Topic :: Documentation :: Sphinx", - ], -) +setup()