From 6e6f547a677cda71d122a43e6d260c36f5d24f2f Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Tue, 4 Jun 2024 09:15:34 +1000 Subject: [PATCH] Move to PEP 518 build setup Move to the new PEP 518 build setup that uses read only metadata and the new pyproject.toml configuration file. This should have no affect on end users of this library as Python has supported this configuration format in all the currently supported Python versions. --- .github/workflows/ci.yml | 15 +++------ HISTORY.rst | 6 ++++ ci/setup-kerb.sh | 1 - pyproject.toml | 39 ++++++++++++++++++++++ requests_kerberos/__init__.py | 2 +- setup.cfg | 2 -- setup.py | 61 ----------------------------------- 7 files changed, 51 insertions(+), 75 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c46a03..f3e9ba8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,6 @@ jobs: fail-fast: false matrix: include: - - python-version: '3.6' - image: python:3.6-slim - - python-version: '3.7' - image: python:3.7-slim - python-version: '3.8' image: python:3.8-slim - python-version: '3.9' @@ -72,14 +68,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 - - - name: Installing baseline packages - run: | - echo "Installing baseline pip packages" - python -m pip install --upgrade pip setuptools wheel + with: + python-version: '3.12' - name: Build package - run: python setup.py sdist bdist_wheel + run: | + python -m pip install build + python -m build - name: Capture Wheel and SDist uses: actions/upload-artifact@v4 diff --git a/HISTORY.rst b/HISTORY.rst index c6e861e..57b05dc 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,12 @@ History ======= +0.16.0: TBD +----------- + +- Raised minimum Python version to 3.8 +- Changed project build metadata to use PEP 518 pyproject.toml + 0.15.0: 2024-06-04 ------------------ diff --git a/ci/setup-kerb.sh b/ci/setup-kerb.sh index 0b277ab..28287fa 100755 --- a/ci/setup-kerb.sh +++ b/ci/setup-kerb.sh @@ -150,7 +150,6 @@ else fi echo "Updating pip and installing library" -pip$PY_MAJOR install -U pip setuptools pip$PY_MAJOR install . pip$PY_MAJOR install -r requirements-test.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d88d94d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = [ + "setuptools >= 61.0.0", # Support for setuptools config in pyproject.toml +] +build-backend = "setuptools.build_meta" + +[project] +name = "requests-kerberos" +description = "A Kerberos authentication handler for python-requests" +requires-python = ">=3.8" +license = { file = "LICENSE" } +authors = [ + { name = "Ian Cordasco", email = "graffatcolmingov@gmail.com" }, + { name = "Cory Benfield" }, + { name = "Michael Komitee'" } +] +classifiers = [ + "License :: OSI Approved :: ISC License (ISCL)" +] +dependencies = [ + "requests >= 1.1.0", + "cryptography >= 1.3", + "pyspnego[kerberos]" +] +dynamic = ["version", "readme"] + +[project.urls] +homepage = "https://github.com/requests/requests-kerberos" + +[tool.setuptools] +include-package-data = true +packages = ["requests_kerberos"] + +[tool.setuptools.package-data] +"*" = ["LICENSE", "AUTHORS"] + +[tool.setuptools.dynamic] +version = { attr = "requests_kerberos.__version__" } +readme = { file = ["README.rst", "HISTORY.rst"], content-type = "text/x-rst" } \ No newline at end of file diff --git a/requests_kerberos/__init__.py b/requests_kerberos/__init__.py index 60407b8..7b586ef 100644 --- a/requests_kerberos/__init__.py +++ b/requests_kerberos/__init__.py @@ -21,4 +21,4 @@ __all__ = ('HTTPKerberosAuth', 'MutualAuthenticationError', 'REQUIRED', 'OPTIONAL', 'DISABLED') -__version__ = '0.15.0' +__version__ = '0.16.0' diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5e40900..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100755 index a3b2995..0000000 --- a/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 -import os -import re -from setuptools import setup - -path = os.path.dirname(__file__) -desc_fd = os.path.join(path, 'README.rst') -hist_fd = os.path.join(path, 'HISTORY.rst') - -long_desc = '' -short_desc = 'A Kerberos authentication handler for python-requests' - -if os.path.isfile(desc_fd): - with open(desc_fd) as fd: - long_desc = fd.read() - -if os.path.isfile(hist_fd): - with open(hist_fd) as fd: - long_desc = '\n\n'.join([long_desc, fd.read()]) - - -def get_version(): - """ - Simple function to extract the current version using regular expressions. - """ - reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]') - with open('requests_kerberos/__init__.py') as fd: - matches = list(filter(lambda x: x, map(reg.match, fd))) - - if not matches: - raise RuntimeError( - 'Could not find the version information for requests_kerberos' - ) - - return matches[0].group(1) - - -setup( - name='requests-kerberos', - description=short_desc, - long_description=long_desc, - author='Ian Cordasco, Cory Benfield, Michael Komitee', - author_email='graffatcolmingov@gmail.com', - url='https://github.com/requests/requests-kerberos', - packages=['requests_kerberos'], - package_data={'': ['LICENSE', 'AUTHORS']}, - include_package_data=True, - version=get_version(), - license='ISC License', - install_requires=[ - 'requests>=1.1.0', - 'cryptography>=1.3', - 'pyspnego[kerberos]', - ], - extras_require={}, - python_requires='>=3.6', - classifiers=[ - "License :: OSI Approved :: ISC License (ISCL)" - ], -)