Skip to content

Commit

Permalink
Minimally migrate to pyproject.toml (#827)
Browse files Browse the repository at this point in the history
* Minimally migrate to pyproject.toml

* Bump minimum to py37
  • Loading branch information
alex committed Jul 4, 2024
1 parent 37da768 commit 8822f5f
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 218 deletions.
33 changes: 0 additions & 33 deletions .circleci/build-wheel.sh

This file was deleted.

97 changes: 0 additions & 97 deletions .circleci/config.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- {VERSION: "3.12", TOXENV: "mypy", COVERAGE: "false"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
- {VERSION: "3.6", TOXENV: "py36"}
- {VERSION: "3.7", TOXENV: "py37"}
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.9", TOXENV: "py39"}
Expand Down Expand Up @@ -71,11 +70,11 @@ jobs:
- 'macos-13'
- 'macos-latest'
PYTHON:
- {VERSION: "3.6", TOXENV: "py36"}
- {VERSION: "3.7", TOXENV: "py37"}
- {VERSION: "3.12", TOXENV: "py312"}
- {VERSION: "3.12", TOXENV: "py312", NOTE: " (minimal build)", SODIUM_INSTALL_MINIMAL: "1"}
exclude:
- PYTHON: {VERSION: "3.6", TOXENV: "py36"}
- PYTHON: {VERSION: "3.7", TOXENV: "py37"}
RUNNER: macos-latest
name: "Python ${{ matrix.PYTHON.VERSION }}${{ matrix.PYTHON.NOTE }} on ${{ matrix.RUNNER }}"
steps:
Expand Down Expand Up @@ -103,7 +102,6 @@ jobs:
- {ARCH: 'x86', SODIUM_ARCH: 'Win32'}
- {ARCH: 'x64', SODIUM_ARCH: 'x64'}
PYTHON:
- {VERSION: "3.6", TOXENV: "py36", SODIUM_MSVC_VERSION: "v142"}
- {VERSION: "3.7", TOXENV: "py37", SODIUM_MSVC_VERSION: "v142"}
- {VERSION: "3.8", TOXENV: "py38", SODIUM_MSVC_VERSION: "v142"}
- {VERSION: "3.9", TOXENV: "py39", SODIUM_MSVC_VERSION: "v142"}
Expand Down
64 changes: 34 additions & 30 deletions .github/workflows/wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:

jobs:
manylinux:
runs-on: ubuntu-latest
runs-on: ${{ matrix.MANYLINUX.RUNNER }}
container:
image: ghcr.io/pyca/${{ matrix.MANYLINUX.CONTAINER }}
volumes:
Expand All @@ -28,34 +28,42 @@ jobs:
strategy:
matrix:
PYTHON:
- { VERSION: "cp36-cp36m", PATH: "/opt/python/cp36-cp36m/bin/python", ABI_VERSION: 'cp36' }
- { VERSION: "cp37-cp37m", PATH: "/opt/python/cp311-cp311/bin/python", ABI_VERSION: 'cp37' }
MANYLINUX:
- { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64" }
- { name: "manylinux_2_28_x86_64", CONTAINER: "cryptography-manylinux_2_28:x86_64"}
- { name: "musllinux_1_1_x86_64", CONTAINER: "cryptography-musllinux_1_1:x86_64"}
- { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64", RUNNER: "ubuntu-latest" }
- { name: "manylinux_2_28_x86_64", CONTAINER: "cryptography-manylinux_2_28:x86_64", RUNNER: "ubuntu-latest" }
- { name: "musllinux_1_1_x86_64", CONTAINER: "cryptography-musllinux_1_1:x86_64", RUNNER: "ubuntu-latest" }

- { NAME: "manylinux2014_aarch64", CONTAINER: "cryptography-manylinux2014_aarch64", RUNNER: [self-hosted, Linux, ARM64] }
- { name: "manylinux_2_28_aarch64", CONTAINER: "cryptography-manylinux_2_28:aarch64", RUNNER: [self-hosted, Linux, ARM64] }
- { name: "musllinux_1_1_aarch64", CONTAINER: "cryptography-musllinux_1_1:aarch64", RUNNER: [self-hosted, Linux, ARM64] }

name: "${{ matrix.PYTHON.VERSION }} for ${{ matrix.MANYLINUX.NAME }}"
steps:
- name: Ridiculous-er workaround for static node20
run: |
cp -R /staticnode/* /staticnodecontainer/
- name: Ridiculous alpine workaround for actions support on arm64
run: |
# This modifies /etc/os-release so the JS actions
# from GH can't detect that it's on alpine:aarch64. It will
# then use a glibc nodejs, which works fine when gcompat
# is installed in the container (which it is)
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release
if: startsWith(matrix.MANYLINUX.NAME, 'musllinux') && endsWith(matrix.MANYLINUX.NAME, 'aarch64')

- uses: actions/checkout@v4.1.7
with:
# The tag to build or the tag received by the tag event
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
- run: ${{ matrix.PYTHON.PATH }} -m venv .venv
- name: Install python dependencies
run: .venv/bin/pip install -U pip cffi wheel
- name: Make sdist
run: .venv/bin/python setup.py sdist
- run: tar zxvf dist/PyNaCl*.tar.gz && mkdir tmpwheelhouse
run: .venv/bin/pip install -U pip cffi wheel build
- run: |
if [ -n "${{ matrix.PYTHON.ABI_VERSION }}" ]; then
PY_LIMITED_API="--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}"
fi
cd PyNaCl*
LIBSODIUM_MAKE_ARGS="-j$(nproc)" ../.venv/bin/python setup.py bdist_wheel $PY_LIMITED_API && mv dist/PyNaCl*.whl ../tmpwheelhouse
mkdir tmpwheelhouse
LIBSODIUM_MAKE_ARGS="-j$(nproc)" .venv/bin/python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
mv dist/PyNaCl*.whl tmpwheelhouse/
- run: auditwheel repair --plat ${{ matrix.MANYLINUX.NAME }} tmpwheelhouse/PyNaCl*.whl -w wheelhouse/
- run: .venv/bin/pip install pynacl --no-index -f wheelhouse/
- run: |
Expand All @@ -65,16 +73,16 @@ jobs:
- run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
- uses: actions/upload-artifact@v4
with:
name: "pynacl-${{ github.event.inputs.version }}-${{ matrix.MANYLINUX.NAME }}- ${{ matrix.PYTHON.VERSION }}"
name: "pynacl-${{ github.event.inputs.version }}-${{ matrix.MANYLINUX.NAME }}-${{ matrix.PYTHON.VERSION }}"

path: pynacl-wheelhouse/
macos:
runs-on: macos-11
runs-on: macos-13
strategy:
matrix:
PYTHON:
- VERSION: '3.10'
ABI_VERSION: 'cp36'
ABI_VERSION: 'cp37'
DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.10.1/python-3.10.1-macos11.pkg'
BIN_PATH: '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3'
name: "Python ${{ matrix.PYTHON.VERSION }} for ABI ${{ matrix.PYTHON.ABI_VERSION }} on macOS"
Expand All @@ -91,15 +99,13 @@ jobs:
PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
- run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install -U virtualenv
- run: ${{ matrix.PYTHON.BIN_PATH }} -m virtualenv venv
- run: venv/bin/pip install -U pip wheel cffi
- name: Make sdist
run: venv/bin/python setup.py sdist
- run: tar zxvf dist/pynacl*.tar.gz && mkdir wheelhouse
- run: venv/bin/pip install -U pip wheel cffi build
- name: Build the wheel
run: |
cd pynacl*
mkdir wheelhouse
LIBSODIUM_MAKE_ARGS="-j$(sysctl -n hw.ncpu)" \
../venv/bin/python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
venv/bin/python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
mv dist/PyNaCl*.whl wheelhouse/
env:
PYTHON_VERSION: ${{ matrix.PYTHON.ABI_VERSION }}
MACOSX_DEPLOYMENT_TARGET: '10.10'
Expand All @@ -124,7 +130,7 @@ jobs:
- {ARCH: 'x86', SODIUM_ARCH: 'Win32', VS_ARCH: 'x86'}
- {ARCH: 'x64', SODIUM_ARCH: 'x64', VS_ARCH: 'amd64'}
PYTHON:
- {VERSION: "3.9", SODIUM_MSVC_VERSION: "v142", "ABI_VERSION": "cp36"}
- {VERSION: "3.9", SODIUM_MSVC_VERSION: "v142", "ABI_VERSION": "cp37"}
name: "${{ matrix.PYTHON.VERSION }} ${{ matrix.WINDOWS.ARCH }} ${{ matrix.PYTHON.ABI_VERSION }}"
steps:
- uses: actions/checkout@v4.1.7
Expand All @@ -148,15 +154,13 @@ jobs:
shell: bash

- name: Install wheel and our Python dependencies
run: python -m pip install -U pip wheel cffi
- name: Make sdist
run: python setup.py sdist
- run: tar zxvf dist/PyNaCl*.tar.gz && mkdir wheelhouse
shell: bash
run: python -m pip install -U pip wheel cffi build
- name: Build the wheel
run: |
mkdir wheelhouse
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.WINDOWS.VS_ARCH }}
cd PyNaCl* && python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
mv dist/PyNaCl*.whl wheelhouse/
shell: cmd
env:
PYNACL_SODIUM_LIBRARY_NAME: sodium
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ recursive-include src/bindings *.py *.h

# Remove our CI files
recursive-exclude .github *
recursive-exclude .circleci *

# Remove readthedocs config
exclude .readthedocs.yml
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PyNaCl: Python binding to the libsodium library

PyNaCl is a Python binding to `libsodium`_, which is a fork of the
`Networking and Cryptography library`_. These libraries have a stated goal of
improving usability, security and speed. It supports Python 3.6+ as well as
improving usability, security and speed. It supports Python 3.7+ as well as
PyPy 3.

.. _libsodium: https://github.com/jedisct1/libsodium
Expand Down
41 changes: 39 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
[build-system]
# Must be kept in sync with `setup_requirements` in `setup.py`
# Must be kept in sync with `dependencies` below
requires = [
"setuptools>=40.8.0",
"setuptools>=61.0.0",
"wheel",
"cffi>=1.4.1; platform_python_implementation != 'PyPy'",
]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["readme"]

name = "PyNaCl"
# Must be kept in sync with `src/nacl/__init__.py`
version = "1.6.0.dev1"
authors = [
{name = "The PyNaCl developers", email = "cryptography-dev@python.org"}
]
description = "Python binding to the Networking and Cryptography (NaCl) library"
license = {text = "Apache-2.0"}
classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"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",
]
requires-python = ">=3.7"
dependencies = [
"cffi>=1.4.1; platform_python_implementation != 'PyPy'"
]

[project.optional-dependencies]
tests = [
"pytest>=3.2.1,!=3.3.0",
"hypothesis>=3.27.0",
]
docs = [
"sphinx<7",
"sphinx_rtd_theme"
]

[tool.black]
line-length = 79
target-version = ["py36"]
Expand Down
Loading

0 comments on commit 8822f5f

Please sign in to comment.