Skip to content

Commit 8822f5f

Browse files
authored
Minimally migrate to pyproject.toml (#827)
* Minimally migrate to pyproject.toml * Bump minimum to py37
1 parent 37da768 commit 8822f5f

File tree

9 files changed

+77
-218
lines changed

9 files changed

+77
-218
lines changed

.circleci/build-wheel.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
- {VERSION: "3.12", TOXENV: "mypy", COVERAGE: "false"}
2020
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
2121
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
22-
- {VERSION: "3.6", TOXENV: "py36"}
2322
- {VERSION: "3.7", TOXENV: "py37"}
2423
- {VERSION: "3.8", TOXENV: "py38"}
2524
- {VERSION: "3.9", TOXENV: "py39"}
@@ -71,11 +70,11 @@ jobs:
7170
- 'macos-13'
7271
- 'macos-latest'
7372
PYTHON:
74-
- {VERSION: "3.6", TOXENV: "py36"}
73+
- {VERSION: "3.7", TOXENV: "py37"}
7574
- {VERSION: "3.12", TOXENV: "py312"}
7675
- {VERSION: "3.12", TOXENV: "py312", NOTE: " (minimal build)", SODIUM_INSTALL_MINIMAL: "1"}
7776
exclude:
78-
- PYTHON: {VERSION: "3.6", TOXENV: "py36"}
77+
- PYTHON: {VERSION: "3.7", TOXENV: "py37"}
7978
RUNNER: macos-latest
8079
name: "Python ${{ matrix.PYTHON.VERSION }}${{ matrix.PYTHON.NOTE }} on ${{ matrix.RUNNER }}"
8180
steps:
@@ -103,7 +102,6 @@ jobs:
103102
- {ARCH: 'x86', SODIUM_ARCH: 'Win32'}
104103
- {ARCH: 'x64', SODIUM_ARCH: 'x64'}
105104
PYTHON:
106-
- {VERSION: "3.6", TOXENV: "py36", SODIUM_MSVC_VERSION: "v142"}
107105
- {VERSION: "3.7", TOXENV: "py37", SODIUM_MSVC_VERSION: "v142"}
108106
- {VERSION: "3.8", TOXENV: "py38", SODIUM_MSVC_VERSION: "v142"}
109107
- {VERSION: "3.9", TOXENV: "py39", SODIUM_MSVC_VERSION: "v142"}

.github/workflows/wheel-builder.yml

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
jobs:
2121
manylinux:
22-
runs-on: ubuntu-latest
22+
runs-on: ${{ matrix.MANYLINUX.RUNNER }}
2323
container:
2424
image: ghcr.io/pyca/${{ matrix.MANYLINUX.CONTAINER }}
2525
volumes:
@@ -28,34 +28,42 @@ jobs:
2828
strategy:
2929
matrix:
3030
PYTHON:
31-
- { VERSION: "cp36-cp36m", PATH: "/opt/python/cp36-cp36m/bin/python", ABI_VERSION: 'cp36' }
31+
- { VERSION: "cp37-cp37m", PATH: "/opt/python/cp311-cp311/bin/python", ABI_VERSION: 'cp37' }
3232
MANYLINUX:
33-
- { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64" }
34-
- { name: "manylinux_2_28_x86_64", CONTAINER: "cryptography-manylinux_2_28:x86_64"}
35-
- { name: "musllinux_1_1_x86_64", CONTAINER: "cryptography-musllinux_1_1:x86_64"}
33+
- { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64", RUNNER: "ubuntu-latest" }
34+
- { name: "manylinux_2_28_x86_64", CONTAINER: "cryptography-manylinux_2_28:x86_64", RUNNER: "ubuntu-latest" }
35+
- { name: "musllinux_1_1_x86_64", CONTAINER: "cryptography-musllinux_1_1:x86_64", RUNNER: "ubuntu-latest" }
36+
37+
- { NAME: "manylinux2014_aarch64", CONTAINER: "cryptography-manylinux2014_aarch64", RUNNER: [self-hosted, Linux, ARM64] }
38+
- { name: "manylinux_2_28_aarch64", CONTAINER: "cryptography-manylinux_2_28:aarch64", RUNNER: [self-hosted, Linux, ARM64] }
39+
- { name: "musllinux_1_1_aarch64", CONTAINER: "cryptography-musllinux_1_1:aarch64", RUNNER: [self-hosted, Linux, ARM64] }
3640

3741
name: "${{ matrix.PYTHON.VERSION }} for ${{ matrix.MANYLINUX.NAME }}"
3842
steps:
3943
- name: Ridiculous-er workaround for static node20
4044
run: |
4145
cp -R /staticnode/* /staticnodecontainer/
46+
- name: Ridiculous alpine workaround for actions support on arm64
47+
run: |
48+
# This modifies /etc/os-release so the JS actions
49+
# from GH can't detect that it's on alpine:aarch64. It will
50+
# then use a glibc nodejs, which works fine when gcompat
51+
# is installed in the container (which it is)
52+
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release
53+
if: startsWith(matrix.MANYLINUX.NAME, 'musllinux') && endsWith(matrix.MANYLINUX.NAME, 'aarch64')
54+
4255
- uses: actions/checkout@v4.1.7
4356
with:
4457
# The tag to build or the tag received by the tag event
4558
ref: ${{ github.event.inputs.version || github.ref }}
4659
persist-credentials: false
4760
- run: ${{ matrix.PYTHON.PATH }} -m venv .venv
4861
- name: Install python dependencies
49-
run: .venv/bin/pip install -U pip cffi wheel
50-
- name: Make sdist
51-
run: .venv/bin/python setup.py sdist
52-
- run: tar zxvf dist/PyNaCl*.tar.gz && mkdir tmpwheelhouse
62+
run: .venv/bin/pip install -U pip cffi wheel build
5363
- run: |
54-
if [ -n "${{ matrix.PYTHON.ABI_VERSION }}" ]; then
55-
PY_LIMITED_API="--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}"
56-
fi
57-
cd PyNaCl*
58-
LIBSODIUM_MAKE_ARGS="-j$(nproc)" ../.venv/bin/python setup.py bdist_wheel $PY_LIMITED_API && mv dist/PyNaCl*.whl ../tmpwheelhouse
64+
mkdir tmpwheelhouse
65+
LIBSODIUM_MAKE_ARGS="-j$(nproc)" .venv/bin/python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
66+
mv dist/PyNaCl*.whl tmpwheelhouse/
5967
- run: auditwheel repair --plat ${{ matrix.MANYLINUX.NAME }} tmpwheelhouse/PyNaCl*.whl -w wheelhouse/
6068
- run: .venv/bin/pip install pynacl --no-index -f wheelhouse/
6169
- run: |
@@ -65,16 +73,16 @@ jobs:
6573
- run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
6674
- uses: actions/upload-artifact@v4
6775
with:
68-
name: "pynacl-${{ github.event.inputs.version }}-${{ matrix.MANYLINUX.NAME }}- ${{ matrix.PYTHON.VERSION }}"
76+
name: "pynacl-${{ github.event.inputs.version }}-${{ matrix.MANYLINUX.NAME }}-${{ matrix.PYTHON.VERSION }}"
6977

7078
path: pynacl-wheelhouse/
7179
macos:
72-
runs-on: macos-11
80+
runs-on: macos-13
7381
strategy:
7482
matrix:
7583
PYTHON:
7684
- VERSION: '3.10'
77-
ABI_VERSION: 'cp36'
85+
ABI_VERSION: 'cp37'
7886
DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.10.1/python-3.10.1-macos11.pkg'
7987
BIN_PATH: '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3'
8088
name: "Python ${{ matrix.PYTHON.VERSION }} for ABI ${{ matrix.PYTHON.ABI_VERSION }} on macOS"
@@ -91,15 +99,13 @@ jobs:
9199
PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
92100
- run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install -U virtualenv
93101
- run: ${{ matrix.PYTHON.BIN_PATH }} -m virtualenv venv
94-
- run: venv/bin/pip install -U pip wheel cffi
95-
- name: Make sdist
96-
run: venv/bin/python setup.py sdist
97-
- run: tar zxvf dist/pynacl*.tar.gz && mkdir wheelhouse
102+
- run: venv/bin/pip install -U pip wheel cffi build
98103
- name: Build the wheel
99104
run: |
100-
cd pynacl*
105+
mkdir wheelhouse
101106
LIBSODIUM_MAKE_ARGS="-j$(sysctl -n hw.ncpu)" \
102-
../venv/bin/python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
107+
venv/bin/python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
108+
mv dist/PyNaCl*.whl wheelhouse/
103109
env:
104110
PYTHON_VERSION: ${{ matrix.PYTHON.ABI_VERSION }}
105111
MACOSX_DEPLOYMENT_TARGET: '10.10'
@@ -124,7 +130,7 @@ jobs:
124130
- {ARCH: 'x86', SODIUM_ARCH: 'Win32', VS_ARCH: 'x86'}
125131
- {ARCH: 'x64', SODIUM_ARCH: 'x64', VS_ARCH: 'amd64'}
126132
PYTHON:
127-
- {VERSION: "3.9", SODIUM_MSVC_VERSION: "v142", "ABI_VERSION": "cp36"}
133+
- {VERSION: "3.9", SODIUM_MSVC_VERSION: "v142", "ABI_VERSION": "cp37"}
128134
name: "${{ matrix.PYTHON.VERSION }} ${{ matrix.WINDOWS.ARCH }} ${{ matrix.PYTHON.ABI_VERSION }}"
129135
steps:
130136
- uses: actions/checkout@v4.1.7
@@ -148,15 +154,13 @@ jobs:
148154
shell: bash
149155

150156
- name: Install wheel and our Python dependencies
151-
run: python -m pip install -U pip wheel cffi
152-
- name: Make sdist
153-
run: python setup.py sdist
154-
- run: tar zxvf dist/PyNaCl*.tar.gz && mkdir wheelhouse
155-
shell: bash
157+
run: python -m pip install -U pip wheel cffi build
156158
- name: Build the wheel
157159
run: |
160+
mkdir wheelhouse
158161
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.WINDOWS.VS_ARCH }}
159-
cd PyNaCl* && python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
162+
python -m build --wheel --config-setting=--build-option=--py-limited-api=${{ matrix.PYTHON.ABI_VERSION }}
163+
mv dist/PyNaCl*.whl wheelhouse/
160164
shell: cmd
161165
env:
162166
PYNACL_SODIUM_LIBRARY_NAME: sodium

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ recursive-include src/bindings *.py *.h
3939

4040
# Remove our CI files
4141
recursive-exclude .github *
42-
recursive-exclude .circleci *
4342

4443
# Remove readthedocs config
4544
exclude .readthedocs.yml

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ PyNaCl: Python binding to the libsodium library
1515

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

2121
.. _libsodium: https://github.com/jedisct1/libsodium

pyproject.toml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,49 @@
11
[build-system]
2-
# Must be kept in sync with `setup_requirements` in `setup.py`
2+
# Must be kept in sync with `dependencies` below
33
requires = [
4-
"setuptools>=40.8.0",
4+
"setuptools>=61.0.0",
55
"wheel",
66
"cffi>=1.4.1; platform_python_implementation != 'PyPy'",
77
]
88
build-backend = "setuptools.build_meta"
99

10+
[project]
11+
dynamic = ["readme"]
12+
13+
name = "PyNaCl"
14+
# Must be kept in sync with `src/nacl/__init__.py`
15+
version = "1.6.0.dev1"
16+
authors = [
17+
{name = "The PyNaCl developers", email = "cryptography-dev@python.org"}
18+
]
19+
description = "Python binding to the Networking and Cryptography (NaCl) library"
20+
license = {text = "Apache-2.0"}
21+
classifiers = [
22+
"Programming Language :: Python :: Implementation :: CPython",
23+
"Programming Language :: Python :: Implementation :: PyPy",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
]
32+
requires-python = ">=3.7"
33+
dependencies = [
34+
"cffi>=1.4.1; platform_python_implementation != 'PyPy'"
35+
]
36+
37+
[project.optional-dependencies]
38+
tests = [
39+
"pytest>=3.2.1,!=3.3.0",
40+
"hypothesis>=3.27.0",
41+
]
42+
docs = [
43+
"sphinx<7",
44+
"sphinx_rtd_theme"
45+
]
46+
1047
[tool.black]
1148
line-length = 79
1249
target-version = ["py36"]

0 commit comments

Comments
 (0)