diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index fdf27ee..8607f2f 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.13"] + python-version: ["3.10", "3.13", "3.14"] platform: [ ubuntu-latest, diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e8f9774 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +# The Nextroute binary is a build artifact. It belongs in the wheels, but must +# never be shipped inside the source distribution: it is platform-specific, it +# adds ~15 MB, and whichever platform happened to build the sdist would leak its +# own binary to everyone else. +prune src/nextroute/bin diff --git a/VERSION b/VERSION index 8939046..57d881b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.12.7 +v1.13.0-dev.0 diff --git a/pyproject.toml b/pyproject.toml index c3d6395..fc8142a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dependencies = [ "pydantic>=2.5.2", @@ -38,6 +39,15 @@ maintainers = [ ] name = "nextroute" readme = "README.md" +# Intentionally no upper bound. The wheels are tagged py3-none- (see +# get_tag in setup.py), so a newly released interpreter still finds a matching +# wheel and keeps working without a new release from us. The package is pure +# Python plus a bundled Go binary invoked as a subprocess: it has no C extension +# and imports nothing beyond pydantic and long-stable stdlib modules, so there is +# nothing here that tracks the interpreter version. The classifiers below list +# the versions we actually exercise in CI; newer ones are expected to work and +# are not blocked. Only add an upper bound if a specific Python release is known +# to break us - in that case cap it at that version and say which one here. requires-python = ">=3.10" [project.urls] @@ -72,7 +82,12 @@ nextroute = ["bin/*.exe"] [tool.cibuildwheel] test-command = 'python -c "exec(\"import nextroute\nprint(nextroute.nextroute_version())\")"' -build = "cp3{10,11,12,13}-*" +# The wheels are tagged py3-none- (see get_tag in setup.py), so one +# build per platform covers every supported Python. Building more than one +# interpreter per platform would just produce the same wheel repeatedly. We build +# on the oldest supported Python so the emitted wheel cannot accidentally depend +# on a newer interpreter. +build = "cp310-*" skip = "*musllinux*" archs = "native" manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64" diff --git a/setup.py b/setup.py index b7042fc..90891b8 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os import platform +import shutil import subprocess from setuptools import Distribution, setup @@ -16,7 +17,13 @@ def finalize_options(self): def get_tag(self): python, abi, plat = _bdist_wheel.get_tag(self) - # python, abi = "py3", "none" + # The wheel bundles a prebuilt Go binary but contains no C + # extension, so it is platform-specific while being independent of + # the interpreter version. Tagging it py3-none- instead of + # cp3XX-cp3XX- means a single wheel per platform serves + # every Python we support, including versions released after this + # wheel was built. + python, abi = "py3", "none" return python, abi, plat class MyDistribution(Distribution): @@ -59,9 +66,31 @@ def has_ext_modules(self): raise Exception(f"unsupported architecture: {goarch}") # Compile the binary. +standalone_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "cmd") + +# The Go sources are deliberately not part of the source distribution, so a +# build from the sdist cannot work. Fail with an explanation rather than with a +# bare FileNotFoundError from the chdir below. +if not os.path.isdir(standalone_dir): + raise Exception( + "cannot build nextroute from source: the Go sources required to compile " + "the Nextroute binary are not shipped in the source distribution. " + "Install one of the prebuilt wheels instead. If no wheel matches your " + "platform or Python version, build from a clone of " + "https://github.com/nextmv-io/nextroute." + ) + +# Building also needs a Go toolchain, which cannot be expressed in +# build-system.requires, so check for it up front. +if shutil.which("go") is None: + raise Exception( + "cannot build nextroute from source: the Go toolchain is required to " + "compile the Nextroute binary but `go` was not found on PATH. Install Go " + "(https://go.dev/dl/), or install one of the prebuilt wheels instead." + ) + print(f"Compiling Nextroute binary for {goos} {goarch}...") cwd = os.getcwd() -standalone_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "cmd") os.chdir(standalone_dir) call = ["go", "build", "-o", "../src/nextroute/bin/nextroute.exe", "."] diff --git a/src/nextroute/__about__.py b/src/nextroute/__about__.py index 19ed4a4..681ba4d 100644 --- a/src/nextroute/__about__.py +++ b/src/nextroute/__about__.py @@ -1,2 +1,2 @@ # © 2019-present nextmv.io inc -__version__ = "v1.12.7" +__version__ = "v1.13.0-dev.0"