From 90fed733f6240c2472e07f02477e426b47f87ee0 Mon Sep 17 00:00:00 2001 From: Joey Vagedes Date: Tue, 9 May 2023 07:46:51 -0700 Subject: [PATCH] transition to pyproject.toml Transitions project maintenance, building, and distribution to the pyproject.toml file. This also allows many of the python configuration files to be moved into the pyproject.toml file themselves. --- .coveragerc | 3 - .flake8 | 6 -- .../advanced-pre-commit-config.yaml | 0 .../basic-pre-commit-config.yaml | 0 .pydocstyle | 2 - license.txt => LICENSE | 0 MANIFEST.in | 13 +++ docs/user/requirements.txt | 9 --- pyproject.toml | 69 ++++++++++++++++ pytest.ini | 3 - requirements.publisher.txt | 3 - requirements.txt | 5 -- setup.py | 81 ------------------- 13 files changed, 82 insertions(+), 112 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .flake8 rename {githooks => .githooks}/advanced-pre-commit-config.yaml (100%) rename {githooks => .githooks}/basic-pre-commit-config.yaml (100%) delete mode 100644 .pydocstyle rename license.txt => LICENSE (100%) delete mode 100644 docs/user/requirements.txt create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 requirements.publisher.txt delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index f5eb3f16..00000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -include = edk2toollib/* -omit = edk2toollib/tests/* diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 1c9c898a..00000000 --- a/.flake8 +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -#E266 too many leading '#' for block comment -#E722 do not use bare 'except' -#W503 line break before binary operator, see https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator -ignore = E266,E722,W503 -max_line_length = 120 diff --git a/githooks/advanced-pre-commit-config.yaml b/.githooks/advanced-pre-commit-config.yaml similarity index 100% rename from githooks/advanced-pre-commit-config.yaml rename to .githooks/advanced-pre-commit-config.yaml diff --git a/githooks/basic-pre-commit-config.yaml b/.githooks/basic-pre-commit-config.yaml similarity index 100% rename from githooks/basic-pre-commit-config.yaml rename to .githooks/basic-pre-commit-config.yaml diff --git a/.pydocstyle b/.pydocstyle deleted file mode 100644 index 0b6c5f94..00000000 --- a/.pydocstyle +++ /dev/null @@ -1,2 +0,0 @@ -[pydocstyle] -convention = google \ No newline at end of file diff --git a/license.txt b/LICENSE similarity index 100% rename from license.txt rename to LICENSE diff --git a/MANIFEST.in b/MANIFEST.in index f796ce81..3a58192d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,4 +4,17 @@ exclude *.txt exclude .flake8 exclude .coveragerc exclude .gitignore +exclude .cspell.json +exclude .markdownlint.yaml +exclude BasicDevTests.py +exclude ConfirmVersionAndTag.py +exclude MANIFEST.in +exclude .vscode +prune docs +prune tests.unit +prune .githooks +prune .github +prune edk2_pytool_library.egg-info +prune azure-pipelines + include edk2toollib/bin/vswhere.exe \ No newline at end of file diff --git a/docs/user/requirements.txt b/docs/user/requirements.txt deleted file mode 100644 index 43c51be1..00000000 --- a/docs/user/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -mkdocs==1.4.3 -mkdocs-material==9.1.9 -mkdocstrings[python]==0.21.2 -mkdocstrings-python==0.9.0 -markdown-include==0.8.1 -mkdocs-gen-files==0.5.0 -mkdocs-exclude==1.0.2 -mkdocs-awesome-pages-plugin==2.9.0 -black==23.3.0 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..bb83a9aa --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +requires = ["setuptools", "setuptools_scm[toml]"] +build-backend = "setuptools.build_meta" + +[project] +name = "edk2-pytool-library" +maintainers = [{name = "EDK2 Pytool Maintainers", email = "edk2-pytools@microsoft.com"}] +dynamic = ["version"] +description = "Python library supporting UEFI EDK2 firmware development" +readme = {file = "readme.md", content-type = "text/markdown"} +license = {file = "LICENSE"} +dependencies = [] +classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11" + ] + +[project.urls] +homepage = "https://github.com/tianocore/edk2-pytool-library/" +documentation = "https://www.tianocore.org/edk2-pytool-library/" +issues = "https://github.com/tianocore/edk2-pytool-library/issues/" + +[project.optional-dependencies] +dev = [ + "flake8 == 6.0.0", + "flake8-pyproject == 1.2.3", + "pytest == 7.3.1", + "coverage == 7.2.5", + "pydocstyle == 6.3.0", +] +publish = [ + "setuptools == 67.7.2", + "build == 0.10.0", + "twine == 4.0.2", +] +docs = [ + "black==23.3.0", + "mkdocs==1.4.2", + "mkdocs-material==9.1.9", + "mkdocstrings[python]==0.21.2", + "mkdocstrings-python==0.9.0", + "markdown-include==0.8.1", + "mkdocs-gen-files==0.5.0", + "mkdocs-exclude==1.0.2", + "mkdocs-awesome-pages-plugin==2.9.0", +] + +[tool.setuptools_scm] + +[tool.coverage.run] +include = ["edk2toollib/*"] + +[tool.flake8] +ignore = "E266,E722,W503" +max_line_length = 120 + +[tool.pydocstyle] +convention = "google" + +[tool.pytest.ini_options] +testpaths = [ + "tests.unit" +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 471ab985..00000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -log_cli=false -log_level=DEBUG \ No newline at end of file diff --git a/requirements.publisher.txt b/requirements.publisher.txt deleted file mode 100644 index 65a710ad..00000000 --- a/requirements.publisher.txt +++ /dev/null @@ -1,3 +0,0 @@ -wheel == 0.40.0 -setuptools == 67.7.2 -twine == 4.0.2 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index faf37066..00000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest == 7.3.1 -coverage == 7.2.5 -flake8 == 6.0.0 -pydocstyle == 6.3.0 -pre-commit == 3.3.1 diff --git a/setup.py b/setup.py deleted file mode 100644 index aac09bce..00000000 --- a/setup.py +++ /dev/null @@ -1,81 +0,0 @@ -## @file setup.py -# This contains setup info for edk2-pytool-library pip module -# -## -# Copyright (c) Microsoft Corporation -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -# noqa -import setuptools -from setuptools.command.sdist import sdist -from setuptools.command.install import install -from setuptools.command.develop import develop -from edk2toollib.windows.locate_tools import _DownloadVsWhere -from edk2toollib.utility_functions import GetHostInfo - -with open("readme.md", "r") as fh: - long_description = fh.read() - - -def _download_vswhere_if_windows(): # noqa - """Downloads vswhere only if on the windows OS.""" - if GetHostInfo().os == "Windows": - _DownloadVsWhere() - - -class PostSdistCommand(sdist): # noqa - """Post-sdist.""" - def run(self): # noqa - # we need to download vswhere so throw the exception if we don't get it - _download_vswhere_if_windows() - sdist.run(self) - - -class PostInstallCommand(install): # noqa - """Post-install.""" - def run(self): # noqa - install.run(self) - _download_vswhere_if_windows() - - -class PostDevCommand(develop): # noqa - """Post-develop.""" - def run(self): # noqa - develop.run(self) - try: - _download_vswhere_if_windows() - except: - pass - - -setuptools.setup( - name="edk2-pytool-library", - author="Tianocore Edk2-PyTool-Library team", - author_email="sean.brogan@microsoft.com", - description="Python library supporting UEFI EDK2 firmware development", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/tianocore/edk2-pytool-library", - license='BSD-2-Clause-Patent', - packages=setuptools.find_packages(), - cmdclass={ - 'sdist': PostSdistCommand, - 'install': PostInstallCommand, - 'develop': PostDevCommand, - }, - include_package_data=True, - use_scm_version=True, - setup_requires=['setuptools_scm'], - python_requires=">=3.9.0", - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11" - ] -)