From a56e495399116bd5e3380a9d0fb0b45f52a0b20a Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:07:17 -0500 Subject: [PATCH 1/9] migrate to `pyproject.toml` --- pyproject.toml | 93 ++++++++++++++++++++++++++++++++++++++++++++------ setup.cfg | 5 --- setup.py | 57 ++----------------------------- 3 files changed, 84 insertions(+), 71 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 944923f5..2588852f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,82 @@ [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", + "Flake8-pyproject", + "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 +88,15 @@ omit = [ [tool.isort] profile = "black" -[tool.pytest.ini_options] -addopts = "-s -vv -p no:warnings" -minversion = "6.0" -testpaths = ["tests"] +[tool.flake8] +max-line-length = 88 +extend-ignore = ["E203", "E741", "W503"] +exclude =[".git", ".idea", ".*_cache", "dist", "htmlcov", "venv"] +per-file-ignores = "__init__.py:F401" + [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.cfg b/setup.cfg deleted file mode 100644 index e600ca8d..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -max-line-length = 88 -extend-ignore = E203, E741, W503 -exclude =.git .idea .*_cache dist htmlcov venv -per-file-ignores = __init__.py:F401 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() From e83f83a2c9669021ba497b5983866b5b98a98ccc Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:07:33 -0500 Subject: [PATCH 2/9] `pytest` instead of `py.test` --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 624dc25e444341d52a7c88cc4fa50b0e43146586 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:07:43 -0500 Subject: [PATCH 3/9] run `black` --- arango/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e28b1f5ea5f2798c15a55d4ebf5ab4d55c6cdd82 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:19:29 -0500 Subject: [PATCH 4/9] update build process in `pypi.yaml` (PEP518) --- .github/workflows/pypi.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 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: From 1f4d5f73a3c7ba87042c2d6e041df71b91a05f14 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:22:12 -0500 Subject: [PATCH 5/9] `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 --- .github/workflows/docs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index bc06e12e..d54e7344 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -89,12 +89,12 @@ jobs: uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - - name: Run pre-commit checks - uses: pre-commit/action@v3.0.0 - - name: Install dependencies run: pip install .[dev] + - name: Run pre-commit checks + uses: pre-commit/action@v3.0.0 + - name: Run Sphinx doctest run: python -m sphinx -b doctest docs docs/_build From 9eadaafca53795a1d666de43e93d0d08c83f9512 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:27:47 -0500 Subject: [PATCH 6/9] revert 1f4d5f7 --- .github/workflows/docs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index d54e7344..bc06e12e 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -89,12 +89,12 @@ jobs: uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - - name: Install dependencies - run: pip install .[dev] - - name: Run pre-commit checks uses: pre-commit/action@v3.0.0 + - name: Install dependencies + run: pip install .[dev] + - name: Run Sphinx doctest run: python -m sphinx -b doctest docs docs/_build From 98fde2c231c42d43c4a720dd4a7aa08e5c7750ab Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:27:56 -0500 Subject: [PATCH 7/9] add `args` to flake8 hook --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8098f23e..d075afb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,6 +32,7 @@ repos: rev: 6.0.0 hooks: - id: flake8 + args: ['--config=pyproject.toml'] - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.991 From 7094992990485feefea0f846b23511bf13c6f986 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:33:02 -0500 Subject: [PATCH 8/9] bring back `setup.cfg` don't feel like fighting with https://github.com/ArangoDB-Community/python-arango/actions/runs/6981939895/job/19000084077?pr=302 --- .pre-commit-config.yaml | 1 - pyproject.toml | 8 -------- setup.cfg | 5 +++++ 3 files changed, 5 insertions(+), 9 deletions(-) create mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d075afb5..8098f23e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,6 @@ repos: rev: 6.0.0 hooks: - id: flake8 - args: ['--config=pyproject.toml'] - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.991 diff --git a/pyproject.toml b/pyproject.toml index 2588852f..7c0d1244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,6 @@ dependencies = [ dev = [ "black>=22.3.0", "flake8>=4.0.1", - "Flake8-pyproject", "isort>=5.10.1", "mypy>=0.942", "mock", @@ -88,13 +87,6 @@ omit = [ [tool.isort] profile = "black" -[tool.flake8] -max-line-length = 88 -extend-ignore = ["E203", "E741", "W503"] -exclude =[".git", ".idea", ".*_cache", "dist", "htmlcov", "venv"] -per-file-ignores = "__init__.py:F401" - - [tool.mypy] warn_return_any = true warn_unused_configs = true diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..19087b60 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[flake8] +max-line-length = 88 +extend-ignore = E203, E741, W503 +exclude =.git .idea .*_cache dist htmlcov venv +per-file-ignores = __init__.py:F401 \ No newline at end of file From ce67902107dcdd44ac43ca861f6f722ed80bc838 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 24 Nov 2023 09:34:27 -0500 Subject: [PATCH 9/9] eof --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 19087b60..e600ca8d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,4 +2,4 @@ max-line-length = 88 extend-ignore = E203, E741, W503 exclude =.git .idea .*_cache dist htmlcov venv -per-file-ignores = __init__.py:F401 \ No newline at end of file +per-file-ignores = __init__.py:F401