Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.12.7
v1.13.0-dev.0
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -38,6 +39,15 @@ maintainers = [
]
name = "nextroute"
readme = "README.md"
# Intentionally no upper bound. The wheels are tagged py3-none-<platform> (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]
Expand Down Expand Up @@ -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-<platform> (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"
Expand Down
33 changes: 31 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import platform
import shutil
import subprocess

from setuptools import Distribution, setup
Expand All @@ -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-<platform> instead of
# cp3XX-cp3XX-<platform> 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):
Expand Down Expand Up @@ -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", "."]

Expand Down
2 changes: 1 addition & 1 deletion src/nextroute/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# © 2019-present nextmv.io inc
__version__ = "v1.12.7"
__version__ = "v1.13.0-dev.0"
Loading