Skip to content

fix(packaging): build native NVIDIA DEB and RPM packages - #4

Open
shiptux wants to merge 16 commits into
flagos-ai:mainfrom
shiptux:pr/packaging
Open

fix(packaging): build native NVIDIA DEB and RPM packages#4
shiptux wants to merge 16 commits into
flagos-ai:mainfrom
shiptux:pr/packaging

Conversation

@shiptux

@shiptux shiptux commented May 21, 2026

Copy link
Copy Markdown

Summary

Updates the packaging to match current main. FlagTensor is no longer a
pure-Python/noarch-only project: it builds a native C++ operator library and a
CPython extension, and its source build obtains libtriton_jit through
FetchContent.

Package builds now use the installed TritonJIT CMake package instead of
building a private copy.

Binary packages

Debian:

  • python3-flagtensor: backend-neutral Python sources (Architecture: all)
  • libflagtensor-nvidia: CUDA C++ runtime and Triton kernel sources
  • libflagtensor-nvidia-dev: headers and FlagTensorConfig.cmake
  • python3-flagtensor-nvidia: CPython 3.12 native extension

RPM produces the corresponding packages; the development package follows the
RPM -devel naming convention.

Implementation

  • Adds an opt-in FLAGTENSOR_USE_EXTERNAL_TRITON_JIT path using
    find_package(TritonJIT 0.1.0 CONFIG REQUIRED). The normal source-build
    FetchContent path remains the default.
  • Requires libtriton-jit-nvidia >= 0.1.0-3 in both formats.
  • Installs a versioned libflagtensor.so.0, exports
    FlagTensor::operators, and installs a consumable CMake package.
  • Keeps backend-neutral Python files separate from the architecture-specific
    extension and includes backend YAML data in the wheel/package.
  • Preserves automatic distro ELF requirements while filtering only
    CUDA/PyTorch libraries supplied by the NVIDIA runtime.
  • Uses distro OpenPyXL and PyYAML. On Ubuntu 22.04, matplotlib must come from
    the Python 3.12 vendor environment because the distro package pulls in a
    CPython 3.10 NumPy extension.
  • Removes build-tree RPATHs from packaged native objects.

Validated ABI matrix

Format CUDA Python PyTorch Triton pybind11
DEB 12.8 3.12 2.10.0+cu128 3.6.0 3.0.3
RPM 12.6 3.9 2.8.0 3.4.0 3.1.0

Verification

  • Built all four DEB packages in the CUDA 12.8 container.
  • Installed the DEBs and successfully imported both flagtensor and
    flagtensor.c_operators.
  • Configured an installed-package CMake consumer using
    find_package(FlagTensor CONFIG REQUIRED).
  • Built and installed all four RPM packages; verified both Python imports and
    the exported CMake target.
  • Checked package file boundaries, generated requirements, SONAMEs, and absence
    of RPATH/RUNPATH.

Dependency order

This PR depends on flagos-ai/libtriton_jit#61 being merged and
libtriton-jit-nvidia 0.1.0-3 being published to the FlagOS APT/YUM
repositories. Local dependency directories are only for pre-publication
validation and ignore binary artifacts.

shiptux added 5 commits May 12, 2026 12:22
Adapted from FlagAttention's working template (FlagOS Python
component packaging pattern):
- dh-python + pybuild + pybuild-plugin-pyproject
- Architecture: all (noarch)
- override_dh_auto_test runs a smoke import; pytest deferred to
  upstream GPU CI
- packaging/debian/ + helpers/Dockerfile.deb (Ubuntu 22.04 base)
- 'cp -r packaging/debian debian' inside the container to satisfy
  dpkg-buildpackage's debian/-at-root expectation

Not yet built locally; expected to mirror FlagAttention's ~5 s build
and small .deb size for the pure-Python paths.
- debian/control: move python3-torch from Depends to Recommends so
  the package installs on systems where torch comes from pip / NGC
  rather than from apt main archive. dh_python3 still auto-detects
  torch via pyproject.toml's dependencies field via
  ${python3:Depends}; that's a separate follow-up if we want it
  fully removed from .deb metadata.
- debian/rules: replace 'import <module>' smoke test with
  importlib.util.find_spec to avoid triggering torch import at
  build time. Fix '; exit 0' silent-pass bug with '&&' short-circuit.
- packaging/rpm/: mirror DEB packaging for Fedora targets.
@shiptux
shiptux marked this pull request as draft May 21, 2026 12:39
shiptux added 4 commits May 21, 2026 21:42
Triggered on push tag v*, PR touching packaging/, or manual dispatch.
Runs the existing local build helper in a container and uploads the
produced .deb / .rpm as actions artifacts named 'flagtensor-amd64-packages' /
'flagtensor-amd64-rpm-packages', matching the central flagos-packaging publish
pipeline's components/flagtensor.yml artifact_pattern.
@shiptux
shiptux marked this pull request as ready for review May 21, 2026 15:10
@shiptux
shiptux marked this pull request as draft May 21, 2026 16:48
@shiptux
shiptux marked this pull request as ready for review May 22, 2026 13:48
@shiptux shiptux changed the title [packaging] Add Debian + RPM packaging fix(packaging): build native NVIDIA DEB and RPM packages Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant