Skip to content

Commit

Permalink
Migrate SSPI to external library (#69)
Browse files Browse the repository at this point in the history
This commit adds a new dependency for Windows that includes the sspi
bindings. This removes the extra Cython build step for Windows allowing
it to be shipped as a pure wheel and simplifying our build steps. It
also solves the problem with Cython 3 that our original Cython code was
incompatible with. Finally it removes extra code allowing it to be
tested in a more self contained library.
  • Loading branch information
jborean93 authored Sep 26, 2023
1 parent 2794c49 commit f202da9
Show file tree
Hide file tree
Showing 24 changed files with 251 additions and 2,201 deletions.
56 changes: 2 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- cron: 0 9 * * *

jobs:
build_sdist:
build:
name: build sdist and universal wheel
runs-on: ubuntu-latest
steps:
Expand All @@ -40,61 +40,10 @@ jobs:
name: artifact
path: ./dist/*

build_wheels:
name: build wheels
needs:
- build_sdist

runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- version: cp37-win_amd64
- version: cp37-win32
- version: cp38-win_amd64
- version: cp38-win32
- version: cp39-win_amd64
- version: cp39-win32
- version: cp310-win_amd64
- version: cp310-win32
- version: cp311-win_amd64
- version: cp311-win32
- version: cp312-win_amd64
- version: cp312-win32

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

- name: extract sdist
shell: bash
run: |
tar xf pyspnego-*.tar.gz
mv pyspnego-*/* .
rm -r pyspnego-*/
rm pyspnego-*.tar.gz
- name: build wheel
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ARCHS: all
CIBW_BUILD: ${{ matrix.version }}
CIBW_BUILD_VERBOSITY: 1
CIBW_PRERELEASE_PYTHONS: ${{ matrix.prerelease || 'false' }}

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: artifact

test:
name: test
needs:
- build_sdist
- build_wheels
- build

runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -105,7 +54,6 @@ jobs:
- macOS-12
- windows-latest
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.10.0 - 2023-09-27

* Drop support for Python 3.7 - new minimum is 3.8+
* Moved SSPI bindings out into a separate package called `sspi`
* This simplifies this project as it doesn't have to worry about SSPI correctness
* The `sspi` package improves performance and memory allocation with a more robust API
* Fixes an issue with Cython 3 allowing it to align with more modern versions going forward

## 0.9.2 - 2023-08-29

* Added Python 3.12 wheel for Windows
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ be used to decode raw NTLM/SPNEGO/Kerberos tokens into a human readable format.

See [How to Install](#how-to-install) for more details

* CPython 3.7+
* CPython 3.8+
* [cryptography](https://github.com/pyca/cryptography)

### Optional Requirements
Expand Down
37 changes: 12 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[build-system]
requires = [
"Cython >= 0.29.29, < 3.0.0; sys_platform == 'win32'", # 0.29.29 includes fixes for Python 3.11
"setuptools >= 61.0.0", # Support for setuptools config in pyproject.toml
]
build-backend = "setuptools.build_meta"
Expand All @@ -9,7 +8,7 @@ build-backend = "setuptools.build_meta"
name = "pyspnego"
description = "Windows Negotiate Authentication Client and Server"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
license = {file = "LICENSE"}
authors = [
{ name = "Jordan Borean", email = "jborean93@gmail.com" }
Expand All @@ -19,7 +18,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -28,6 +26,7 @@ classifiers = [
]
dependencies = [
"cryptography",
"sspi >= 0.1.0; sys_platform == 'win32'"
]
dynamic = ["version"]

Expand Down Expand Up @@ -81,7 +80,7 @@ exclude = '''
profile = "black"

[tool.mypy]
exclude = "setup.py|build/"
exclude = "build/"
mypy_path = "$MYPY_CONFIG_FILE_DIR/src"
show_error_codes = true
show_column_numbers = true
Expand Down Expand Up @@ -117,6 +116,15 @@ ignore_missing_imports = true
module = "krb5.*"
ignore_missing_imports = true

# Cannot install on non-Windows so we cannot validate this
[[tool.mypy.overrides]]
module = "spnego._sspi"
disallow_any_unimported = false

[[tool.mypy.overrides]]
module = "sspi.*"
ignore_missing_imports = true

# These types are used in tests, too much effort to create stubs
[[tool.mypy.overrides]]
module = "argcomplete"
Expand Down Expand Up @@ -145,24 +153,3 @@ ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = "tests"
junit_family = "xunit2"

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = sanity,py36,py37,py38,py39,py310
skip_missing_interpreters = true
isolated_build = True
[testenv]
deps =
-r{toxinidir}/requirements-test.txt
commands =
python -m pytest -v --cov spnego --cov-report term-missing
[testenv:sanity]
commands =
python -m black . --check
python -m isort . --check-only
python -m mypy .
"""
42 changes: 0 additions & 42 deletions setup.py

This file was deleted.

Loading

0 comments on commit f202da9

Please sign in to comment.