Skip to content

Commit

Permalink
Minimally migrate to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jun 30, 2024
1 parent 37da768 commit d74a465
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 212 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.

62 changes: 33 additions & 29 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,11 +73,11 @@ 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:
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 Down Expand Up @@ -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 All @@ -168,7 +172,7 @@ jobs:
run: |
python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"
- run: mkdir pynacl-wheelhouse
- run: move wheelhouse\PyNaCl*.whl pynacl-wheelhouse\
- run: move wheelhouse\pynacls*.whl pynacl-wheelhouse\
- uses: actions/upload-artifact@v4
with:
name: "pynacl-${{ github.event.inputs.version }}-win-${{ matrix.WINDOWS.ARCH }}-${{ matrix.PYTHON.VERSION }}"
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
42 changes: 40 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,50 @@
[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.6",
"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.6"
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
35 changes: 0 additions & 35 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,12 @@
from setuptools.command.build_ext import build_ext as _build_ext


requirements = []
setup_requirements = ["setuptools"]
test_requirements = [
"pytest>=3.2.1,!=3.3.0",
"hypothesis>=3.27.0",
]
docs_requirements = ["sphinx<7", "sphinx_rtd_theme"]


if platform.python_implementation() == "PyPy":
if sys.pypy_version_info < (2, 6):
raise RuntimeError(
"PyNaCl is not compatible with PyPy < 2.6. Please "
"upgrade PyPy to use this library."
)
else:
requirements.append("cffi>=1.4.1")
setup_requirements.append("cffi>=1.4.1")


def here(*paths):
Expand Down Expand Up @@ -194,19 +182,8 @@ def run(self):


setup(
name=nacl.__title__,
version=nacl.__version__,
description=nacl.__summary__,
long_description="\n".join((README, INSTALL, CHANGELOG)),
url=nacl.__uri__,
license=nacl.__license__,
author=nacl.__author__,
author_email=nacl.__email__,
python_requires=">=3.6",
setup_requires=setup_requirements,
install_requires=requirements,
extras_require={"tests": test_requirements, "docs": docs_requirements},
tests_require=test_requirements,
package_dir={"": "src"},
packages=["nacl", "nacl.pwhash", "nacl.bindings"],
package_data={"nacl": ["py.typed"]},
Expand All @@ -215,16 +192,4 @@ def run(self):
cmdclass={"build_clib": build_clib, "build_ext": build_ext},
distclass=Distribution,
zip_safe=False,
classifiers=[
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"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",
],
)
Loading

0 comments on commit d74a465

Please sign in to comment.