Skip to content

Commit

Permalink
Update CI and Project Structure
Browse files Browse the repository at this point in the history
Updates the CI and project structure to perform better tests and conform
to more modern practices when it comes to Python projects. Also bumps
the version to 1.3.0 in preparation for the next release.

Signed-off-by: Jordan Borean <jborean93@gmail.com>
  • Loading branch information
jborean93 committed Feb 16, 2024
1 parent f8f4011 commit 93660c3
Show file tree
Hide file tree
Showing 13 changed files with 428 additions and 349 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build.yml

This file was deleted.

96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Test requests-gssapi
on:
push:
branches:
- main

pull_request:
branches:
- main

release:
types:
- published

jobs:
build:
name: build sdist and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: build sdist and wheel
run: |
set -ex
python -m pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: artifact
path: ./dist/*

test:
name: test
needs:
- build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist

- name: Test
shell: bash
run: |
set -ex
TOX_PYTHON=py$( echo '${{ matrix.python-version }}' | tr -d . )
sudo apt update
sudo apt install -y libkrb5-dev
python -Im pip install tox
python -Im tox run \
-f sanity \
-f "${TOX_PYTHON}" \
--installpkg dist/*.whl
env:
PYTEST_ADDOPTS: --color=yes --junitxml junit/test-results.xml

publish:
name: publish
needs:
- test
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist

- name: Publish
if: startsWith(github.event.release.tag_name, 'v')
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
env/
build/
dist/
.tox/
requests_gssapi.egg-info/

4 changes: 3 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
History
=======

FUTURE: TBD
1.3.0: 2024-02-16
-----------
- Drop flag for out of sequence detection
- Use SPNEGO mechanism by default
- Fix ``SanitizedResponse.content`` to be ``bytes`` which reflects the base type
- Migrated project to a ``src`` layout setup and a ``PEP 621`` compliant build, this should have no impact on end users

1.2.3: 2021-02-08
-----------------
Expand Down
104 changes: 104 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[build-system]
requires = [
"setuptools >= 61.0.0", # Support for setuptools config in pyproject.toml
]
build-backend = "setuptools.build_meta"

[project]
name = "requests-gssapi"
description = "A GSSAPI authentication handler for python-requests"
readme = "README.rst"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "Robbie Harwood", email = "rharwood@redhat.com" },
{ name = "Ian Cordasco" },
{ name = "Cory Benfield" },
{ name = "Michael Komitee" },
]
keywords = ["ansible", "debug", "lsp", "dap"]
classifiers = [
"License :: OSI Approved :: ISC License (ISCL)",
"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",
]
dependencies = [
"requests >= 1.1.0",
"gssapi",
]
dynamic = ["version"]

[project.urls]
homepage = "https://github.com/pythongssapi/requests-gssapi"

[project.optional-dependencies]
dev = [
"black == 24.2.0",
"isort == 5.13.2",
"pytest",
"tox >= 4.0.0",
]

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = { attr = "requests_gssapi.__version__" }

[tool.setuptools.packages.find]
where = ["src"]

[tool.black]
line-length = 120
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
addopts = "--import-mode=importlib"
testpaths = "tests"
junit_family = "xunit2"

[tool.tox]
legacy_tox_ini = """
[tox]
env_list =
sanity
py3{8,9,10,11,12}-tests
min_version = 4.0
[testenv]
package = wheel
wheel_build_env = .pkg
extras =
dev
install_command = python -Im pip install --no-compile {opts} {packages}
passenv =
PYTEST_ADDOPTS
commands =
sanity: python -m black . --check
sanity: python -m isort . --check-only
tests: python -m pytest -v
"""
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

58 changes: 0 additions & 58 deletions setup.py

This file was deleted.

18 changes: 13 additions & 5 deletions requests_gssapi/__init__.py → src/requests_gssapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
The entire `requests.api` should be supported.
"""

import logging

from .gssapi_ import HTTPSPNEGOAuth, SPNEGO, REQUIRED, OPTIONAL, DISABLED # noqa
from .compat import HTTPKerberosAuth, NullHandler
from .exceptions import MutualAuthenticationError
from .compat import NullHandler, HTTPKerberosAuth
from .gssapi_ import DISABLED, OPTIONAL, REQUIRED, SPNEGO, HTTPSPNEGOAuth # noqa

logging.getLogger(__name__).addHandler(NullHandler())

__all__ = ('HTTPSPNEGOAuth', 'HTTPKerberosAuth', 'MutualAuthenticationError',
'SPNEGO', 'REQUIRED', 'OPTIONAL', 'DISABLED')
__version__ = '1.2.3'
__all__ = (
"HTTPSPNEGOAuth",
"HTTPKerberosAuth",
"MutualAuthenticationError",
"SPNEGO",
"REQUIRED",
"OPTIONAL",
"DISABLED",
)
__version__ = "1.3.0"
Loading

0 comments on commit 93660c3

Please sign in to comment.