Skip to content

sage_setup: Remove import-time dependency (setup_requires) on pkgconfig, numpy #30580

@mkoeppe

Description

@mkoeppe

Just loading src/setup.py already pulls in Cython, numpy, and pkgconfig via sage_setup, so these distributions would have to be declared as [build_system] requires in src/pyproject.toml (ex setup_requires)

By moving some computations from import-time to runtime, we get rid of this early dependency on pkgconfig, numpy. (They are, of course, still required for building the package.)

This makes setup.py sdist work using a Python that does not have numpy or pkgconfig installed. To test (with a system python that has Cython):

  $ (cd build/pkgs/sagelib/src && python3 -u setup.py --no-user-cfg sdist)

(We also reduce the load-time dependency on Cython; however, we do not address the whole load-time dependency of setup.py on Cython (via sage_setup.find, which uses open_source_file and is_package_dir) in this ticket. This is best done after #28925.)

Depends on #30709

CC: @tobiasdiez @jhpalmieri @kiwifb @dimpase

Component: build

Author: Matthias Koeppe

Branch/Commit: 8f04684

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/30580

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions