From 28c171eb2fb9c5d48fbcd7cc3ed39841d475910c Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Tue, 28 Jun 2022 14:58:11 +0300 Subject: [PATCH 1/2] Moved the metadata from `setup.py` into `setup.cfg`. Fixed the error with `setuptools` and `setuptools_scm` appearing in `install_requires`. They should have been in `setup_requires`. Upgraded `setuptools_scm` version because of the compatibility issue with the latest `git` fixed in the latest release. Downgraded `setuptools` version since such a high one is not really needed. --- .github/workflows/build.yaml | 2 +- .github/workflows/pypi.yaml | 4 +-- pyproject.toml | 4 +++ setup.cfg | 46 ++++++++++++++++++++++++++++++- setup.py | 52 ------------------------------------ 5 files changed, 52 insertions(+), 56 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 837dad5..47ede93 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Setup pip - run: python -m pip install --upgrade pip setuptools wheel + run: python -m pip install --upgrade pip setuptools setuptools_scm wheel - name: Install package run: pip install .[dev] - name: Check black version diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 5adc754..a9e6783 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -16,9 +16,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine setuptools_scm[toml] + pip install setuptools wheel twine setuptools_scm[toml] build - name: Build distribution - run: python setup.py sdist bdist_wheel + run: python -m build -nwsx . - name: Publish to PyPI Test env: TWINE_USERNAME: __token__ diff --git a/pyproject.toml b/pyproject.toml index 41b4eb4..f828d76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools>=42.1", "setuptools_scm[toml]>=7.0.2", "wheel"] +build-backend = "setuptools.build_meta" + [tool.coverage.run] omit = ["binarytree/version.py"] diff --git a/setup.cfg b/setup.cfg index 04b373c..59520e3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,49 @@ +[metadata] +name = binarytree +author = Joohwan Oh +author_email = joohwan.oh@outlook.com +license = MIT +description = Python Library for Studying Binary Trees +keywords = tree, heap, bst, education +url = https://github.com/joowani/binarytree +long_description = file: README.md +long_description_content_type = text/markdown +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 + Topic :: Education + +[options] +packages = find: +install_requires = graphviz +include_package_data = True +python_requires = >=3.7 + +[options.packages.find] +exclude = tests + +[options.extras_require] +dev = + black>=22.1.0 + flake8>=4.0.1 + isort>=5.10.1 + mypy>=0.931 + pre-commit>=2.17.0 + pytest>=6.2.1 + pytest-cov>=2.10.1 + sphinx + sphinx_rtd_theme + types-setuptools + types-dataclasses + [flake8] max-line-length = 88 extend-ignore = E203, E741, W503 -exclude =.git .idea .*_cache dist htmlcov venv +exclude = .git .idea .*_cache dist htmlcov venv per-file-ignores = __init__.py:F401 conf.py:E402 diff --git a/setup.py b/setup.py deleted file mode 100644 index b9260a0..0000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -from setuptools import find_packages, setup - -with open("README.md") as fp: - description = fp.read() - -setup( - name="binarytree", - description="Python Library for Studying Binary Trees", - long_description=description, - long_description_content_type="text/markdown", - author="Joohwan Oh", - author_email="joohwan.oh@outlook.com", - url="https://github.com/joowani/binarytree", - keywords=["tree", "heap", "bst", "education"], - packages=find_packages(exclude=["tests"]), - include_package_data=True, - python_requires=">=3.7", - license="MIT", - use_scm_version=True, - setup_requires=["setuptools_scm"], - install_requires=[ - "graphviz", - "setuptools>=60.8.2", - "setuptools_scm[toml]>=5.0.1", - ], - extras_require={ - "dev": [ - "black>=22.1.0", - "flake8>=4.0.1", - "isort>=5.10.1", - "mypy>=0.931", - "pre-commit>=2.17.0", - "pytest>=6.2.1", - "pytest-cov>=2.10.1", - "sphinx", - "sphinx_rtd_theme", - "types-setuptools", - "types-dataclasses", - ], - }, - 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", - "Topic :: Education", - ], -) From 264514572f0eede4c78aab62b4fd5d104c937461 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Tue, 28 Jun 2022 15:08:17 +0300 Subject: [PATCH 2/2] Moved the metadata into `PEP 621`-compliant `pyproject.toml`. --- pyproject.toml | 59 ++++++++++++++++++++++++++++++++++++++++++++++---- setup.cfg | 49 ----------------------------------------- 2 files changed, 55 insertions(+), 53 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index f828d76..46ba9f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,61 @@ [build-system] -requires = ["setuptools>=42.1", "setuptools_scm[toml]>=7.0.2", "wheel"] +requires = ["setuptools>=61.2", "setuptools_scm[toml]>=7.0.2", "wheel"] build-backend = "setuptools.build_meta" +[project] +name = "binarytree" +authors = [{name = "Joohwan Oh", email = "joohwan.oh@outlook.com"}] +license = {text = "MIT"} +description = "Python Library for Studying Binary Trees" +readme = "README.md" +keywords = ["tree", "heap", "bst", "education"] +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", + "Topic :: Education", +] +urls = {Homepage = "https://github.com/joowani/binarytree"} +requires-python = ">=3.7" +dependencies = ["graphviz"] +dynamic = ["version"] + +[project.optional-dependencies] +dev = [ + "black>=22.1.0", + "flake8>=4.0.1", + "isort>=5.10.1", + "mypy>=0.931", + "pre-commit>=2.17.0", + "pytest>=6.2.1", + "pytest-cov>=2.10.1", + "sphinx", + "sphinx_rtd_theme", + "types-setuptools", + "types-dataclasses", +] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools_scm] +write_to = "binarytree/version.py" + +[tool.setuptools.packages.find] +exclude = ["tests"] +namespaces = false + +[tool.flake8] +max-line-length = "88" +extend-ignore = "E203, E741, W503" +exclude = ".git .idea .*_cache dist htmlcov venv" +per-file-ignores = "__init__.py:F401 conf.py:E402" + [tool.coverage.run] omit = ["binarytree/version.py"] @@ -13,9 +67,6 @@ addopts = "-s -vv -p no:warnings" minversion = "6.0" testpaths = ["tests"] -[tool.setuptools_scm] -write_to = "binarytree/version.py" - [tool.mypy] warn_return_any = true warn_unused_configs = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 59520e3..0000000 --- a/setup.cfg +++ /dev/null @@ -1,49 +0,0 @@ -[metadata] -name = binarytree -author = Joohwan Oh -author_email = joohwan.oh@outlook.com -license = MIT -description = Python Library for Studying Binary Trees -keywords = tree, heap, bst, education -url = https://github.com/joowani/binarytree -long_description = file: README.md -long_description_content_type = text/markdown -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 - Topic :: Education - -[options] -packages = find: -install_requires = graphviz -include_package_data = True -python_requires = >=3.7 - -[options.packages.find] -exclude = tests - -[options.extras_require] -dev = - black>=22.1.0 - flake8>=4.0.1 - isort>=5.10.1 - mypy>=0.931 - pre-commit>=2.17.0 - pytest>=6.2.1 - pytest-cov>=2.10.1 - sphinx - sphinx_rtd_theme - types-setuptools - types-dataclasses - -[flake8] -max-line-length = 88 -extend-ignore = E203, E741, W503 -exclude = .git .idea .*_cache dist htmlcov venv -per-file-ignores = __init__.py:F401 conf.py:E402