From b2df27f0a17de8415d4395a895fff5227b9844fd Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:12:33 +0100 Subject: [PATCH 1/3] bump "latest" CI jobs to 3.12 --- .github/workflows/ci.yml | 8 ++++---- .gitignore | 1 + .python-version | 2 +- emscripten/.gitignore | 1 + emscripten/Makefile | 13 +++++++------ emscripten/pybuilddir.txt | 1 - noxfile.py | 2 ++ pyo3-runtime/pyproject.toml | 1 + 8 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 emscripten/.gitignore delete mode 100644 emscripten/pybuilddir.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc87bca5..d4f71af1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,7 +144,7 @@ jobs: matrix: extra-features: ["multiple-pymethods"] rust: [stable] - python-version: ["3.11"] + python-version: ["3.12"] platform: [ { @@ -221,7 +221,7 @@ jobs: include: # Test minimal supported Rust version - rust: 1.56.0 - python-version: "3.11" + python-version: "3.12" platform: { os: "ubuntu-latest", @@ -233,7 +233,7 @@ jobs: # Test the `nightly` feature - rust: nightly - python-version: "3.11" + python-version: "3.12" platform: { os: "ubuntu-latest", @@ -244,7 +244,7 @@ jobs: # Test 32-bit Windows only with the latest Python version - rust: stable - python-version: "3.11" + python-version: "3.12" platform: { os: "windows-latest", diff --git a/.gitignore b/.gitignore index f67547aa..4240d326 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ valgrind-python.supp *.pyd lcov.info netlify_build/ +.nox/ diff --git a/.python-version b/.python-version index 2c073331..e4fba218 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.11 +3.12 diff --git a/emscripten/.gitignore b/emscripten/.gitignore new file mode 100644 index 00000000..a8ee9284 --- /dev/null +++ b/emscripten/.gitignore @@ -0,0 +1 @@ +pybuilddir.txt diff --git a/emscripten/Makefile b/emscripten/Makefile index af224854..5420603e 100644 --- a/emscripten/Makefile +++ b/emscripten/Makefile @@ -2,9 +2,10 @@ CURDIR=$(abspath .) # These three are passed in from nox. BUILDROOT ?= $(CURDIR)/builddir -PYMAJORMINORMICRO ?= 3.11.0 +PYMAJORMINORMICRO ?= 3.12.0 +PYTHON ?= python3.12 -EMSCRIPTEN_VERSION=3.1.13 +EMSCRIPTEN_VERSION=3.1.46 export EMSDKDIR = $(BUILDROOT)/emsdk @@ -34,7 +35,7 @@ PYTHONLIBDIR=$(BUILDROOT)/install/Python-$(PYVERSION)/lib all: $(PYTHONLIBDIR)/libpython$(PYMAJORMINOR).a -$(BUILDROOT)/.exists: +$(BUILDROOT)/.exists: mkdir -p $(BUILDROOT) touch $@ @@ -66,18 +67,18 @@ $(PYTHONBUILD)/Makefile: $(PYTHONBUILD)/.patched $(BUILDROOT)/emsdk --build=$(shell $(PYTHONBUILD)/config.guess) \ --with-emscripten-target=browser \ --enable-wasm-dynamic-linking \ - --with-build-python=python3.11 + --with-build-python=$(PYTHON) $(PYTHONLIBDIR)/libpython$(PYMAJORMINOR).a : $(PYTHONBUILD)/Makefile cd $(PYTHONBUILD) && \ emmake make -j3 libpython$(PYMAJORMINOR).a # Generate sysconfigdata - _PYTHON_SYSCONFIGDATA_NAME=$(SYSCONFIGDATA_NAME) _PYTHON_PROJECT_BASE=$(PYTHONBUILD) python3.11 -m sysconfig --generate-posix-vars + _PYTHON_SYSCONFIGDATA_NAME=$(SYSCONFIGDATA_NAME) _PYTHON_PROJECT_BASE=$(PYTHONBUILD) $(PYTHON) -m sysconfig --generate-posix-vars cp `cat pybuilddir.txt`/$(SYSCONFIGDATA_NAME).py $(PYTHONBUILD)/Lib mkdir -p $(PYTHONLIBDIR) - # Copy libexpat.a, libmpdec.a, and libpython3.11.a + # Copy libexpat.a, libmpdec.a, and libpython3.12.a # In noxfile, we explicitly link libexpat and libmpdec via RUSTFLAGS find $(PYTHONBUILD) -name '*.a' -exec cp {} $(PYTHONLIBDIR) \; # Install Python stdlib diff --git a/emscripten/pybuilddir.txt b/emscripten/pybuilddir.txt deleted file mode 100644 index 59f2a4a7..00000000 --- a/emscripten/pybuilddir.txt +++ /dev/null @@ -1 +0,0 @@ -build/lib.linux-x86_64-3.11 \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index eb1a4d4d..0fec8f81 100644 --- a/noxfile.py +++ b/noxfile.py @@ -261,6 +261,7 @@ def build_emscripten(session: nox.Session): "make", "-C", str(info.emscripten_dir), + f"PYTHON={sys.executable}", f"BUILDROOT={info.builddir}", f"PYMAJORMINORMICRO={info.pymajorminormicro}", f"PYPRERELEASE={info.pydev}", @@ -288,6 +289,7 @@ def test_emscripten(session: nox.Session): f"-C link-arg=-lpython{info.pymajorminor}", "-C link-arg=-lexpat", "-C link-arg=-lmpdec", + "-C link-arg=-lHacl_Hash_SHA2", "-C link-arg=-lz", "-C link-arg=-lbz2", "-C link-arg=-sALLOW_MEMORY_GROWTH=1", diff --git a/pyo3-runtime/pyproject.toml b/pyo3-runtime/pyproject.toml index 3aa7dbd1..b02c64dd 100644 --- a/pyo3-runtime/pyproject.toml +++ b/pyo3-runtime/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] From 2b7eb3a05e707a106ac46f42e90504d7d17a2bf7 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:54:00 +0100 Subject: [PATCH 2/3] also test emscripten with CI-build-full --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4f71af1..279cf277 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -334,7 +334,7 @@ jobs: emscripten: name: emscripten - if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 6801c508a826b4e75293edd687d1e8ed31140374 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:25:36 +0200 Subject: [PATCH 3/3] keep emscripten back on 3.11 for now --- .github/workflows/ci.yml | 3 +++ emscripten/Makefile | 13 ++++++------- emscripten/pybuilddir.txt | 1 + noxfile.py | 1 - 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 emscripten/pybuilddir.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 279cf277..7b7a2e6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -339,6 +339,9 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 + with: + # TODO bump emscripten builds to test on 3.12 + python-version: 3.11 id: setup-python - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable diff --git a/emscripten/Makefile b/emscripten/Makefile index 5420603e..af224854 100644 --- a/emscripten/Makefile +++ b/emscripten/Makefile @@ -2,10 +2,9 @@ CURDIR=$(abspath .) # These three are passed in from nox. BUILDROOT ?= $(CURDIR)/builddir -PYMAJORMINORMICRO ?= 3.12.0 -PYTHON ?= python3.12 +PYMAJORMINORMICRO ?= 3.11.0 -EMSCRIPTEN_VERSION=3.1.46 +EMSCRIPTEN_VERSION=3.1.13 export EMSDKDIR = $(BUILDROOT)/emsdk @@ -35,7 +34,7 @@ PYTHONLIBDIR=$(BUILDROOT)/install/Python-$(PYVERSION)/lib all: $(PYTHONLIBDIR)/libpython$(PYMAJORMINOR).a -$(BUILDROOT)/.exists: +$(BUILDROOT)/.exists: mkdir -p $(BUILDROOT) touch $@ @@ -67,18 +66,18 @@ $(PYTHONBUILD)/Makefile: $(PYTHONBUILD)/.patched $(BUILDROOT)/emsdk --build=$(shell $(PYTHONBUILD)/config.guess) \ --with-emscripten-target=browser \ --enable-wasm-dynamic-linking \ - --with-build-python=$(PYTHON) + --with-build-python=python3.11 $(PYTHONLIBDIR)/libpython$(PYMAJORMINOR).a : $(PYTHONBUILD)/Makefile cd $(PYTHONBUILD) && \ emmake make -j3 libpython$(PYMAJORMINOR).a # Generate sysconfigdata - _PYTHON_SYSCONFIGDATA_NAME=$(SYSCONFIGDATA_NAME) _PYTHON_PROJECT_BASE=$(PYTHONBUILD) $(PYTHON) -m sysconfig --generate-posix-vars + _PYTHON_SYSCONFIGDATA_NAME=$(SYSCONFIGDATA_NAME) _PYTHON_PROJECT_BASE=$(PYTHONBUILD) python3.11 -m sysconfig --generate-posix-vars cp `cat pybuilddir.txt`/$(SYSCONFIGDATA_NAME).py $(PYTHONBUILD)/Lib mkdir -p $(PYTHONLIBDIR) - # Copy libexpat.a, libmpdec.a, and libpython3.12.a + # Copy libexpat.a, libmpdec.a, and libpython3.11.a # In noxfile, we explicitly link libexpat and libmpdec via RUSTFLAGS find $(PYTHONBUILD) -name '*.a' -exec cp {} $(PYTHONLIBDIR) \; # Install Python stdlib diff --git a/emscripten/pybuilddir.txt b/emscripten/pybuilddir.txt new file mode 100644 index 00000000..59f2a4a7 --- /dev/null +++ b/emscripten/pybuilddir.txt @@ -0,0 +1 @@ +build/lib.linux-x86_64-3.11 \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 0fec8f81..ee24a26f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -289,7 +289,6 @@ def test_emscripten(session: nox.Session): f"-C link-arg=-lpython{info.pymajorminor}", "-C link-arg=-lexpat", "-C link-arg=-lmpdec", - "-C link-arg=-lHacl_Hash_SHA2", "-C link-arg=-lz", "-C link-arg=-lbz2", "-C link-arg=-sALLOW_MEMORY_GROWTH=1",