From 6657586bb29317e1eb552a3be98017aa04e26615 Mon Sep 17 00:00:00 2001 From: Mike Shriver Date: Mon, 21 Nov 2022 10:13:15 -0500 Subject: [PATCH 1/2] Migrate to hatch Use hatch for packaging, instead of setuptools. master GHA right now is trying to publish 0.0.0, and instead of chasing that I'm proposing to move straight to hatch --- .github/workflows/pull_request.yml | 14 ++--- pyproject.toml | 84 ++++++++++++++++++++++++++++++ requirements-test.txt | 11 ---- setup.cfg | 70 ------------------------- setup.py | 6 --- 5 files changed, 92 insertions(+), 93 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements-test.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9949d055..6914a6b4 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,14 +30,16 @@ jobs: sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev # Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change # then compile and install it with PYCURL_SSL_LIBRARY set to openssl - pip install -U pip + pip install -U pip wheel pip uninstall -y pycurl pip install --compile --no-cache-dir pycurl - pip install -Ur requirements-test.txt --upgrade-strategy eager + pip install -U -e .[test] + + # coming soon + #- name: Pre Commit Checks + # uses: pre-commit/action@v3.0.0 + # with: + # extra_args: --show-diff-on-failure - name: Run Unit Tests run: py.test tests/ -v --cov wrapanapi - - - name: Analysis (git diff) - if: failure() - run: git diff diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..ac61e7b5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.targets.sdist] +include = [ + "/wrapanapi", +] + +[tool.hatch.build.targets.wheel] +packages = [ + "/wrapanapi", +] + +[project.urls] +"Source" = "https://github.com/RedHatQE/wrapanapi" + +[project] +name = "wrapanapi" +dynamic = ["version"] +readme = "README.rst" +license-files = { paths = ["LICENSE"] } +authors = [ + { name = "Peter Savage" }, +] +maintainers = [ + { name = "Jitendra Yejare" }, + { name = "Mike Shriver" }, +] +keywords = [ + "distutils", + "hatch", + "hyperscaler", + "api", +] +dependencies = [ + "azure-storage-common>=1.0", + "azure<5.0.0", + "boto", + "boto3", + "botocore", + "cached_property", + "dateparser", + "fauxfactory", + "google-api-python-client", + "google-compute-engine", + "inflection", + "lxml", + "miq-version", + "oauth2client", + "openshift==0.3.4", + "ovirt-engine-sdk-python~=4.3", + "packaging", + "py3winrm==0.0.1", + "python-cinderclient", + "python-glanceclient", + "python-heatclient", + "python-ironicclient", + "python-keystoneclient", + "python-neutronclient==6.12.0", + "python-novaclient==7.1.2", + "python-swiftclient", + "pyvcloud==19.1.2", + "pyvmomi>=6.5.0.2017.5.post1", + "redfish-client==0.1.0", + "requests", + "tzlocal", + "vspk==5.3.2", + "wait_for", + "websocket_client", +] + +[project.optional-dependencies] +test = [ + "mock", + "pytest", + "pytest-cov", + "pytest-mock", + "pytest-variables", + "coveralls", +] diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index eeee50ca..00000000 --- a/requirements-test.txt +++ /dev/null @@ -1,11 +0,0 @@ -# they packaged the py2 package as universal wheel big nono ---no-binary azure-cosmosdb-table - --e . - -mock # bad imports in hawcular -pytest -pytest-cov -pytest-mock -pytest-variables -coveralls diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 343800e9..00000000 --- a/setup.cfg +++ /dev/null @@ -1,70 +0,0 @@ -[metadata] -name = wrapanapi -author = Peter Savage -author-email = psavage@redhat.com -summary = A base system for provider management -description-file = README.rst -classifier = - Development Status :: 4 - Beta - Environment :: Console - Intended Audience :: Developers - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Topic :: Utilities -keywords = - setup - distutils - -[files] -packages = - wrapanapi - -[flake8] -ignore = E128,E811,W503 -max-line-length = 100 - -[options] -install_requires = - azure<5.0.0 - azure-storage-common>=1.0 - boto3 - botocore - boto - cached_property - dateparser - fauxfactory - google-api-python-client - google-compute-engine - inflection - miq-version - oauth2client - ovirt-engine-sdk-python~=4.3 - openshift==0.3.4 - packaging - pyvmomi>=6.5.0.2017.5.post1 - python-cinderclient - python-swiftclient - python-glanceclient - python-ironicclient - python-keystoneclient - python-neutronclient==6.12.0 - python-novaclient==7.1.2 - python-heatclient - pyvcloud==19.1.2 - py3winrm==0.0.1 - redfish-client==0.1.0 - requests - tzlocal - vspk==5.3.2 - wait_for - websocket_client - # lxml super SGML parser, needs libxml2-devel and libxslt-devel - lxml - -[options.extras_require] -setup = - setuptools - setuptools-scm - wheel - twine diff --git a/setup.py b/setup.py deleted file mode 100644 index 93871343..00000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ - -from setuptools import setup - -setup( - pbr=True, -) From 0cf856ea81a58ee1b4d2d85a6547431cb70aaddc Mon Sep 17 00:00:00 2001 From: Mike Shriver Date: Mon, 21 Nov 2022 11:51:35 -0500 Subject: [PATCH 2/2] Add hatch build to GHA --- .github/workflows/release_to_pypi.yml | 12 +++++------- pyproject.toml | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release_to_pypi.yml b/.github/workflows/release_to_pypi.yml index 5a4ad9fc..ced52c77 100644 --- a/.github/workflows/release_to_pypi.yml +++ b/.github/workflows/release_to_pypi.yml @@ -28,10 +28,10 @@ jobs: sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev # Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change # then compile and install it with PYCURL_SSL_LIBRARY set to openssl - pip install -U pip + pip install -U pip wheel pip uninstall -y pycurl pip install --compile --no-cache-dir pycurl - pip install -Ur requirements-test.txt --upgrade-strategy eager + pip install -U .[test] - name: Run Unit Tests run: py.test tests/ -v --cov wrapanapi @@ -56,11 +56,9 @@ jobs: - name: Setup and Build run: | - sudo apt update - pip install -U pip - pip install setuptools_scm wheel twine - python setup.py sdist bdist_wheel - python -m twine check dist/* + pip install -U pip wheel twine hatch + hatch build + twine check dist/* - name: Release to PyPi uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index ac61e7b5..d443c71f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ keywords = [ "hatch", "hyperscaler", "api", + "cloud", ] dependencies = [ "azure-storage-common>=1.0",